Skip to content

Commit

Permalink
Synchronize immediate JIT requests.
Browse files Browse the repository at this point in the history
  • Loading branch information
brixen committed Apr 18, 2015
1 parent a002319 commit 0ec0c5c
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions vm/llvm/state.cpp
Expand Up @@ -248,6 +248,11 @@ namespace rubinius {
if(!compile_request || compile_request->nil_p()) continue;
}

utilities::thread::Condition* cond = compile_request->waiter();

// Don't proceed until requester has reached the wait_cond
if(cond) wait_mutex.lock();

Context ctx(this);
jit::Compiler jit(&ctx);

Expand All @@ -272,7 +277,8 @@ namespace rubinius {
}

// If someone was waiting on this, wake them up.
if(utilities::thread::Condition* cond = compile_request->waiter()) {
if(cond) {
wait_mutex.unlock();
cond->signal();
}

Expand Down Expand Up @@ -307,7 +313,8 @@ namespace rubinius {
<< " ]]]\n";
}
// If someone was waiting on this, wake them up.
if(utilities::thread::Condition* cond = compile_request->waiter()) {
if(cond) {
wait_mutex.unlock();
cond->signal();
}

Expand All @@ -321,7 +328,8 @@ namespace rubinius {
metrics().m.jit_metrics.methods_failed++;

// If someone was waiting on this, wake them up.
if(utilities::thread::Condition* cond = compile_request->waiter()) {
if(cond) {
wait_mutex.unlock();
cond->signal();
}
current_compiler_ = 0;
Expand Down Expand Up @@ -369,7 +377,8 @@ namespace rubinius {
}

// If someone was waiting on this, wake them up.
if(utilities::thread::Condition* cond = compile_request->waiter()) {
if(cond) {
wait_mutex.unlock();
cond->signal();
}

Expand Down

0 comments on commit 0ec0c5c

Please sign in to comment.