From: Mathieu Chartier Date: Fri, 25 Mar 2016 00:22:52 +0000 (-0700) Subject: Only call jit_load after the zygote fork X-Git-Tag: android-x86-7.1-r1~304 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=b10cef442594dd0d6c5f1a5784643931a25cc431;p=android-x86%2Fart.git Only call jit_load after the zygote fork Otherwise we always get that enable_debug_features is false since that flag passed as a compiler option post zygote fork. No significant change to libart-compiler PSS on calculator. Bug: 27810774 Change-Id: I9854716902c79e16bdfd64754cc1ed05e852a5de --- diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc index 70d47ef80..91f485eb1 100644 --- a/runtime/jit/jit.cc +++ b/runtime/jit/jit.cc @@ -134,7 +134,7 @@ Jit* Jit::Create(JitOptions* options, std::string* error_msg) { return jit.release(); } -bool Jit::LoadCompiler(std::string* error_msg) { +bool Jit::LoadCompilerLibrary(std::string* error_msg) { jit_library_handle_ = dlopen( kIsDebugBuild ? "libartd-compiler.so" : "libart-compiler.so", RTLD_NOW); if (jit_library_handle_ == nullptr) { @@ -170,6 +170,13 @@ bool Jit::LoadCompiler(std::string* error_msg) { *error_msg = "JIT couldn't find jit_types_loaded entry point"; return false; } + return true; +} + +bool Jit::LoadCompiler(std::string* error_msg) { + if (jit_library_handle_ == nullptr && !LoadCompilerLibrary(error_msg)) { + return false; + } bool will_generate_debug_symbols = false; VLOG(jit) << "Calling JitLoad interpreter_only=" << Runtime::Current()->GetInstrumentation()->InterpretOnly(); diff --git a/runtime/jit/jit.h b/runtime/jit/jit.h index 878682807..2f851a8f5 100644 --- a/runtime/jit/jit.h +++ b/runtime/jit/jit.h @@ -110,11 +110,13 @@ class Jit { JValue* result) SHARED_REQUIRES(Locks::mutator_lock_); - static bool LoadCompiler(std::string* error_msg); + static bool LoadCompilerLibrary(std::string* error_msg); private: Jit(); + static bool LoadCompiler(std::string* error_msg); + // JIT compiler static void* jit_library_handle_; static void* jit_compiler_handle_; diff --git a/runtime/runtime.cc b/runtime/runtime.cc index b78a3d416..d493d4ccb 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -573,7 +573,7 @@ bool Runtime::Start() { // If we are the zygote then we need to wait until after forking to create the code cache // due to SELinux restrictions on r/w/x memory regions. CreateJit(); - } else if (!jit::Jit::LoadCompiler(&error_msg)) { + } else if (!jit::Jit::LoadCompilerLibrary(&error_msg)) { // Try to load compiler pre zygote to reduce PSS. b/27744947 LOG(WARNING) << "Failed to load JIT compiler with error " << error_msg; }