summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2015-03-17 09:52:22 -0700
committerMathieu Chartier <mathieuc@google.com>2015-03-17 11:40:27 -0700
commit6eff38d6a949c5be1532c1ed881a6c2d7bf0991a (patch)
tree7eb1e54cd1345d37364d42c0e8453180cf8363ff
parentea2a45669b807486b0570c66d29a721e684f8d47 (diff)
downloadandroid_art-6eff38d6a949c5be1532c1ed881a6c2d7bf0991a.tar.gz
android_art-6eff38d6a949c5be1532c1ed881a6c2d7bf0991a.tar.bz2
android_art-6eff38d6a949c5be1532c1ed881a6c2d7bf0991a.zip
Add JIT zygote hook
Bug: 19735273 Change-Id: I1983852e80010c344b45e0bb459de47c56adfce8
-rw-r--r--runtime/native/dalvik_system_ZygoteHooks.cc20
1 files changed, 17 insertions, 3 deletions
diff --git a/runtime/native/dalvik_system_ZygoteHooks.cc b/runtime/native/dalvik_system_ZygoteHooks.cc
index c056adc82e..8395150fb6 100644
--- a/runtime/native/dalvik_system_ZygoteHooks.cc
+++ b/runtime/native/dalvik_system_ZygoteHooks.cc
@@ -59,10 +59,11 @@ static void EnableDebugFeatures(uint32_t debug_flags) {
DEBUG_ENABLE_ASSERT = 1 << 2,
DEBUG_ENABLE_SAFEMODE = 1 << 3,
DEBUG_ENABLE_JNI_LOGGING = 1 << 4,
+ DEBUG_ENABLE_JIT = 1 << 5,
};
+ Runtime* const runtime = Runtime::Current();
if ((debug_flags & DEBUG_ENABLE_CHECKJNI) != 0) {
- Runtime* runtime = Runtime::Current();
JavaVMExt* vm = runtime->GetJavaVM();
if (!vm->IsCheckJniEnabled()) {
LOG(INFO) << "Late-enabling -Xcheck:jni";
@@ -86,13 +87,26 @@ static void EnableDebugFeatures(uint32_t debug_flags) {
}
debug_flags &= ~DEBUG_ENABLE_DEBUGGER;
- if ((debug_flags & DEBUG_ENABLE_SAFEMODE) != 0) {
+ const bool safe_mode = (debug_flags & DEBUG_ENABLE_SAFEMODE) != 0;
+ if (safe_mode) {
// Ensure that any (secondary) oat files will be interpreted.
- Runtime* runtime = Runtime::Current();
runtime->AddCompilerOption("--compiler-filter=interpret-only");
debug_flags &= ~DEBUG_ENABLE_SAFEMODE;
}
+ if ((debug_flags & DEBUG_ENABLE_JIT) != 0) {
+ if (safe_mode) {
+ LOG(INFO) << "Not enabling JIT due to VM safe mode";
+ } else {
+ if (runtime->GetJit() == nullptr) {
+ runtime->CreateJit();
+ } else {
+ LOG(INFO) << "Not late-enabling JIT (already on)";
+ }
+ }
+ debug_flags &= ~DEBUG_ENABLE_JIT;
+ }
+
// This is for backwards compatibility with Dalvik.
debug_flags &= ~DEBUG_ENABLE_ASSERT;