diff options
Diffstat (limited to 'runtime/jit/jit.cc')
-rw-r--r-- | runtime/jit/jit.cc | 45 |
1 files changed, 3 insertions, 42 deletions
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc index 2cc4aef27a..21eddb513e 100644 --- a/runtime/jit/jit.cc +++ b/runtime/jit/jit.cc @@ -31,13 +31,14 @@ #include "compilation_kind.h" #include "debugger.h" #include "dex/type_lookup_table.h" -#include "gc/space/image_space.h" #include "entrypoints/entrypoint_utils-inl.h" #include "entrypoints/runtime_asm_entrypoints.h" +#include "gc/space/image_space.h" #include "image-inl.h" #include "interpreter/interpreter.h" #include "jit-inl.h" #include "jit_code_cache.h" +#include "jit_load.h" #include "jni/java_vm_ext.h" #include "mirror/method_handle_impl.h" #include "mirror/var_handle.h" @@ -81,9 +82,7 @@ static constexpr uint32_t kJitSlowStressDefaultWarmupThreshold = DEFINE_RUNTIME_DEBUG_FLAG(Jit, kSlowMode); // JIT compiler -void* Jit::jit_library_handle_ = nullptr; JitCompilerInterface* Jit::jit_compiler_ = nullptr; -JitCompilerInterface* (*Jit::jit_load_)(void) = nullptr; JitOptions* JitOptions::CreateFromRuntimeArguments(const RuntimeArgumentMap& options) { auto* jit_options = new JitOptions; @@ -188,15 +187,7 @@ Jit::Jit(JitCodeCache* code_cache, JitOptions* options) fd_methods_size_(0) {} Jit* Jit::Create(JitCodeCache* code_cache, JitOptions* options) { - if (jit_load_ == nullptr) { - LOG(WARNING) << "Not creating JIT: library not loaded"; - return nullptr; - } - jit_compiler_ = (jit_load_)(); - if (jit_compiler_ == nullptr) { - LOG(WARNING) << "Not creating JIT: failed to allocate a compiler"; - return nullptr; - } + jit_compiler_ = jit_load(); std::unique_ptr<Jit> jit(new Jit(code_cache, options)); // If the code collector is enabled, check if that still holds: @@ -232,32 +223,6 @@ Jit* Jit::Create(JitCodeCache* code_cache, JitOptions* options) { return jit.release(); } -template <typename T> -bool Jit::LoadSymbol(T* address, const char* name, std::string* error_msg) { - *address = reinterpret_cast<T>(dlsym(jit_library_handle_, name)); - if (*address == nullptr) { - *error_msg = std::string("JIT couldn't find ") + name + std::string(" entry point"); - return false; - } - return true; -} - -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) { - std::ostringstream oss; - oss << "JIT could not load libart-compiler.so: " << dlerror(); - *error_msg = oss.str(); - return false; - } - if (!LoadSymbol(&jit_load_, "jit_load", error_msg)) { - dlclose(jit_library_handle_); - return false; - } - return true; -} - bool Jit::CompileMethodInternal(ArtMethod* method, Thread* self, CompilationKind compilation_kind, @@ -409,10 +374,6 @@ Jit::~Jit() { delete jit_compiler_; jit_compiler_ = nullptr; } - if (jit_library_handle_ != nullptr) { - dlclose(jit_library_handle_); - jit_library_handle_ = nullptr; - } } void Jit::NewTypeLoadedIfUsingJit(mirror::Class* type) { |