Fix bogus DCHECK and rename DidForkFromZygote.
The method can also be called for non-zygote forked processes.
(cherry picked from commit 9d157e48e0abc48f08fd98e4c5e918d029c1b84c)
Change-Id: Id4f57b77c1a7f802f80e066afcf30afecc198bfc
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 3b772fe..0077389 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -574,8 +574,9 @@
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 @@
#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 @@
// 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();
}