Fix JIT options with late init
Previously we couldn't create the JIT since we didn't have any
JITOptions.
Bug: 19735273
Change-Id: I24b8ed131ed8b18f75ec94291e135d8a1c089ebd
diff --git a/runtime/native/dalvik_system_ZygoteHooks.cc b/runtime/native/dalvik_system_ZygoteHooks.cc
index 8395150..022c56f 100644
--- a/runtime/native/dalvik_system_ZygoteHooks.cc
+++ b/runtime/native/dalvik_system_ZygoteHooks.cc
@@ -21,6 +21,7 @@
#include "arch/instruction_set.h"
#include "debugger.h"
#include "java_vm_ext.h"
+#include "jit/jit.h"
#include "jni_internal.h"
#include "JNIHelp.h"
#include "ScopedUtfChars.h"
@@ -94,18 +95,17 @@
debug_flags &= ~DEBUG_ENABLE_SAFEMODE;
}
+ bool use_jit = false;
if ((debug_flags & DEBUG_ENABLE_JIT) != 0) {
if (safe_mode) {
- LOG(INFO) << "Not enabling JIT due to VM safe mode";
+ LOG(INFO) << "Not enabling JIT due to safe mode";
} else {
- if (runtime->GetJit() == nullptr) {
- runtime->CreateJit();
- } else {
- LOG(INFO) << "Not late-enabling JIT (already on)";
- }
+ use_jit = true;
+ LOG(INFO) << "Late-enabling JIT";
}
debug_flags &= ~DEBUG_ENABLE_JIT;
}
+ runtime->GetJITOptions()->SetUseJIT(use_jit);
// This is for backwards compatibility with Dalvik.
debug_flags &= ~DEBUG_ENABLE_ASSERT;