summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Igor Murashkin <iam@google.com> 2016-02-24 21:35:31 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2016-02-24 21:35:32 +0000
commitf5a28f77abefc080a870869ae933106435af4232 (patch)
treef143e4d7d75becbfb68628784b6309bd49f11724
parentdcf7db26bdf098b507623b5bf99c4e2bd045b2d1 (diff)
parent0ccfe2c039092ebefcbfdb7d523e20fc611e3e5f (diff)
Merge "image: Allow methods with code in another oat file to work correctly"
-rw-r--r--compiler/image_writer.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index aeb89f413a..5eff8f37ec 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -1951,9 +1951,19 @@ const uint8_t* ImageWriter::GetQuickCode(ArtMethod* method,
// trampoline.
// Quick entrypoint:
- uint32_t quick_oat_code_offset = PointerToLowMemUInt32(
- method->GetEntryPointFromQuickCompiledCodePtrSize(target_ptr_size_));
- const uint8_t* quick_code = GetOatAddressForOffset(quick_oat_code_offset, image_info);
+ const void* quick_oat_entry_point =
+ method->GetEntryPointFromQuickCompiledCodePtrSize(target_ptr_size_);
+ const uint8_t* quick_code;
+
+ if (UNLIKELY(IsInBootImage(method->GetDeclaringClass()))) {
+ DCHECK(method->IsCopied());
+ // If the code is not in the oat file corresponding to this image (e.g. default methods)
+ quick_code = reinterpret_cast<const uint8_t*>(quick_oat_entry_point);
+ } else {
+ uint32_t quick_oat_code_offset = PointerToLowMemUInt32(quick_oat_entry_point);
+ quick_code = GetOatAddressForOffset(quick_oat_code_offset, image_info);
+ }
+
*quick_is_interpreted = false;
if (quick_code != nullptr && (!method->IsStatic() || method->IsConstructor() ||
method->GetDeclaringClass()->IsInitialized())) {