diff options
| -rw-r--r-- | src/class_linker.cc | 30 | ||||
| -rw-r--r-- | src/class_linker.h | 2 | ||||
| -rw-r--r-- | src/compiler_llvm/art_module.ll | 2 | ||||
| -rw-r--r-- | src/compiler_llvm/generated/art_module.cc | 11 | ||||
| -rw-r--r-- | src/compiler_llvm/method_compiler.cc | 20 | ||||
| -rw-r--r-- | src/compiler_llvm/method_compiler.h | 8 | ||||
| -rw-r--r-- | src/compiler_llvm/runtime_support_func_list.h | 1 | ||||
| -rw-r--r-- | src/compiler_llvm/runtime_support_llvm.cc | 15 | ||||
| -rw-r--r-- | src/compiler_llvm/runtime_support_llvm.h | 2 | ||||
| -rw-r--r-- | src/object.cc | 8 |
10 files changed, 14 insertions, 85 deletions
diff --git a/src/class_linker.cc b/src/class_linker.cc index f78090b98a..a904800d62 100644 --- a/src/class_linker.cc +++ b/src/class_linker.cc @@ -1362,28 +1362,6 @@ const void* ClassLinker::GetOatCodeFor(const Method* method) { return GetOatMethodFor(method).GetCode(); } -void ClassLinker::LinkOatCodeFor(Method* method) { - Class* declaring_class = method->GetDeclaringClass(); - ClassHelper kh(declaring_class); - const OatFile* oat_file = FindOpenedOatFileForDexFile(kh.GetDexFile()); - if (oat_file != NULL) { - // NOTE: We have to check the availability of OatFile first. Because - // GetOatMethodFor(...) will try to find the OatFile and there's - // an assert in GetOatMethodFor(...). Besides, due to the return - // type of OatClass::GetOatMethod(...), we can't return a failure value - // back. - - // TODO: Remove this workaround. - OatFile::OatMethod oat_method = GetOatMethodFor(method); - if (method->GetCode() == NULL) { - method->SetCode(oat_method.GetCode()); - } - if (method->GetInvokeStub() == NULL) { - method->SetInvokeStub(oat_method.GetInvokeStub()); - } - } -} - void ClassLinker::FixupStaticTrampolines(Class* klass) { ClassHelper kh(klass); const DexFile::ClassDef* dex_class_def = kh.GetClassDef(); @@ -2211,14 +2189,6 @@ Class* ClassLinker::CreateProxyClass(String* name, ObjectArray<Class>* interface size_t num_virtual_methods = methods->GetLength(); klass->SetVirtualMethods(AllocObjectArray<Method>(num_virtual_methods)); for (size_t i = 0; i < num_virtual_methods; ++i) { -#if defined(ART_USE_LLVM_COMPILER) - Method* method = methods->Get(i); - // Ensure link. - // TODO: Remove this after fixing the link problem by in-place linking. - if (method->GetCode() == NULL || method->GetInvokeStub() == NULL) { - Runtime::Current()->GetClassLinker()->LinkOatCodeFor(methods->Get(i)); - } -#endif SirtRef<Method> prototype(methods->Get(i)); klass->SetVirtualMethod(i, CreateProxyMethod(klass, prototype)); } diff --git a/src/class_linker.h b/src/class_linker.h index 6cf2e149f1..26ce31e174 100644 --- a/src/class_linker.h +++ b/src/class_linker.h @@ -277,8 +277,6 @@ class ClassLinker { // Get the oat code for a method when its class isn't yet initialized const void* GetOatCodeFor(const Method* method); - void LinkOatCodeFor(Method* method); - // Relocate the OatFiles (ELF images) void RelocateExecutable(); diff --git a/src/compiler_llvm/art_module.ll b/src/compiler_llvm/art_module.ll index 457efa2faf..eb2e1b8875 100644 --- a/src/compiler_llvm/art_module.ll +++ b/src/compiler_llvm/art_module.ll @@ -172,6 +172,4 @@ declare i32 @art_f2i(float) declare void @art_mark_gc_card_from_code(%JavaObject*, %JavaObject*) -declare %JavaObject* @art_fix_stub_from_code(%JavaObject*) - declare void @art_proxy_invoke_handler_from_code(%JavaObject*, ...) diff --git a/src/compiler_llvm/generated/art_module.cc b/src/compiler_llvm/generated/art_module.cc index 491d1ec877..033316dca5 100644 --- a/src/compiler_llvm/generated/art_module.cc +++ b/src/compiler_llvm/generated/art_module.cc @@ -976,17 +976,6 @@ func_art_mark_gc_card_from_code->setCallingConv(CallingConv::C); AttrListPtr func_art_mark_gc_card_from_code_PAL; func_art_mark_gc_card_from_code->setAttributes(func_art_mark_gc_card_from_code_PAL); -Function* func_art_fix_stub_from_code = mod->getFunction("art_fix_stub_from_code"); -if (!func_art_fix_stub_from_code) { -func_art_fix_stub_from_code = Function::Create( - /*Type=*/FuncTy_4, - /*Linkage=*/GlobalValue::ExternalLinkage, - /*Name=*/"art_fix_stub_from_code", mod); // (external, no body) -func_art_fix_stub_from_code->setCallingConv(CallingConv::C); -} -AttrListPtr func_art_fix_stub_from_code_PAL; -func_art_fix_stub_from_code->setAttributes(func_art_fix_stub_from_code_PAL); - Function* func_art_proxy_invoke_handler_from_code = mod->getFunction("art_proxy_invoke_handler_from_code"); if (!func_art_proxy_invoke_handler_from_code) { func_art_proxy_invoke_handler_from_code = Function::Create( diff --git a/src/compiler_llvm/method_compiler.cc b/src/compiler_llvm/method_compiler.cc index 6c3bdb027e..13f232707a 100644 --- a/src/compiler_llvm/method_compiler.cc +++ b/src/compiler_llvm/method_compiler.cc @@ -2738,7 +2738,7 @@ void MethodCompiler::EmitInsn_Invoke(uint32_t dex_pc, // Compute invoke related information for compiler decision int vtable_idx = -1; - uintptr_t direct_code = 0; // Currently unused + uintptr_t direct_code = 0; uintptr_t direct_method = 0; bool is_fast_path = compiler_-> ComputeInvokeInfo(callee_method_idx, oat_compilation_unit_, @@ -2834,11 +2834,19 @@ void MethodCompiler::EmitInsn_Invoke(uint32_t dex_pc, } } - llvm::Value* code_addr = - irb_.LoadFromObjectOffset(callee_method_object_addr, - Method::GetCodeOffset().Int32Value(), - GetFunctionType(callee_method_idx, is_static)->getPointerTo(), - kTBAAJRuntime); + llvm::Value* code_addr; + if (direct_code != 0u && + direct_code != static_cast<uintptr_t>(-1)) { + code_addr = + irb_.CreateIntToPtr(irb_.getPtrEquivInt(direct_code), + GetFunctionType(callee_method_idx, is_static)->getPointerTo()); + } else { + code_addr = + irb_.LoadFromObjectOffset(callee_method_object_addr, + Method::GetCodeOffset().Int32Value(), + GetFunctionType(callee_method_idx, is_static)->getPointerTo(), + kTBAAJRuntime); + } // Invoke callee EmitUpdateDexPC(dex_pc); diff --git a/src/compiler_llvm/method_compiler.h b/src/compiler_llvm/method_compiler.h index ec27d96d54..41c43f0ad8 100644 --- a/src/compiler_llvm/method_compiler.h +++ b/src/compiler_llvm/method_compiler.h @@ -201,14 +201,6 @@ class MethodCompiler { void EmitInsn_SPut(GEN_INSN_ARGS, JType field_jty); // INVOKE instructions - llvm::Value* EmitFixStub(llvm::Value* callee_method_object_addr, - uint32_t method_idx, - bool is_static); - llvm::Value* EmitEnsureResolved(llvm::Value* callee, - llvm::Value* caller, - uint32_t dex_method_idx, - bool is_virtual); - void EmitInsn_Invoke(GEN_INSN_ARGS, InvokeType invoke_type, InvokeArgFmt arg_fmt); diff --git a/src/compiler_llvm/runtime_support_func_list.h b/src/compiler_llvm/runtime_support_func_list.h index 62729c6f92..30c6d6bcb6 100644 --- a/src/compiler_llvm/runtime_support_func_list.h +++ b/src/compiler_llvm/runtime_support_func_list.h @@ -63,7 +63,6 @@ V(IsExceptionPending, art_is_exception_pending_from_code) \ V(FindCatchBlock, art_find_catch_block_from_code) \ V(MarkGCCard, art_mark_gc_card_from_code) \ - V(FixStub, art_fix_stub_from_code) \ V(ProxyInvokeHandler, art_proxy_invoke_handler_from_code) \ V(DecodeJObjectInThread, art_decode_jobject_in_thread) \ V(art_d2l, art_d2l) \ diff --git a/src/compiler_llvm/runtime_support_llvm.cc b/src/compiler_llvm/runtime_support_llvm.cc index cfaaea4fca..155fb7cc99 100644 --- a/src/compiler_llvm/runtime_support_llvm.cc +++ b/src/compiler_llvm/runtime_support_llvm.cc @@ -639,21 +639,6 @@ static void* art_find_compiler_runtime_func(char const* name) { } } -// TODO: This runtime support function is the temporary solution for the link issue. -// It calls to this function before invoking any function, and this function will check: -// 1. The code address is 0. -> Link the code by ELFLoader -// That will solved by in-place linking at image loading. -const void* art_fix_stub_from_code(Method* called) { - const void* code = called->GetCode(); - // 1. The code address is 0. -> Link the code by ELFLoader - if (UNLIKELY(code == NULL)) { - Runtime::Current()->GetClassLinker()->LinkOatCodeFor(called); - return called->GetCode(); - } - - return code; -} - // Handler for invocation on proxy methods. We create a boxed argument array. And we invoke // the invocation handler which is a field within the proxy object receiver. void art_proxy_invoke_handler_from_code(Method* proxy_method, ...) { diff --git a/src/compiler_llvm/runtime_support_llvm.h b/src/compiler_llvm/runtime_support_llvm.h index 8ab28c6ef5..dabd88f03b 100644 --- a/src/compiler_llvm/runtime_support_llvm.h +++ b/src/compiler_llvm/runtime_support_llvm.h @@ -63,8 +63,6 @@ void* art_set_current_thread_from_code(void* thread_object_addr); void* art_find_runtime_support_func(void* context, char const* name); -const void* art_fix_stub_from_code(Method* called); - } // namespace art #endif // ART_SRC_COMPILER_LLVM_RUNTIME_SUPPORT_LLVM_H_ diff --git a/src/object.cc b/src/object.cc index 94e1759611..ecaef3b82d 100644 --- a/src/object.cc +++ b/src/object.cc @@ -526,14 +526,6 @@ void Method::Invoke(Thread* self, Object* receiver, JValue* args, JValue* result bool have_executable_code = (GetCode() != NULL); -#if defined(ART_USE_LLVM_COMPILER) - if (stub == NULL || !have_executable_code) { - Runtime::Current()->GetClassLinker()->LinkOatCodeFor(const_cast<Method*>(this)); - stub = GetInvokeStub(); - have_executable_code = (GetCode() != NULL); - } -#endif - if (Runtime::Current()->IsStarted() && have_executable_code && stub != NULL) { bool log = false; if (log) { |