summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/jit/jit.cc9
-rw-r--r--runtime/jit/jit.h4
-rw-r--r--runtime/runtime.cc2
3 files changed, 12 insertions, 3 deletions
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc
index bfe8d9a32d..6496afd701 100644
--- a/runtime/jit/jit.cc
+++ b/runtime/jit/jit.cc
@@ -129,7 +129,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) {
@@ -165,6 +165,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 b98c6d39c0..76f540d48a 100644
--- a/runtime/jit/jit.h
+++ b/runtime/jit/jit.h
@@ -112,11 +112,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 a9ff0880a2..8a38f3af9b 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;
}