void LLVMState::compile_soon(STATE, GCToken gct, CompiledCode* code, CallFrame* call_frame, Object* placement, bool is_block) { bool wait = config().jit_sync; if(code->machine_code()->call_count <= 1) { return; } if(code->machine_code()->compiling_p()) { return; } int hits = code->machine_code()->call_count; code->machine_code()->set_compiling(); BackgroundCompileRequest* req = new BackgroundCompileRequest(state, code, placement, hits, is_block); queued_methods_++; if(wait) { wait_mutex.lock(); req->set_waiter(&wait_cond); background_thread_->add(req); state->set_call_frame(call_frame); gc_independent(); wait_cond.wait(wait_mutex); wait_mutex.unlock(); gc_dependent(); state->set_call_frame(0); if(state->shared().config.jit_show_compiling) { llvm::outs() << "[[[ JIT compiled " << enclosure_name(code) << "#" << symbol_debug_str(code->name()) << (req->is_block() ? " (block) " : " (method) ") << queued_methods() << "/" << jitted_methods() << " ]]]\n"; } } else { background_thread_->add(req); if(state->shared().config.jit_show_compiling) { llvm::outs() << "[[[ JIT queued " << enclosure_name(code) << "#" << symbol_debug_str(code->name()) << (req->is_block() ? " (block) " : " (method) ") << queued_methods() << "/" << jitted_methods() << " ]]]\n"; } } }
void lock(GCToken gct) { gc_independent(gct); vm_->lock(vm_); gc_dependent(); }