diff options
| -rw-r--r-- | runtime/native/dalvik_system_ZygoteHooks.cc | 4 | ||||
| -rw-r--r-- | runtime/runtime.cc | 13 | ||||
| -rw-r--r-- | runtime/runtime.h | 2 |
3 files changed, 10 insertions, 9 deletions
diff --git a/runtime/native/dalvik_system_ZygoteHooks.cc b/runtime/native/dalvik_system_ZygoteHooks.cc index bd23d70cf7..ae1a4d7823 100644 --- a/runtime/native/dalvik_system_ZygoteHooks.cc +++ b/runtime/native/dalvik_system_ZygoteHooks.cc @@ -181,9 +181,9 @@ static void ZygoteHooks_nativePostForkChild(JNIEnv* env, jclass, jlong token, ji if (isa != kNone && isa != kRuntimeISA) { action = Runtime::NativeBridgeAction::kInitialize; } - Runtime::Current()->DidForkFromZygote(env, action, isa_string.c_str()); + Runtime::Current()->InitNonZygoteOrPostFork(env, action, isa_string.c_str()); } else { - Runtime::Current()->DidForkFromZygote(env, Runtime::NativeBridgeAction::kUnload, nullptr); + Runtime::Current()->InitNonZygoteOrPostFork(env, Runtime::NativeBridgeAction::kUnload, nullptr); } } diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 3b772fe06e..0077389801 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -574,8 +574,9 @@ bool Runtime::Start() { if (is_native_bridge_loaded_) { PreInitializeNativeBridge("."); } - DidForkFromZygote(self->GetJniEnv(), NativeBridgeAction::kInitialize, - GetInstructionSetString(kRuntimeISA)); + InitNonZygoteOrPostFork(self->GetJniEnv(), + NativeBridgeAction::kInitialize, + GetInstructionSetString(kRuntimeISA)); } ATRACE_BEGIN("StartDaemonThreads"); @@ -664,7 +665,7 @@ bool Runtime::InitZygote() { #endif } -void Runtime::DidForkFromZygote(JNIEnv* env, NativeBridgeAction action, const char* isa) { +void Runtime::InitNonZygoteOrPostFork(JNIEnv* env, NativeBridgeAction action, const char* isa) { is_zygote_ = false; if (is_native_bridge_loaded_) { @@ -686,9 +687,9 @@ void Runtime::DidForkFromZygote(JNIEnv* env, NativeBridgeAction action, const ch // before fork aren't attributed to an app. heap_->ResetGcPerformanceInfo(); - if (!safe_mode_ && jit_options_->UseJIT()) { - DCHECK(jit_.get() == nullptr) << "The zygote should not JIT"; - // Create the JIT if the flag is set. + if (!safe_mode_ && jit_options_->UseJIT() && jit_.get() == nullptr) { + // Note that when running ART standalone (not zygote, nor zygote fork), + // the jit may have already been created. CreateJit(); } diff --git a/runtime/runtime.h b/runtime/runtime.h index 386d88f16e..d61663cd10 100644 --- a/runtime/runtime.h +++ b/runtime/runtime.h @@ -447,7 +447,7 @@ class Runtime { void PreZygoteFork(); bool InitZygote(); - void DidForkFromZygote(JNIEnv* env, NativeBridgeAction action, const char* isa); + void InitNonZygoteOrPostFork(JNIEnv* env, NativeBridgeAction action, const char* isa); const instrumentation::Instrumentation* GetInstrumentation() const { return &instrumentation_; |