diff options
author | Vladimir Marko <vmarko@google.com> | 2014-04-28 09:09:06 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-04-28 09:09:07 +0000 |
commit | 990d46f3333dce06a640ced697ee069330a73d7c (patch) | |
tree | 7caf896723665029823c73e2bec87e6db97ec428 /runtime/mirror/art_method.cc | |
parent | bf25f7e3a007ecfe4b2bcfa0a9abcb784ff54e26 (diff) | |
parent | 8a630577ed2d9e9571c3434c505e5de223b23c07 (diff) | |
download | art-990d46f3333dce06a640ced697ee069330a73d7c.zip art-990d46f3333dce06a640ced697ee069330a73d7c.tar.gz art-990d46f3333dce06a640ced697ee069330a73d7c.tar.bz2 |
Merge "Move mapping table and vmap table offsets to OatMethodHeader."
Diffstat (limited to 'runtime/mirror/art_method.cc')
-rw-r--r-- | runtime/mirror/art_method.cc | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/runtime/mirror/art_method.cc b/runtime/mirror/art_method.cc index 726004b..90bcbab 100644 --- a/runtime/mirror/art_method.cc +++ b/runtime/mirror/art_method.cc @@ -368,5 +368,43 @@ void ArtMethod::UnregisterNative(Thread* self) { RegisterNative(self, GetJniDlsymLookupStub(), false); } +const void* ArtMethod::GetOatCodePointer() { + if (IsPortableCompiled() || IsNative() || IsAbstract() || IsRuntimeMethod() || IsProxyMethod()) { + return nullptr; + } + Runtime* runtime = Runtime::Current(); + const void* entry_point = runtime->GetInstrumentation()->GetQuickCodeFor(this); + // On failure, instead of nullptr we get the quick-to-interpreter-bridge (but not the trampoline). + DCHECK(entry_point != GetQuickToInterpreterBridgeTrampoline(runtime->GetClassLinker())); + if (entry_point == GetQuickToInterpreterBridge()) { + return nullptr; + } + return EntryPointToCodePointer(entry_point); +} + +const uint8_t* ArtMethod::GetMappingTable() { + const void* code = GetOatCodePointer(); + if (code == nullptr) { + return nullptr; + } + uint32_t offset = reinterpret_cast<const OatMethodHeader*>(code)[-1].mapping_table_offset_; + if (UNLIKELY(offset == 0u)) { + return nullptr; + } + return reinterpret_cast<const uint8_t*>(code) - offset; +} + +const uint8_t* ArtMethod::GetVmapTable() { + const void* code = GetOatCodePointer(); + if (code == nullptr) { + return nullptr; + } + uint32_t offset = reinterpret_cast<const OatMethodHeader*>(code)[-1].vmap_table_offset_; + if (UNLIKELY(offset == 0u)) { + return nullptr; + } + return reinterpret_cast<const uint8_t*>(code) - offset; +} + } // namespace mirror } // namespace art |