diff options
| author | 2016-02-19 16:41:44 -0800 | |
|---|---|---|
| committer | 2016-02-24 13:20:47 -0800 | |
| commit | 0ccfe2c039092ebefcbfdb7d523e20fc611e3e5f (patch) | |
| tree | eae9266ed3c2cf4fdf0c85424bd78b268fdf9dd1 | |
| parent | 0c0a7a326b3a76846d2a0b0e039cff877d43b588 (diff) | |
image: Allow methods with code in another oat file to work correctly
This fixes an issue when classes with default methods are in the boot
image and are used by an app image.
(cherry picked from commit 6e2237d6615c8f7b09c99d196e5effcfd087943b)
Bug: 27315287
Change-Id: Iaa66848fc07a0c779bc6e047bd154e2a4b87e1c8
| -rw-r--r-- | compiler/image_writer.cc | 16 |
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())) { |