Skip to content

Commit

Permalink
Showing 8 changed files with 22 additions and 39 deletions.
6 changes: 1 addition & 5 deletions vm/gc/finalize.cpp
Original file line number Diff line number Diff line change
@@ -159,11 +159,7 @@ namespace rubinius {
supervisor_cond_.init();
exit_ = false;
finishing_ = false;

if(vm_) {
VM::discard(state, vm_);
vm_ = NULL;
}
vm_ = NULL;

start_thread(state);
}
24 changes: 10 additions & 14 deletions vm/gc/immix_marker.cpp
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ namespace rubinius {
ImmixMarker::ImmixMarker(STATE, ImmixGC* immix)
: AuxiliaryThread()
, shared_(state->shared())
, self_(NULL)
, vm_(NULL)
, immix_(immix)
, data_(NULL)
, exit_(false)
@@ -45,24 +45,25 @@ namespace rubinius {
void ImmixMarker::initialize(STATE) {
run_lock_.init();
run_cond_.init();
vm_ = NULL;
}

void ImmixMarker::start_thread(STATE) {
SYNC(state);
if(self_) return;
if(vm_) return;
utilities::thread::Mutex::LockGuard lg(run_lock_);
self_ = state->shared().new_vm();
self_->metrics()->init(metrics::eRubyMetrics);
vm_ = state->shared().new_vm();
vm_->metrics()->init(metrics::eRubyMetrics);
exit_ = false;
thread_.set(Thread::create(state, self_, G(thread), immix_marker_tramp, true));
thread_.set(Thread::create(state, vm_, G(thread), immix_marker_tramp, true));
run(state);
}

void ImmixMarker::stop_thread(STATE) {
SYNC(state);
if(!self_) return;
if(!vm_) return;

pthread_t os = self_->os_thread();
pthread_t os = vm_->os_thread();
{
utilities::thread::Mutex::LockGuard lg(run_lock_);
// Thread might have already been stopped
@@ -72,7 +73,7 @@ namespace rubinius {

void* return_value;
pthread_join(os, &return_value);
self_ = NULL;
vm_ = NULL;
}

void ImmixMarker::shutdown(STATE) {
@@ -82,11 +83,6 @@ namespace rubinius {
void ImmixMarker::after_fork_child(STATE) {
initialize(state);

if(self_) {
VM::discard(state, self_);
self_ = NULL;
}

if(data_) {
delete data_;
data_ = NULL;
@@ -109,7 +105,7 @@ namespace rubinius {
void ImmixMarker::perform(STATE) {
GCTokenImpl gct;
RBX_DTRACE_CONST char* thread_name = const_cast<RBX_DTRACE_CONST char*>("rbx.immix");
self_->set_name(thread_name);
vm_->set_name(thread_name);

RUBINIUS_THREAD_START(const_cast<RBX_DTRACE_CONST char*>(thread_name),
state->vm()->thread_id(), 1);
2 changes: 1 addition & 1 deletion vm/gc/immix_marker.hpp
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ namespace rubinius {

class ImmixMarker : public AuxiliaryThread, public Lockable {
SharedState& shared_;
VM* self_;
VM* vm_;
ImmixGC* immix_;
GCData* data_;

6 changes: 1 addition & 5 deletions vm/llvm/state.cpp
Original file line number Diff line number Diff line change
@@ -231,11 +231,7 @@ namespace rubinius {
void LLVMState::after_fork_child(STATE) {
compile_list_.get()->clear(state);
current_compiler_ = 0;

if(vm_) {
VM::discard(state, vm_);
vm_ = NULL;
}
vm_ = NULL;

start_thread(state);
vm_->metrics()->init(metrics::eJITMetrics);
6 changes: 1 addition & 5 deletions vm/metrics.cpp
Original file line number Diff line number Diff line change
@@ -467,11 +467,7 @@ namespace rubinius {

void Metrics::after_fork_child(STATE) {
metrics_lock_.init();

if(vm_) {
VM::discard(state, vm_);
vm_ = NULL;
}
vm_ = NULL;

start(state);
if(emitter_) emitter_->reinit();
7 changes: 3 additions & 4 deletions vm/oop.cpp
Original file line number Diff line number Diff line change
@@ -587,11 +587,10 @@ namespace rubinius {
}
// Fall through
case eAuxWordInflated:
// Just set the values
header.f.meaning = eAuxWordEmpty;
header.f.aux_word = 0;
// Just set the values
header.f.meaning = eAuxWordEmpty;
header.f.aux_word = 0;
}

}

LockStatus ObjectHeader::unlock(STATE, GCToken gct, CallFrame* call_frame) {
4 changes: 4 additions & 0 deletions vm/shared_state.cpp
Original file line number Diff line number Diff line change
@@ -179,12 +179,14 @@ namespace rubinius {

void SharedState::reset_threads(STATE, GCToken gct, CallFrame* call_frame) {
VM* current = state->vm();

for(ThreadList::iterator i = threads_.begin();
i != threads_.end();
++i) {
if(VM* vm = (*i)->as_vm()) {
if(vm == current) {
vm->metrics()->init(metrics::eRubyMetrics);
state->vm()->metrics()->system_metrics.vm_threads++;
continue;
}

@@ -193,6 +195,8 @@ namespace rubinius {
thread->unlock_locks(state, gct, call_frame);
thread->stopped();
}

delete vm;
}
}
threads_.clear();
6 changes: 1 addition & 5 deletions vm/signal.cpp
Original file line number Diff line number Diff line change
@@ -88,6 +88,7 @@ namespace rubinius {
void SignalHandler::initialize(STATE) {
worker_lock_.init();
worker_cond_.init();
vm_ = NULL;
}

void SignalHandler::start_thread(STATE) {
@@ -132,11 +133,6 @@ namespace rubinius {
void SignalHandler::after_fork_child(STATE) {
initialize(state);

if(vm_) {
VM::discard(state, vm_);
vm_ = NULL;
}

start_thread(state);
}

0 comments on commit 5eabb95

Please sign in to comment.