summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2015-11-18 10:56:51 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2015-11-18 10:56:51 +0000
commit349baca032735e4a386b74709aa94d17f076cbce (patch)
treea7e1b95026fb455077a4faeffebb76c4ff8d0d7e
parentf5dd91e0461b5bb0f401a51dee39f92d52b375e7 (diff)
parentba69a51724d33444064443e456ce78b71db2fd16 (diff)
Merge "Fix bogus DCHECK and rename DidForkFromZygote."
-rw-r--r--runtime/native/dalvik_system_ZygoteHooks.cc4
-rw-r--r--runtime/runtime.cc13
-rw-r--r--runtime/runtime.h2
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_;