diff options
author | 2013-05-13 11:28:27 -0700 | |
---|---|---|
committer | 2013-05-13 13:14:19 -0700 | |
commit | aa4a793d7175ceeb1efa215c2af5e52e42b22f0a (patch) | |
tree | 9c3db54a108d4327471c6d4890d28cdfe1f030ff | |
parent | 167436311a08a65dea28dda079a137893821c9c7 (diff) |
Rename abstract method code_ to entry_point_from_compiled_code_.
Change-Id: I9b02d2df95bbeafa6e6387b461f574c57337a61e
-rw-r--r-- | src/asm_support.h | 4 | ||||
-rw-r--r-- | src/class_linker.cc | 26 | ||||
-rw-r--r-- | src/class_linker_test.cc | 26 | ||||
-rw-r--r-- | src/compiler/dex/quick/gen_invoke.cc | 6 | ||||
-rw-r--r-- | src/compiler/driver/compiler_driver.cc | 2 | ||||
-rw-r--r-- | src/compiler/driver/compiler_driver_test.cc | 2 | ||||
-rw-r--r-- | src/compiler/jni/jni_compiler_test.cc | 4 | ||||
-rw-r--r-- | src/compiler/llvm/gbc_expander.cc | 4 | ||||
-rw-r--r-- | src/compiler/llvm/runtime_support_llvm.cc | 2 | ||||
-rw-r--r-- | src/exception_test.cc | 4 | ||||
-rw-r--r-- | src/image_writer.cc | 6 | ||||
-rw-r--r-- | src/instrumentation.cc | 8 | ||||
-rw-r--r-- | src/mirror/abstract_method-inl.h | 12 | ||||
-rw-r--r-- | src/mirror/abstract_method.cc | 8 | ||||
-rw-r--r-- | src/mirror/abstract_method.h | 28 | ||||
-rw-r--r-- | src/mirror/object_test.cc | 2 | ||||
-rw-r--r-- | src/oat/runtime/support_invoke.cc | 4 | ||||
-rw-r--r-- | src/oat/runtime/support_stubs.cc | 8 | ||||
-rw-r--r-- | src/oat_file.cc | 2 | ||||
-rw-r--r-- | src/oat_writer.cc | 2 | ||||
-rw-r--r-- | src/oatdump.cc | 6 | ||||
-rw-r--r-- | src/runtime.cc | 4 |
22 files changed, 86 insertions, 84 deletions
diff --git a/src/asm_support.h b/src/asm_support.h index bda0b7c055..8ea4adfcf2 100644 --- a/src/asm_support.h +++ b/src/asm_support.h @@ -27,8 +27,8 @@ #define STRING_OFFSET_OFFSET 20 #define STRING_DATA_OFFSET 12 -// Offset of field Method::code_ -#define METHOD_CODE_OFFSET 32 +// Offset of field Method::entry_point_from_compiled_code_ +#define METHOD_CODE_OFFSET 40 #if defined(__arm__) // Register holding suspend check count down. diff --git a/src/class_linker.cc b/src/class_linker.cc index 759bc0c755..08b26e4716 100644 --- a/src/class_linker.cc +++ b/src/class_linker.cc @@ -1040,13 +1040,13 @@ void ClassLinker::InitFromImageCallback(mirror::Object* obj, void* arg) { if (obj->IsMethod()) { mirror::AbstractMethod* method = obj->AsMethod(); // Install entry point from interpreter. - if (method->GetCode() == NULL && !method->IsNative() && !method->IsProxyMethod()) { + if (method->GetEntryPointFromCompiledCode() == NULL && !method->IsNative() && !method->IsProxyMethod()) { method->SetEntryPointFromInterpreter(interpreter::EnterInterpreterFromInterpreter); } else { method->SetEntryPointFromInterpreter(artInterpreterToQuickEntry); } - if (method->GetCode() == NULL) { - method->SetCode(GetResolutionTrampoline()); + if (method->GetEntryPointFromCompiledCode() == NULL) { + method->SetEntryPointFromCompiledCode(GetResolutionTrampoline()); } } } @@ -1600,14 +1600,15 @@ static void LinkCode(SirtRef<mirror::AbstractMethod>& method, const OatFile::Oat uint32_t method_index) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { // Method shouldn't have already been linked. - DCHECK(method->GetCode() == NULL); + DCHECK(method->GetEntryPointFromCompiledCode() == NULL); // Every kind of method should at least get an invoke stub from the oat_method. // non-abstract methods also get their code pointers. const OatFile::OatMethod oat_method = oat_class->GetOatMethod(method_index); oat_method.LinkMethod(method.get()); // Install entry point from interpreter. - if (method->GetCode() == NULL && !method->IsNative() && !method->IsProxyMethod()) { + if (method->GetEntryPointFromCompiledCode() == NULL && !method->IsNative() && + !method->IsProxyMethod()) { method->SetEntryPointFromInterpreter(interpreter::EnterInterpreterFromInterpreter); } else { method->SetEntryPointFromInterpreter(artInterpreterToQuickEntry); @@ -1615,13 +1616,13 @@ static void LinkCode(SirtRef<mirror::AbstractMethod>& method, const OatFile::Oat Runtime* runtime = Runtime::Current(); if (method->IsAbstract()) { - method->SetCode(GetAbstractMethodErrorStub()); + method->SetEntryPointFromCompiledCode(GetAbstractMethodErrorStub()); return; } if (method->IsStatic() && !method->IsConstructor()) { // For static methods excluding the class initializer, install the trampoline. - method->SetCode(GetResolutionTrampoline()); + method->SetEntryPointFromCompiledCode(GetResolutionTrampoline()); } if (method->IsNative()) { @@ -1629,13 +1630,14 @@ static void LinkCode(SirtRef<mirror::AbstractMethod>& method, const OatFile::Oat method->UnregisterNative(Thread::Current()); } - if (method->GetCode() == NULL) { + if (method->GetEntryPointFromCompiledCode() == NULL) { // No code? You must mean to go into the interpreter. - method->SetCode(GetInterpreterEntryPoint()); + method->SetEntryPointFromCompiledCode(GetInterpreterEntryPoint()); } // Allow instrumentation its chance to hijack code. - runtime->GetInstrumentation()->UpdateMethodsCode(method.get(), method->GetCode()); + runtime->GetInstrumentation()->UpdateMethodsCode(method.get(), + method->GetEntryPointFromCompiledCode()); } void ClassLinker::LoadClass(const DexFile& dex_file, @@ -2562,9 +2564,9 @@ mirror::AbstractMethod* ClassLinker::CreateProxyMethod(Thread* self, SirtRef<mir method->SetFpSpillMask(refs_and_args->GetFpSpillMask()); method->SetFrameSizeInBytes(refs_and_args->GetFrameSizeInBytes()); #if !defined(ART_USE_PORTABLE_COMPILER) - method->SetCode(reinterpret_cast<void*>(art_quick_proxy_invoke_handler)); + method->SetEntryPointFromCompiledCode(reinterpret_cast<void*>(art_quick_proxy_invoke_handler)); #else - method->SetCode(reinterpret_cast<void*>(art_portable_proxy_invoke_handler)); + method->SetEntryPointFromCompiledCode(reinterpret_cast<void*>(art_portable_proxy_invoke_handler)); #endif method->SetEntryPointFromInterpreter(artInterpreterToQuickEntry); diff --git a/src/class_linker_test.cc b/src/class_linker_test.cc index 94ea9d7db9..73bdc613ab 100644 --- a/src/class_linker_test.cc +++ b/src/class_linker_test.cc @@ -471,19 +471,19 @@ struct AbstractMethodOffsets : public CheckOffsets<AbstractMethod> { offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, dex_cache_strings_), "dexCacheStrings")); // alphabetical 32-bit - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, access_flags_), "accessFlags")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, code_), "code")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, code_item_offset_), "codeItemOffset")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, core_spill_mask_), "coreSpillMask")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, entry_point_from_interpreter_), "entryPointFromInterpreter")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, fp_spill_mask_), "fpSpillMask")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, frame_size_in_bytes_), "frameSizeInBytes")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, gc_map_), "gcMap")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, mapping_table_), "mappingTable")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, method_dex_index_), "methodDexIndex")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, method_index_), "methodIndex")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, native_method_), "nativeMethod")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, vmap_table_), "vmapTable")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, access_flags_), "accessFlags")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, code_item_offset_), "codeItemOffset")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, core_spill_mask_), "coreSpillMask")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, entry_point_from_compiled_code_), "entryPointFromCompiledCode")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, entry_point_from_interpreter_), "entryPointFromInterpreter")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, fp_spill_mask_), "fpSpillMask")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, frame_size_in_bytes_), "frameSizeInBytes")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, gc_map_), "gcMap")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, mapping_table_), "mappingTable")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, method_dex_index_), "methodDexIndex")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, method_index_), "methodIndex")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, native_method_), "nativeMethod")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, vmap_table_), "vmapTable")); }; }; diff --git a/src/compiler/dex/quick/gen_invoke.cc b/src/compiler/dex/quick/gen_invoke.cc index efacff0ab2..49fb93ae07 100644 --- a/src/compiler/dex/quick/gen_invoke.cc +++ b/src/compiler/dex/quick/gen_invoke.cc @@ -384,7 +384,7 @@ static int NextSDCallInsn(CompilationUnit* cu, CallInfo* info, if (cu->instruction_set != kX86) { if (direct_code == 0) { cg->LoadWordDisp(cg->TargetReg(kArg0), - mirror::AbstractMethod::GetCodeOffset().Int32Value(), + mirror::AbstractMethod::GetEntryPointFromCompiledCodeOffset().Int32Value(), cg->TargetReg(kInvokeTgt)); } break; @@ -437,7 +437,7 @@ static int NextVCallInsn(CompilationUnit* cu, CallInfo* info, case 4: // Get the compiled code address [uses kArg0, sets kInvokeTgt] if (cu->instruction_set != kX86) { cg->LoadWordDisp(cg->TargetReg(kArg0), - mirror::AbstractMethod::GetCodeOffset().Int32Value(), + mirror::AbstractMethod::GetEntryPointFromCompiledCodeOffset().Int32Value(), cg->TargetReg(kInvokeTgt)); break; } @@ -1379,7 +1379,7 @@ void Mir2Lir::GenInvoke(CallInfo* info) } else { if (fast_path && info->type != kInterface) { call_inst = OpMem(kOpBlx, TargetReg(kArg0), - mirror::AbstractMethod::GetCodeOffset().Int32Value()); + mirror::AbstractMethod::GetEntryPointFromCompiledCodeOffset().Int32Value()); } else { int trampoline = 0; switch (info->type) { diff --git a/src/compiler/driver/compiler_driver.cc b/src/compiler/driver/compiler_driver.cc index 6b7d9e6390..698517277f 100644 --- a/src/compiler/driver/compiler_driver.cc +++ b/src/compiler/driver/compiler_driver.cc @@ -809,7 +809,7 @@ void CompilerDriver::GetCodeAndMethodForDirectCall(InvokeType type, InvokeType s if (Runtime::Current()->GetHeap()->FindSpaceFromObject(method)->IsImageSpace()) { direct_method = reinterpret_cast<uintptr_t>(method); } - direct_code = reinterpret_cast<uintptr_t>(method->GetCode()); + direct_code = reinterpret_cast<uintptr_t>(method->GetEntryPointFromCompiledCode()); } } diff --git a/src/compiler/driver/compiler_driver_test.cc b/src/compiler/driver/compiler_driver_test.cc index aef3a33e08..c87fefda16 100644 --- a/src/compiler/driver/compiler_driver_test.cc +++ b/src/compiler/driver/compiler_driver_test.cc @@ -115,7 +115,7 @@ TEST_F(CompilerDriverTest, DISABLED_LARGE_CompileDexLibCore) { EXPECT_TRUE(method != NULL) << "method_idx=" << i << " " << dex->GetMethodDeclaringClassDescriptor(dex->GetMethodId(i)) << " " << dex->GetMethodName(dex->GetMethodId(i)); - EXPECT_TRUE(method->GetCode() != NULL) << "method_idx=" << i + EXPECT_TRUE(method->GetEntryPointFromCompiledCode() != NULL) << "method_idx=" << i << " " << dex->GetMethodDeclaringClassDescriptor(dex->GetMethodId(i)) << " " << dex->GetMethodName(dex->GetMethodId(i)); diff --git a/src/compiler/jni/jni_compiler_test.cc b/src/compiler/jni/jni_compiler_test.cc index ef532f2310..560a146052 100644 --- a/src/compiler/jni/jni_compiler_test.cc +++ b/src/compiler/jni/jni_compiler_test.cc @@ -58,11 +58,11 @@ class JniCompilerTest : public CommonTest { method = c->FindVirtualMethod(method_name, method_sig); } ASSERT_TRUE(method != NULL) << method_name << " " << method_sig; - if (method->GetCode() != NULL) { + if (method->GetEntryPointFromCompiledCode() != NULL) { return; } CompileMethod(method); - ASSERT_TRUE(method->GetCode() != NULL) << method_name << " " << method_sig; + ASSERT_TRUE(method->GetEntryPointFromCompiledCode() != NULL) << method_name << " " << method_sig; } void SetUpForTest(bool direct, const char* method_name, const char* method_sig, diff --git a/src/compiler/llvm/gbc_expander.cc b/src/compiler/llvm/gbc_expander.cc index c1e35a69a7..99c8fd5ca7 100644 --- a/src/compiler/llvm/gbc_expander.cc +++ b/src/compiler/llvm/gbc_expander.cc @@ -852,7 +852,7 @@ llvm::Value* GBCExpanderPass::EmitInvoke(llvm::CallInst& call_inst) { } else { code_addr = irb_.LoadFromObjectOffset(callee_method_object_addr, - art::mirror::AbstractMethod::GetCodeOffset().Int32Value(), + art::mirror::AbstractMethod::GetEntryPointFromCompiledCodeOffset().Int32Value(), func_type->getPointerTo(), kTBAARuntimeInfo); } @@ -1200,7 +1200,7 @@ llvm::Value* GBCExpanderPass::Expand_Invoke(llvm::CallInst& call_inst) { llvm::Value* code_addr = irb_.LoadFromObjectOffset(callee_method_object_addr, - art::mirror::AbstractMethod::GetCodeOffset().Int32Value(), + art::mirror::AbstractMethod::GetEntryPointFromCompiledCodeOffset().Int32Value(), callee_method_type->getPointerTo(), kTBAARuntimeInfo); diff --git a/src/compiler/llvm/runtime_support_llvm.cc b/src/compiler/llvm/runtime_support_llvm.cc index d6c81813ad..bd6b01b211 100644 --- a/src/compiler/llvm/runtime_support_llvm.cc +++ b/src/compiler/llvm/runtime_support_llvm.cc @@ -339,7 +339,7 @@ static mirror::AbstractMethod* FindMethodHelper(uint32_t method_idx, mirror::Obj } } DCHECK(!thread->IsExceptionPending()); - const void* code = method->GetCode(); + const void* code = method->GetEntryPointFromCompiledCode(); // When we return, the caller will branch to this address, so it had better not be 0! if (UNLIKELY(code == NULL)) { diff --git a/src/exception_test.cc b/src/exception_test.cc index 0cd8123953..54341e3a45 100644 --- a/src/exception_test.cc +++ b/src/exception_test.cc @@ -73,7 +73,7 @@ class ExceptionTest : public CommonTest { method_f_ = my_klass_->FindVirtualMethod("f", "()I"); ASSERT_TRUE(method_f_ != NULL); method_f_->SetFrameSizeInBytes(kStackAlignment); - method_f_->SetCode(CompiledMethod::CodePointer(&fake_code_[sizeof(code_size)], kThumb2)); + method_f_->SetEntryPointFromCompiledCode(CompiledMethod::CodePointer(&fake_code_[sizeof(code_size)], kThumb2)); method_f_->SetMappingTable(&fake_mapping_data_[0]); method_f_->SetVmapTable(&fake_vmap_table_data_[0]); method_f_->SetNativeGcMap(&fake_gc_map_[0]); @@ -81,7 +81,7 @@ class ExceptionTest : public CommonTest { method_g_ = my_klass_->FindVirtualMethod("g", "(I)V"); ASSERT_TRUE(method_g_ != NULL); method_g_->SetFrameSizeInBytes(kStackAlignment); - method_g_->SetCode(CompiledMethod::CodePointer(&fake_code_[sizeof(code_size)], kThumb2)); + method_g_->SetEntryPointFromCompiledCode(CompiledMethod::CodePointer(&fake_code_[sizeof(code_size)], kThumb2)); method_g_->SetMappingTable(&fake_mapping_data_[0]); method_g_->SetVmapTable(&fake_vmap_table_data_[0]); method_g_->SetNativeGcMap(&fake_gc_map_[0]); diff --git a/src/image_writer.cc b/src/image_writer.cc index d9e435380d..7e82d6d1d0 100644 --- a/src/image_writer.cc +++ b/src/image_writer.cc @@ -476,18 +476,18 @@ void ImageWriter::FixupMethod(const AbstractMethod* orig, AbstractMethod* copy) // Here we readjust to a pointer relative to oat_begin_ if (orig->IsAbstract()) { // Code for abstract methods is set to the abstract method error stub when we load the image. - copy->SetCode(NULL); + copy->SetEntryPointFromCompiledCode(NULL); return; } if (orig == Runtime::Current()->GetResolutionMethod()) { // The resolution method's code is set to the resolution trampoline when we load the image. - copy->SetCode(NULL); + copy->SetEntryPointFromCompiledCode(NULL); return; } // Non-abstract methods have code - copy->SetCode(GetOatAddress(orig->GetOatCodeOffset())); + copy->SetEntryPointFromCompiledCode(GetOatAddress(orig->GetOatCodeOffset())); if (orig->IsNative()) { // The native method's pointer is set to a stub to lookup via dlsym when we load the image. diff --git a/src/instrumentation.cc b/src/instrumentation.cc index 43bab5343a..39fd37766a 100644 --- a/src/instrumentation.cc +++ b/src/instrumentation.cc @@ -71,7 +71,7 @@ bool Instrumentation::InstallStubsForClass(mirror::Class* klass) { new_code = GetInterpreterEntryPoint(); } } - method->SetCode(new_code); + method->SetEntryPointFromCompiledCode(new_code); } } for (size_t i = 0; i < klass->NumVirtualMethods(); i++) { @@ -87,7 +87,7 @@ bool Instrumentation::InstallStubsForClass(mirror::Class* klass) { new_code = GetInterpreterEntryPoint(); } } - method->SetCode(new_code); + method->SetEntryPointFromCompiledCode(new_code); } } return true; @@ -371,14 +371,14 @@ void Instrumentation::ConfigureStubs(bool require_entry_exit_stubs, bool require void Instrumentation::UpdateMethodsCode(mirror::AbstractMethod* method, const void* code) const { if (LIKELY(!instrumentation_stubs_installed_)) { - method->SetCode(code); + method->SetEntryPointFromCompiledCode(code); } } const void* Instrumentation::GetQuickCodeFor(const mirror::AbstractMethod* method) const { Runtime* runtime = Runtime::Current(); if (LIKELY(!instrumentation_stubs_installed_)) { - const void* code = method->GetCode(); + const void* code = method->GetEntryPointFromCompiledCode(); DCHECK(code != NULL); if (LIKELY(code != GetResolutionTrampoline())) { return code; diff --git a/src/mirror/abstract_method-inl.h b/src/mirror/abstract_method-inl.h index a420714b58..d4f0f2c6bc 100644 --- a/src/mirror/abstract_method-inl.h +++ b/src/mirror/abstract_method-inl.h @@ -76,7 +76,7 @@ inline ObjectArray<StaticStorageBase>* AbstractMethod::GetDexCacheInitializedSta inline uint32_t AbstractMethod::GetCodeSize() const { DCHECK(!IsRuntimeMethod() && !IsProxyMethod()) << PrettyMethod(this); - uintptr_t code = reinterpret_cast<uintptr_t>(GetCode()); + uintptr_t code = reinterpret_cast<uintptr_t>(GetEntryPointFromCompiledCode()); if (code == 0) { return 0; } @@ -114,27 +114,27 @@ inline void AbstractMethod::AssertPcIsWithinCode(uintptr_t pc) const { if (IsNative() || IsRuntimeMethod() || IsProxyMethod()) { return; } - if (GetCode() == GetInterpreterEntryPoint()) { + if (GetEntryPointFromCompiledCode() == GetInterpreterEntryPoint()) { return; } - if (GetCode() == GetResolutionTrampoline()) { + if (GetEntryPointFromCompiledCode() == GetResolutionTrampoline()) { return; } DCHECK(IsWithinCode(pc)) << PrettyMethod(this) << " pc=" << std::hex << pc - << " code=" << GetCode() + << " code=" << GetEntryPointFromCompiledCode() << " size=" << GetCodeSize(); } inline uint32_t AbstractMethod::GetOatCodeOffset() const { DCHECK(!Runtime::Current()->IsStarted()); - return reinterpret_cast<uint32_t>(GetCode()); + return reinterpret_cast<uint32_t>(GetEntryPointFromCompiledCode()); } inline void AbstractMethod::SetOatCodeOffset(uint32_t code_offset) { DCHECK(!Runtime::Current()->IsStarted()); - SetCode(reinterpret_cast<void*>(code_offset)); + SetEntryPointFromCompiledCode(reinterpret_cast<void*>(code_offset)); } inline uint32_t AbstractMethod::GetOatMappingTableOffset() const { diff --git a/src/mirror/abstract_method.cc b/src/mirror/abstract_method.cc index c351ce841d..5258795ace 100644 --- a/src/mirror/abstract_method.cc +++ b/src/mirror/abstract_method.cc @@ -271,10 +271,10 @@ void AbstractMethod::Invoke(Thread* self, uint32_t* args, uint32_t args_size, JV bool interpret = runtime->GetInstrumentation()->InterpretOnly() && !IsNative() && !IsProxyMethod(); const bool kLogInvocationStartAndReturn = false; - if (GetCode() != NULL) { + if (GetEntryPointFromCompiledCode() != NULL) { if (!interpret) { if (kLogInvocationStartAndReturn) { - LOG(INFO) << StringPrintf("Invoking '%s' code=%p", PrettyMethod(this).c_str(), GetCode()); + LOG(INFO) << StringPrintf("Invoking '%s' code=%p", PrettyMethod(this).c_str(), GetEntryPointFromCompiledCode()); } #ifdef ART_USE_PORTABLE_COMPILER (*art_portable_invoke_stub)(this, args, args_size, self, result, result_type); @@ -292,7 +292,7 @@ void AbstractMethod::Invoke(Thread* self, uint32_t* args, uint32_t args_size, JV interpreter::EnterInterpreterFromDeoptimize(self, shadow_frame, result); } if (kLogInvocationStartAndReturn) { - LOG(INFO) << StringPrintf("Returned '%s' code=%p", PrettyMethod(this).c_str(), GetCode()); + LOG(INFO) << StringPrintf("Returned '%s' code=%p", PrettyMethod(this).c_str(), GetEntryPointFromCompiledCode()); } } else { if (kLogInvocationStartAndReturn) { @@ -310,7 +310,7 @@ void AbstractMethod::Invoke(Thread* self, uint32_t* args, uint32_t args_size, JV } } else { LOG(INFO) << "Not invoking '" << PrettyMethod(this) - << "' code=" << reinterpret_cast<const void*>(GetCode()); + << "' code=" << reinterpret_cast<const void*>(GetEntryPointFromCompiledCode()); if (result != NULL) { result->SetJ(0); } diff --git a/src/mirror/abstract_method.h b/src/mirror/abstract_method.h index e95537693b..8f8038f05f 100644 --- a/src/mirror/abstract_method.h +++ b/src/mirror/abstract_method.h @@ -50,8 +50,8 @@ class MANAGED AbstractMethod : public Object { return MemberOffset(OFFSETOF_MEMBER(AbstractMethod, declaring_class_)); } - static MemberOffset CodeOffset() { - return MemberOffset(OFFSETOF_MEMBER(AbstractMethod, code_)); + static MemberOffset EntryPointFromCompiledCodeOffset() { + return MemberOffset(OFFSETOF_MEMBER(AbstractMethod, entry_point_from_compiled_code_)); } uint32_t GetAccessFlags() const; @@ -200,19 +200,19 @@ class MANAGED AbstractMethod : public Object { SetFieldPtr<EntryPointFromInterpreter*>(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, entry_point_from_interpreter_), entry_point_from_interpreter, false); } - const void* GetCode() const { - return GetFieldPtr<const void*>(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, code_), false); + const void* GetEntryPointFromCompiledCode() const { + return GetFieldPtr<const void*>(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, entry_point_from_compiled_code_), false); } - void SetCode(const void* code) { - SetFieldPtr<const void*>(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, code_), code, false); + void SetEntryPointFromCompiledCode(const void* entry_point_from_compiled_code) { + SetFieldPtr<const void*>(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, entry_point_from_compiled_code_), entry_point_from_compiled_code, false); } uint32_t GetCodeSize() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); bool IsWithinCode(uintptr_t pc) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - uintptr_t code = reinterpret_cast<uintptr_t>(GetCode()); + uintptr_t code = reinterpret_cast<uintptr_t>(GetEntryPointFromCompiledCode()); if (code == 0) { return pc == 0; } @@ -231,8 +231,8 @@ class MANAGED AbstractMethod : public Object { void SetOatCodeOffset(uint32_t code_offset); - static MemberOffset GetCodeOffset() { - return OFFSET_OF_OBJECT_MEMBER(AbstractMethod, code_); + static MemberOffset GetEntryPointFromCompiledCodeOffset() { + return OFFSET_OF_OBJECT_MEMBER(AbstractMethod, entry_point_from_compiled_code_); } const uint32_t* GetMappingTable() const { @@ -432,17 +432,17 @@ class MANAGED AbstractMethod : public Object { // Access flags; low 16 bits are defined by spec. uint32_t access_flags_; - // Compiled code associated with this method for callers from managed code. - // May be compiled managed code or a bridge for invoking a native method. - // TODO: Break apart this into portable and quick. - const void* code_; - // Offset to the CodeItem. uint32_t code_item_offset_; // Architecture-dependent register spill mask uint32_t core_spill_mask_; + // Compiled code associated with this method for callers from managed code. + // May be compiled managed code or a bridge for invoking a native method. + // TODO: Break apart this into portable and quick. + const void* entry_point_from_compiled_code_; + // Called by the interpreter to execute this method. EntryPointFromInterpreter* entry_point_from_interpreter_; diff --git a/src/mirror/object_test.cc b/src/mirror/object_test.cc index 5c7ec11222..8e9032d891 100644 --- a/src/mirror/object_test.cc +++ b/src/mirror/object_test.cc @@ -75,7 +75,7 @@ TEST_F(ObjectTest, AsmConstants) { ASSERT_EQ(STRING_OFFSET_OFFSET, String::OffsetOffset().Int32Value()); ASSERT_EQ(STRING_DATA_OFFSET, Array::DataOffset(sizeof(uint16_t)).Int32Value()); - ASSERT_EQ(METHOD_CODE_OFFSET, AbstractMethod::CodeOffset().Int32Value()); + ASSERT_EQ(METHOD_CODE_OFFSET, AbstractMethod::EntryPointFromCompiledCodeOffset().Int32Value()); } TEST_F(ObjectTest, IsInSamePackage) { diff --git a/src/oat/runtime/support_invoke.cc b/src/oat/runtime/support_invoke.cc index 6cad52774a..369858eb67 100644 --- a/src/oat/runtime/support_invoke.cc +++ b/src/oat/runtime/support_invoke.cc @@ -119,7 +119,7 @@ extern "C" uint64_t artInvokeInterfaceTrampoline(mirror::AbstractMethod* interfa return 0; // Failure. } } - const void* code = method->GetCode(); + const void* code = method->GetEntryPointFromCompiledCode(); #ifndef NDEBUG // When we return, the caller will branch to this address, so it had better not be 0! @@ -153,7 +153,7 @@ static uint64_t artInvokeCommon(uint32_t method_idx, mirror::Object* this_object } } DCHECK(!self->IsExceptionPending()); - const void* code = method->GetCode(); + const void* code = method->GetEntryPointFromCompiledCode(); #ifndef NDEBUG // When we return, the caller will branch to this address, so it had better not be 0! diff --git a/src/oat/runtime/support_stubs.cc b/src/oat/runtime/support_stubs.cc index 3c98ae7b9d..161a7b2b58 100644 --- a/src/oat/runtime/support_stubs.cc +++ b/src/oat/runtime/support_stubs.cc @@ -82,7 +82,7 @@ extern "C" const void* artPortableResolutionTrampoline(mirror::AbstractMethod* c mirror::Class* called_class = called->GetDeclaringClass(); linker->EnsureInitialized(called_class, true, true); if (LIKELY(called_class->IsInitialized())) { - code = called->GetCode(); + code = called->GetEntryPointFromCompiledCode(); // TODO: remove this after we solve the link issue. { // for lazy link. if (code == NULL) { @@ -96,7 +96,7 @@ extern "C" const void* artPortableResolutionTrampoline(mirror::AbstractMethod* c code = linker->GetOatCodeFor(called); } else { // No trampoline for non-static methods. - code = called->GetCode(); + code = called->GetEntryPointFromCompiledCode(); // TODO: remove this after we solve the link issue. { // for lazy link. if (code == NULL) { @@ -303,7 +303,7 @@ extern "C" const void* artQuickResolutionTrampoline(mirror::AbstractMethod* call mirror::Class* called_class = called->GetDeclaringClass(); linker->EnsureInitialized(called_class, true, true); if (LIKELY(called_class->IsInitialized())) { - code = called->GetCode(); + code = called->GetEntryPointFromCompiledCode(); } else if (called_class->IsInitializing()) { if (invoke_type == kStatic) { // Class is still initializing, go to oat and grab code (trampoline must be left in place @@ -311,7 +311,7 @@ extern "C" const void* artQuickResolutionTrampoline(mirror::AbstractMethod* call code = linker->GetOatCodeFor(called); } else { // No trampoline for non-static methods. - code = called->GetCode(); + code = called->GetEntryPointFromCompiledCode(); } } else { DCHECK(called_class->IsErroneous()); diff --git a/src/oat_file.cc b/src/oat_file.cc index 3cc07bf588..414813c34e 100644 --- a/src/oat_file.cc +++ b/src/oat_file.cc @@ -409,7 +409,7 @@ uint32_t OatFile::OatMethod::GetCodeSize() const { void OatFile::OatMethod::LinkMethod(mirror::AbstractMethod* method) const { CHECK(method != NULL); - method->SetCode(GetCode()); + method->SetEntryPointFromCompiledCode(GetCode()); method->SetFrameSizeInBytes(frame_size_in_bytes_); method->SetCoreSpillMask(core_spill_mask_); method->SetFpSpillMask(fp_spill_mask_); diff --git a/src/oat_writer.cc b/src/oat_writer.cc index e52965406b..8acbfe9ca5 100644 --- a/src/oat_writer.cc +++ b/src/oat_writer.cc @@ -369,7 +369,7 @@ size_t OatWriter::InitOatCodeMethod(size_t offset, size_t oat_class_index, method->GetDeclaringClass()->IsInitialized()) { method->SetOatCodeOffset(code_offset); } else { - method->SetCode(NULL); + method->SetEntryPointFromCompiledCode(NULL); } method->SetOatVmapTableOffset(vmap_table_offset); method->SetOatNativeGcMapOffset(gc_map_offset); diff --git a/src/oatdump.cc b/src/oatdump.cc index 353abcaf03..7a99f8dc0e 100644 --- a/src/oatdump.cc +++ b/src/oatdump.cc @@ -879,7 +879,7 @@ class ImageDumper { const void* GetOatCodeBegin(mirror::AbstractMethod* m) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - const void* code = m->GetCode(); + const void* code = m->GetEntryPointFromCompiledCode(); if (code == GetResolutionTrampoline()) { code = oat_dumper_->GetOatCode(m); } @@ -990,7 +990,7 @@ class ImageDumper { if (first_occurrence) { state->stats_.native_to_managed_code_bytes += oat_code_size; } - if (oat_code != method->GetCode()) { + if (oat_code != method->GetEntryPointFromCompiledCode()) { indent_os << StringPrintf("OAT CODE: %p\n", oat_code); } } else if (method->IsAbstract() || method->IsCalleeSaveMethod() || @@ -998,7 +998,7 @@ class ImageDumper { DCHECK(method->GetNativeGcMap() == NULL) << PrettyMethod(method); DCHECK(method->GetMappingTable() == NULL) << PrettyMethod(method); } else { - CHECK((method->GetCode() == NULL) || (method->GetNativeGcMap() != NULL)); + CHECK((method->GetEntryPointFromCompiledCode() == NULL) || (method->GetNativeGcMap() != NULL)); const DexFile::CodeItem* code_item = MethodHelper(method).GetCodeItem(); size_t dex_instruction_bytes = code_item->insns_size_in_code_units_ * 2; diff --git a/src/runtime.cc b/src/runtime.cc index 17f283b09d..45d2988e97 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -1109,7 +1109,7 @@ mirror::AbstractMethod* Runtime::CreateResolutionMethod() { // TODO: use a special method for resolution method saves method->SetDexMethodIndex(DexFile::kDexNoIndex16); // When compiling, the code pointer will get set later when the image is loaded. - method->SetCode(Runtime::Current()->IsCompiler() ? NULL : GetResolutionTrampoline()); + method->SetEntryPointFromCompiledCode(Runtime::Current()->IsCompiler() ? NULL : GetResolutionTrampoline()); return method.get(); } @@ -1122,7 +1122,7 @@ mirror::AbstractMethod* Runtime::CreateCalleeSaveMethod(InstructionSet instructi method->SetDeclaringClass(method_class); // TODO: use a special method for callee saves method->SetDexMethodIndex(DexFile::kDexNoIndex16); - method->SetCode(NULL); + method->SetEntryPointFromCompiledCode(NULL); if ((instruction_set == kThumb2) || (instruction_set == kArm)) { uint32_t ref_spills = (1 << art::arm::R5) | (1 << art::arm::R6) | (1 << art::arm::R7) | (1 << art::arm::R8) | (1 << art::arm::R10) | (1 << art::arm::R11); |