summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2015-07-14 00:40:31 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-07-14 00:40:31 +0000
commit7977fddb2e7c62ad7536b8db793cc792b28bb32c (patch)
tree51e533a8d23b6ddbed630928da404d465370086b
parent8cbde1946524b3616cf52df9b256eb6ef4359b57 (diff)
parentb0139e854337a188408aed77500ffecdaf771b79 (diff)
downloadart-7977fddb2e7c62ad7536b8db793cc792b28bb32c.tar.gz
art-7977fddb2e7c62ad7536b8db793cc792b28bb32c.tar.bz2
art-7977fddb2e7c62ad7536b8db793cc792b28bb32c.zip
am b0139e85: Merge "Return an invalid StackMap when none can be found." into mnc-dev
* commit 'b0139e854337a188408aed77500ffecdaf771b79': Return an invalid StackMap when none can be found.
-rw-r--r--runtime/art_method.cc47
-rw-r--r--runtime/stack_map.h10
2 files changed, 31 insertions, 26 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) {
diff --git a/runtime/stack_map.h b/runtime/stack_map.h
index 6cc1709062..71e38ff5de 100644
--- a/runtime/stack_map.h
+++ b/runtime/stack_map.h
@@ -681,8 +681,12 @@ class DexRegisterMap {
*/
class StackMap {
public:
+ StackMap() {}
+
explicit StackMap(MemoryRegion region) : region_(region) {}
+ bool IsValid() const { return region_.pointer() != nullptr; }
+
uint32_t GetDexPc(const CodeInfo& info) const;
void SetDexPc(const CodeInfo& info, uint32_t dex_pc);
@@ -975,8 +979,7 @@ class CodeInfo {
return stack_map;
}
}
- LOG(FATAL) << "Unreachable";
- UNREACHABLE();
+ return StackMap();
}
StackMap GetStackMapForNativePcOffset(uint32_t native_pc_offset) const {
@@ -987,8 +990,7 @@ class CodeInfo {
return stack_map;
}
}
- LOG(FATAL) << "Unreachable";
- UNREACHABLE();
+ return StackMap();
}
void Dump(std::ostream& os, uint16_t number_of_dex_registers) const;