diff options
| author | Nicolas Geoffray <ngeoffray@google.com> | 2015-07-10 10:56:40 +0100 |
|---|---|---|
| committer | Nicolas Geoffray <ngeoffray@google.com> | 2015-07-13 09:24:30 +0000 |
| commit | dbda04fc786d29382b712a26a8ee47e0ace13c25 (patch) | |
| tree | b7f00537a9e45ea37a7e04b94c4bcf2c26318e0a /runtime/art_method.cc | |
| parent | ccbbda2b716bcc0dd9ad7b6c7bf9079efa3fca23 (diff) | |
| download | art-dbda04fc786d29382b712a26a8ee47e0ace13c25.tar.gz art-dbda04fc786d29382b712a26a8ee47e0ace13c25.tar.bz2 art-dbda04fc786d29382b712a26a8ee47e0ace13c25.zip | |
Return an invalid StackMap when none can be found.
bug:22389275
Partial cherry-pick of:
https://android-review.googlesource.com/#/c/151853
(commit e12997fbce8e22431be58cac9db2535f7b4a7ac3)
Change-Id: Ia30b817be1b50d97243ba32967eeee359ed679c4
Diffstat (limited to 'runtime/art_method.cc')
| -rw-r--r-- | runtime/art_method.cc | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/runtime/art_method.cc b/runtime/art_method.cc index 16c099d31a..8619503f56 100644 --- a/runtime/art_method.cc +++ b/runtime/art_method.cc @@ -182,29 +182,32 @@ uint32_t ArtMethod::ToDexPc(const uintptr_t pc, bool abort_on_failure) { uint32_t sought_offset = pc - reinterpret_cast<uintptr_t>(entry_point); if (IsOptimized(sizeof(void*))) { CodeInfo code_info = GetOptimizedCodeInfo(); - return code_info.GetStackMapForNativePcOffset(sought_offset).GetDexPc(code_info); - } - - MappingTable table(entry_point != nullptr ? - GetMappingTable(EntryPointToCodePointer(entry_point), sizeof(void*)) : nullptr); - if (table.TotalSize() == 0) { - // NOTE: Special methods (see Mir2Lir::GenSpecialCase()) have an empty mapping - // but they have no suspend checks and, consequently, we never call ToDexPc() for them. - DCHECK(IsNative() || IsCalleeSaveMethod() || IsProxyMethod()) << PrettyMethod(this); - return DexFile::kDexNoIndex; // Special no mapping case - } - // Assume the caller wants a pc-to-dex mapping so check here first. - typedef MappingTable::PcToDexIterator It; - for (It cur = table.PcToDexBegin(), end = table.PcToDexEnd(); cur != end; ++cur) { - if (cur.NativePcOffset() == sought_offset) { - return cur.DexPc(); + StackMap stack_map = code_info.GetStackMapForNativePcOffset(sought_offset); + if (stack_map.IsValid()) { + return stack_map.GetDexPc(code_info); } - } - // Now check dex-to-pc mappings. - typedef MappingTable::DexToPcIterator It2; - for (It2 cur = table.DexToPcBegin(), end = table.DexToPcEnd(); cur != end; ++cur) { - if (cur.NativePcOffset() == sought_offset) { - return cur.DexPc(); + } else { + MappingTable table(entry_point != nullptr ? + GetMappingTable(EntryPointToCodePointer(entry_point), sizeof(void*)) : nullptr); + if (table.TotalSize() == 0) { + // NOTE: Special methods (see Mir2Lir::GenSpecialCase()) have an empty mapping + // but they have no suspend checks and, consequently, we never call ToDexPc() for them. + DCHECK(IsNative() || IsCalleeSaveMethod() || IsProxyMethod()) << PrettyMethod(this); + return DexFile::kDexNoIndex; // Special no mapping case + } + // Assume the caller wants a pc-to-dex mapping so check here first. + typedef MappingTable::PcToDexIterator It; + for (It cur = table.PcToDexBegin(), end = table.PcToDexEnd(); cur != end; ++cur) { + if (cur.NativePcOffset() == sought_offset) { + return cur.DexPc(); + } + } + // Now check dex-to-pc mappings. + typedef MappingTable::DexToPcIterator It2; + for (It2 cur = table.DexToPcBegin(), end = table.DexToPcEnd(); cur != end; ++cur) { + if (cur.NativePcOffset() == sought_offset) { + return cur.DexPc(); + } } } if (abort_on_failure) { |
