diff options
-rw-r--r-- | compiler/debug/elf_debug_loc_writer.h | 3 | ||||
-rw-r--r-- | compiler/optimizing/stack_map_stream.cc | 3 | ||||
-rw-r--r-- | runtime/check_reference_map_visitor.h | 3 | ||||
-rw-r--r-- | runtime/jit/jit.cc | 3 | ||||
-rw-r--r-- | runtime/quick_exception_handler.cc | 14 | ||||
-rw-r--r-- | runtime/stack.cc | 11 | ||||
-rw-r--r-- | runtime/stack_map.cc | 27 | ||||
-rw-r--r-- | runtime/stack_map.h | 37 |
8 files changed, 48 insertions, 53 deletions
diff --git a/compiler/debug/elf_debug_loc_writer.h b/compiler/debug/elf_debug_loc_writer.h index 8fd20aa428..32f624acd3 100644 --- a/compiler/debug/elf_debug_loc_writer.h +++ b/compiler/debug/elf_debug_loc_writer.h @@ -232,8 +232,7 @@ static void WriteDebugLocEntry(const MethodDebugInfo* method_info, // kInStackLargeOffset and kConstantLargeValue are hidden by GetKind(). // kInRegisterHigh and kInFpuRegisterHigh should be handled by // the special cases above and they should not occur alone. - LOG(ERROR) << "Unexpected register location kind: " - << DexRegisterLocation::PrettyDescriptor(kind); + LOG(ERROR) << "Unexpected register location kind: " << kind; break; } if (is64bitValue) { diff --git a/compiler/optimizing/stack_map_stream.cc b/compiler/optimizing/stack_map_stream.cc index 4784de1380..b44f50890d 100644 --- a/compiler/optimizing/stack_map_stream.cc +++ b/compiler/optimizing/stack_map_stream.cc @@ -63,8 +63,7 @@ void StackMapStream::EndStackMapEntry() { void StackMapStream::AddDexRegisterEntry(DexRegisterLocation::Kind kind, int32_t value) { if (kind != DexRegisterLocation::Kind::kNone) { // Ensure we only use non-compressed location kind at this stage. - DCHECK(DexRegisterLocation::IsShortLocationKind(kind)) - << DexRegisterLocation::PrettyDescriptor(kind); + DCHECK(DexRegisterLocation::IsShortLocationKind(kind)) << kind; DexRegisterLocation location(kind, value); // Look for Dex register `location` in the location catalog (using the diff --git a/runtime/check_reference_map_visitor.h b/runtime/check_reference_map_visitor.h index b9ea475149..fcf3326c81 100644 --- a/runtime/check_reference_map_visitor.h +++ b/runtime/check_reference_map_visitor.h @@ -100,8 +100,7 @@ class CheckReferenceMapVisitor : public StackVisitor { CHECK_EQ(location.GetValue(), 0); break; default: - LOG(FATAL) << "Unexpected location kind" - << DexRegisterLocation::PrettyDescriptor(location.GetInternalKind()); + LOG(FATAL) << "Unexpected location kind " << location.GetInternalKind(); } } } diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc index bdc7ee2428..1a28733efd 100644 --- a/runtime/jit/jit.cc +++ b/runtime/jit/jit.cc @@ -369,8 +369,7 @@ bool Jit::MaybeDoOnStackReplacement(Thread* thread, continue; } - DCHECK(location == DexRegisterLocation::Kind::kInStack) - << DexRegisterLocation::PrettyDescriptor(location); + DCHECK_EQ(location, DexRegisterLocation::Kind::kInStack); int32_t vreg_value = shadow_frame->GetVReg(vreg); int32_t slot_offset = vreg_map.GetStackOffsetInBytes(vreg, diff --git a/runtime/quick_exception_handler.cc b/runtime/quick_exception_handler.cc index 2dfa860dcb..6317f5e401 100644 --- a/runtime/quick_exception_handler.cc +++ b/runtime/quick_exception_handler.cc @@ -204,8 +204,7 @@ static VRegKind ToVRegKind(DexRegisterLocation::Kind kind) { return VRegKind::kDoubleHiVReg; default: - LOG(FATAL) << "Unexpected vreg location " - << DexRegisterLocation::PrettyDescriptor(kind); + LOG(FATAL) << "Unexpected vreg location " << kind; UNREACHABLE(); } } @@ -456,12 +455,11 @@ class DeoptimizeStackVisitor FINAL : public StackVisitor { } default: { LOG(FATAL) - << "Unexpected location kind" - << DexRegisterLocation::PrettyDescriptor( - vreg_map.GetLocationInternalKind(vreg, - number_of_vregs, - code_info, - encoding)); + << "Unexpected location kind " + << vreg_map.GetLocationInternalKind(vreg, + number_of_vregs, + code_info, + encoding); UNREACHABLE(); } } diff --git a/runtime/stack.cc b/runtime/stack.cc index 5faff93b97..b1f1ed61b4 100644 --- a/runtime/stack.cc +++ b/runtime/stack.cc @@ -352,12 +352,11 @@ bool StackVisitor::GetVRegFromOptimizedCode(ArtMethod* m, uint16_t vreg, VRegKin return false; default: LOG(FATAL) - << "Unexpected location kind" - << DexRegisterLocation::PrettyDescriptor( - dex_register_map.GetLocationInternalKind(vreg, - number_of_dex_registers, - code_info, - encoding)); + << "Unexpected location kind " + << dex_register_map.GetLocationInternalKind(vreg, + number_of_dex_registers, + code_info, + encoding); UNREACHABLE(); } } diff --git a/runtime/stack_map.cc b/runtime/stack_map.cc index 5544507c06..30934360ac 100644 --- a/runtime/stack_map.cc +++ b/runtime/stack_map.cc @@ -27,6 +27,31 @@ constexpr size_t DexRegisterLocationCatalog::kNoLocationEntryIndex; constexpr uint32_t StackMap::kNoDexRegisterMap; constexpr uint32_t StackMap::kNoInlineInfo; +std::ostream& operator<<(std::ostream& stream, const DexRegisterLocation::Kind& kind) { + using Kind = DexRegisterLocation::Kind; + switch (kind) { + case Kind::kNone: + return stream << "none"; + case Kind::kInStack: + return stream << "in stack"; + case Kind::kInRegister: + return stream << "in register"; + case Kind::kInRegisterHigh: + return stream << "in register high"; + case Kind::kInFpuRegister: + return stream << "in fpu register"; + case Kind::kInFpuRegisterHigh: + return stream << "in fpu register high"; + case Kind::kConstant: + return stream << "as constant"; + case Kind::kInStackLargeOffset: + return stream << "in stack (large offset)"; + case Kind::kConstantLargeValue: + return stream << "as constant (large value)"; + } + return stream << "Kind<" << static_cast<uint32_t>(kind) << ">"; +} + DexRegisterLocation::Kind DexRegisterMap::GetLocationInternalKind( uint16_t dex_register_number, uint16_t number_of_dex_registers, @@ -97,7 +122,7 @@ static void DumpRegisterMapping(std::ostream& os, const std::string& prefix = "v", const std::string& suffix = "") { os << prefix << dex_register_num << ": " - << DexRegisterLocation::PrettyDescriptor(location.GetInternalKind()) + << location.GetInternalKind() << " (" << location.GetValue() << ")" << suffix << '\n'; } diff --git a/runtime/stack_map.h b/runtime/stack_map.h index 97eb805501..dbf23aafc3 100644 --- a/runtime/stack_map.h +++ b/runtime/stack_map.h @@ -110,30 +110,6 @@ class DexRegisterLocation { sizeof(Kind) == 1u, "art::DexRegisterLocation::Kind has a size different from one byte."); - static const char* PrettyDescriptor(Kind kind) { - switch (kind) { - case Kind::kNone: - return "none"; - case Kind::kInStack: - return "in stack"; - case Kind::kInRegister: - return "in register"; - case Kind::kInRegisterHigh: - return "in register high"; - case Kind::kInFpuRegister: - return "in fpu register"; - case Kind::kInFpuRegisterHigh: - return "in fpu register high"; - case Kind::kConstant: - return "as constant"; - case Kind::kInStackLargeOffset: - return "in stack (large offset)"; - case Kind::kConstantLargeValue: - return "as constant (large value)"; - } - UNREACHABLE(); - } - static bool IsShortLocationKind(Kind kind) { switch (kind) { case Kind::kInStack: @@ -149,7 +125,7 @@ class DexRegisterLocation { return false; case Kind::kNone: - LOG(FATAL) << "Unexpected location kind " << PrettyDescriptor(kind); + LOG(FATAL) << "Unexpected location kind"; } UNREACHABLE(); } @@ -215,6 +191,8 @@ class DexRegisterLocation { friend class DexRegisterLocationHashFn; }; +std::ostream& operator<<(std::ostream& stream, const DexRegisterLocation::Kind& kind); + /** * Store information on unique Dex register locations used in a method. * The information is of the form: @@ -349,7 +327,7 @@ class DexRegisterLocationCatalog { case DexRegisterLocation::Kind::kConstantLargeValue: case DexRegisterLocation::Kind::kInStackLargeOffset: case DexRegisterLocation::Kind::kNone: - LOG(FATAL) << "Unexpected location kind " << DexRegisterLocation::PrettyDescriptor(kind); + LOG(FATAL) << "Unexpected location kind " << kind; } UNREACHABLE(); } @@ -373,7 +351,7 @@ class DexRegisterLocationCatalog { case DexRegisterLocation::Kind::kConstantLargeValue: case DexRegisterLocation::Kind::kInStackLargeOffset: case DexRegisterLocation::Kind::kNone: - LOG(FATAL) << "Unexpected location kind " << DexRegisterLocation::PrettyDescriptor(kind); + LOG(FATAL) << "Unexpected location kind " << kind; } UNREACHABLE(); } @@ -515,8 +493,7 @@ class DexRegisterMap { const StackMapEncoding& enc) const { DexRegisterLocation location = GetDexRegisterLocation(dex_register_number, number_of_dex_registers, code_info, enc); - DCHECK(location.GetKind() == DexRegisterLocation::Kind::kConstant) - << DexRegisterLocation::PrettyDescriptor(location.GetKind()); + DCHECK_EQ(location.GetKind(), DexRegisterLocation::Kind::kConstant); return location.GetValue(); } @@ -530,7 +507,7 @@ class DexRegisterMap { location.GetInternalKind() == DexRegisterLocation::Kind::kInRegisterHigh || location.GetInternalKind() == DexRegisterLocation::Kind::kInFpuRegister || location.GetInternalKind() == DexRegisterLocation::Kind::kInFpuRegisterHigh) - << DexRegisterLocation::PrettyDescriptor(location.GetInternalKind()); + << location.GetInternalKind(); return location.GetValue(); } |