diff options
author | Ian Rogers <irogers@google.com> | 2013-08-05 10:56:33 -0700 |
---|---|---|
committer | Ian Rogers <irogers@google.com> | 2013-08-12 06:11:35 +0000 |
commit | 468532ea115657709bc32ee498e701a4c71762d4 (patch) | |
tree | 4f6bd555afe2333df2e748eff72d8e1d23e8ce86 /runtime/oat.cc | |
parent | f981da1d60864a730f744ef2cc3a19391c8303f2 (diff) | |
download | art-468532ea115657709bc32ee498e701a4c71762d4.tar.gz art-468532ea115657709bc32ee498e701a4c71762d4.tar.bz2 art-468532ea115657709bc32ee498e701a4c71762d4.zip |
Entry point clean up.
Create set of entry points needed for image methods to avoid fix-up at load time:
- interpreter - bridge to interpreter, bridge to compiled code
- jni - dlsym lookup
- quick - resolution and bridge to interpreter
- portable - resolution and bridge to interpreter
Fix JNI work around to use JNI work around argument rewriting code that'd been
accidentally disabled.
Remove abstact method error stub, use interpreter bridge instead.
Consolidate trampoline (previously stub) generation in generic helper.
Simplify trampolines to jump directly into assembly code, keeps stack crawlable.
Dex: replace use of int with ThreadOffset for values that are thread offsets.
Tidy entry point routines between interpreter, jni, quick and portable.
Change-Id: I52a7c2bbb1b7e0ff8a3c3100b774212309d0828e
(cherry picked from commit 848871b4d8481229c32e0d048a9856e5a9a17ef9)
Diffstat (limited to 'runtime/oat.cc')
-rw-r--r-- | runtime/oat.cc | 112 |
1 files changed, 86 insertions, 26 deletions
diff --git a/runtime/oat.cc b/runtime/oat.cc index e606953ed5..c01f77c364 100644 --- a/runtime/oat.cc +++ b/runtime/oat.cc @@ -22,7 +22,7 @@ namespace art { const uint8_t OatHeader::kOatMagic[] = { 'o', 'a', 't', '\n' }; -const uint8_t OatHeader::kOatVersion[] = { '0', '0', '6', '\0' }; +const uint8_t OatHeader::kOatVersion[] = { '0', '0', '7', '\0' }; OatHeader::OatHeader() { memset(this, 0, sizeof(*this)); @@ -57,10 +57,13 @@ OatHeader::OatHeader(InstructionSet instruction_set, UpdateChecksum(image_file_location.data(), image_file_location_size_); executable_offset_ = 0; - interpreter_to_interpreter_entry_offset_ = 0; - interpreter_to_quick_entry_offset_ = 0; + interpreter_to_interpreter_bridge_offset_ = 0; + interpreter_to_compiled_code_bridge_offset_ = 0; + jni_dlsym_lookup_offset_ = 0; portable_resolution_trampoline_offset_ = 0; + portable_to_interpreter_bridge_offset_ = 0; quick_resolution_trampoline_offset_ = 0; + quick_to_interpreter_bridge_offset_ = 0; } bool OatHeader::IsValid() const { @@ -111,42 +114,61 @@ void OatHeader::SetExecutableOffset(uint32_t executable_offset) { UpdateChecksum(&executable_offset_, sizeof(executable_offset)); } -const void* OatHeader::GetInterpreterToInterpreterEntry() const { - return reinterpret_cast<const uint8_t*>(this) + GetInterpreterToInterpreterEntryOffset(); +const void* OatHeader::GetInterpreterToInterpreterBridge() const { + return reinterpret_cast<const uint8_t*>(this) + GetInterpreterToInterpreterBridgeOffset(); } -uint32_t OatHeader::GetInterpreterToInterpreterEntryOffset() const { +uint32_t OatHeader::GetInterpreterToInterpreterBridgeOffset() const { DCHECK(IsValid()); - CHECK_GE(interpreter_to_interpreter_entry_offset_, executable_offset_); - return interpreter_to_interpreter_entry_offset_; + CHECK_GE(interpreter_to_interpreter_bridge_offset_, executable_offset_); + return interpreter_to_interpreter_bridge_offset_; } -void OatHeader::SetInterpreterToInterpreterEntryOffset(uint32_t offset) { +void OatHeader::SetInterpreterToInterpreterBridgeOffset(uint32_t offset) { CHECK(offset == 0 || offset >= executable_offset_); DCHECK(IsValid()); - DCHECK_EQ(interpreter_to_interpreter_entry_offset_, 0U) << offset; + DCHECK_EQ(interpreter_to_interpreter_bridge_offset_, 0U) << offset; - interpreter_to_interpreter_entry_offset_ = offset; - UpdateChecksum(&interpreter_to_interpreter_entry_offset_, sizeof(offset)); + interpreter_to_interpreter_bridge_offset_ = offset; + UpdateChecksum(&interpreter_to_interpreter_bridge_offset_, sizeof(offset)); } -const void* OatHeader::GetInterpreterToQuickEntry() const { - return reinterpret_cast<const uint8_t*>(this) + GetInterpreterToQuickEntryOffset(); +const void* OatHeader::GetInterpreterToCompiledCodeBridge() const { + return reinterpret_cast<const uint8_t*>(this) + GetInterpreterToCompiledCodeBridgeOffset(); } -uint32_t OatHeader::GetInterpreterToQuickEntryOffset() const { +uint32_t OatHeader::GetInterpreterToCompiledCodeBridgeOffset() const { DCHECK(IsValid()); - CHECK_GE(interpreter_to_quick_entry_offset_, interpreter_to_interpreter_entry_offset_); - return interpreter_to_quick_entry_offset_; + CHECK_GE(interpreter_to_compiled_code_bridge_offset_, interpreter_to_interpreter_bridge_offset_); + return interpreter_to_compiled_code_bridge_offset_; } -void OatHeader::SetInterpreterToQuickEntryOffset(uint32_t offset) { - CHECK(offset == 0 || offset >= interpreter_to_interpreter_entry_offset_); +void OatHeader::SetInterpreterToCompiledCodeBridgeOffset(uint32_t offset) { + CHECK(offset == 0 || offset >= interpreter_to_interpreter_bridge_offset_); DCHECK(IsValid()); - DCHECK_EQ(interpreter_to_quick_entry_offset_, 0U) << offset; + DCHECK_EQ(interpreter_to_compiled_code_bridge_offset_, 0U) << offset; - interpreter_to_quick_entry_offset_ = offset; - UpdateChecksum(&interpreter_to_quick_entry_offset_, sizeof(offset)); + interpreter_to_compiled_code_bridge_offset_ = offset; + UpdateChecksum(&interpreter_to_compiled_code_bridge_offset_, sizeof(offset)); +} + +const void* OatHeader::GetJniDlsymLookup() const { + return reinterpret_cast<const uint8_t*>(this) + GetJniDlsymLookupOffset(); +} + +uint32_t OatHeader::GetJniDlsymLookupOffset() const { + DCHECK(IsValid()); + CHECK_GE(jni_dlsym_lookup_offset_, interpreter_to_compiled_code_bridge_offset_); + return jni_dlsym_lookup_offset_; +} + +void OatHeader::SetJniDlsymLookupOffset(uint32_t offset) { + CHECK(offset == 0 || offset >= interpreter_to_compiled_code_bridge_offset_); + DCHECK(IsValid()); + DCHECK_EQ(jni_dlsym_lookup_offset_, 0U) << offset; + + jni_dlsym_lookup_offset_ = offset; + UpdateChecksum(&jni_dlsym_lookup_offset_, sizeof(offset)); } const void* OatHeader::GetPortableResolutionTrampoline() const { @@ -155,12 +177,12 @@ const void* OatHeader::GetPortableResolutionTrampoline() const { uint32_t OatHeader::GetPortableResolutionTrampolineOffset() const { DCHECK(IsValid()); - CHECK_GE(portable_resolution_trampoline_offset_, interpreter_to_quick_entry_offset_); + CHECK_GE(portable_resolution_trampoline_offset_, jni_dlsym_lookup_offset_); return portable_resolution_trampoline_offset_; } void OatHeader::SetPortableResolutionTrampolineOffset(uint32_t offset) { - CHECK(offset == 0 || offset >= interpreter_to_quick_entry_offset_); + CHECK(offset == 0 || offset >= jni_dlsym_lookup_offset_); DCHECK(IsValid()); DCHECK_EQ(portable_resolution_trampoline_offset_, 0U) << offset; @@ -168,18 +190,37 @@ void OatHeader::SetPortableResolutionTrampolineOffset(uint32_t offset) { UpdateChecksum(&portable_resolution_trampoline_offset_, sizeof(offset)); } +const void* OatHeader::GetPortableToInterpreterBridge() const { + return reinterpret_cast<const uint8_t*>(this) + GetPortableToInterpreterBridgeOffset(); +} + +uint32_t OatHeader::GetPortableToInterpreterBridgeOffset() const { + DCHECK(IsValid()); + CHECK_GE(portable_to_interpreter_bridge_offset_, portable_resolution_trampoline_offset_); + return portable_to_interpreter_bridge_offset_; +} + +void OatHeader::SetPortableToInterpreterBridgeOffset(uint32_t offset) { + CHECK(offset == 0 || offset >= portable_resolution_trampoline_offset_); + DCHECK(IsValid()); + DCHECK_EQ(portable_to_interpreter_bridge_offset_, 0U) << offset; + + portable_to_interpreter_bridge_offset_ = offset; + UpdateChecksum(&portable_to_interpreter_bridge_offset_, sizeof(offset)); +} + const void* OatHeader::GetQuickResolutionTrampoline() const { return reinterpret_cast<const uint8_t*>(this) + GetQuickResolutionTrampolineOffset(); } uint32_t OatHeader::GetQuickResolutionTrampolineOffset() const { DCHECK(IsValid()); - CHECK_GE(quick_resolution_trampoline_offset_, portable_resolution_trampoline_offset_); + CHECK_GE(quick_resolution_trampoline_offset_, portable_to_interpreter_bridge_offset_); return quick_resolution_trampoline_offset_; } void OatHeader::SetQuickResolutionTrampolineOffset(uint32_t offset) { - CHECK(offset == 0 || offset >= portable_resolution_trampoline_offset_); + CHECK(offset == 0 || offset >= portable_to_interpreter_bridge_offset_); DCHECK(IsValid()); DCHECK_EQ(quick_resolution_trampoline_offset_, 0U) << offset; @@ -187,6 +228,25 @@ void OatHeader::SetQuickResolutionTrampolineOffset(uint32_t offset) { UpdateChecksum(&quick_resolution_trampoline_offset_, sizeof(offset)); } +const void* OatHeader::GetQuickToInterpreterBridge() const { + return reinterpret_cast<const uint8_t*>(this) + GetQuickToInterpreterBridgeOffset(); +} + +uint32_t OatHeader::GetQuickToInterpreterBridgeOffset() const { + DCHECK(IsValid()); + CHECK_GE(quick_to_interpreter_bridge_offset_, quick_resolution_trampoline_offset_); + return quick_to_interpreter_bridge_offset_; +} + +void OatHeader::SetQuickToInterpreterBridgeOffset(uint32_t offset) { + CHECK(offset == 0 || offset >= quick_resolution_trampoline_offset_); + DCHECK(IsValid()); + DCHECK_EQ(quick_to_interpreter_bridge_offset_, 0U) << offset; + + quick_to_interpreter_bridge_offset_ = offset; + UpdateChecksum(&quick_to_interpreter_bridge_offset_, sizeof(offset)); +} + uint32_t OatHeader::GetImageFileLocationOatChecksum() const { CHECK(IsValid()); return image_file_location_oat_checksum_; |