void SharedState::after_fork_child(STATE, GCToken gct, CallFrame* call_frame) { // For now, we disable inline debugging here. This makes inspecting // it much less confusing. config.jit_inline_debug.set("no"); env_->set_root_vm(state->vm()); disable_metrics(state); reset_threads(state, gct, call_frame); // Reinit the locks for this object global_cache->reset(); fork_exec_lock_.init(); capi_ds_lock_.init(); capi_locks_lock_.init(); capi_constant_lock_.init(); global_capi_handle_lock_.init(); capi_handle_cache_lock_.init(); llvm_state_lock_.init(); vm_lock_.init(); wait_lock_.init(); type_info_lock_.init(); code_resource_lock_.init(); internal_threads_->init(); om->after_fork_child(state); console_->after_fork_child(state); state->vm()->set_run_state(ManagedThread::eIndependent); gc_dependent(state, 0); }
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(); }