Skip to content

Commit 0ec0c5c

Browse files
committedApr 18, 2015
Synchronize immediate JIT requests.
1 parent a002319 commit 0ec0c5c

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed
 

Diff for: ‎vm/llvm/state.cpp

+13-4
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,11 @@ namespace rubinius {
248248
if(!compile_request || compile_request->nil_p()) continue;
249249
}
250250

251+
utilities::thread::Condition* cond = compile_request->waiter();
252+
253+
// Don't proceed until requester has reached the wait_cond
254+
if(cond) wait_mutex.lock();
255+
251256
Context ctx(this);
252257
jit::Compiler jit(&ctx);
253258

@@ -272,7 +277,8 @@ namespace rubinius {
272277
}
273278

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

@@ -307,7 +313,8 @@ namespace rubinius {
307313
<< " ]]]\n";
308314
}
309315
// If someone was waiting on this, wake them up.
310-
if(utilities::thread::Condition* cond = compile_request->waiter()) {
316+
if(cond) {
317+
wait_mutex.unlock();
311318
cond->signal();
312319
}
313320

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

323330
// If someone was waiting on this, wake them up.
324-
if(utilities::thread::Condition* cond = compile_request->waiter()) {
331+
if(cond) {
332+
wait_mutex.unlock();
325333
cond->signal();
326334
}
327335
current_compiler_ = 0;
@@ -369,7 +377,8 @@ namespace rubinius {
369377
}
370378

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

0 commit comments

Comments
 (0)
Please sign in to comment.