diff options
| -rw-r--r-- | compiler/debug/elf_debug_info_writer.h | 3 | ||||
| -rw-r--r-- | compiler/debug/elf_debug_loc_writer.h | 2 | ||||
| -rw-r--r-- | compiler/optimizing/stack_map_test.cc | 66 | ||||
| -rw-r--r-- | oatdump/oatdump.cc | 5 | ||||
| -rw-r--r-- | runtime/check_reference_map_visitor.h | 4 | ||||
| -rw-r--r-- | runtime/jit/jit.cc | 6 | ||||
| -rw-r--r-- | runtime/quick_exception_handler.cc | 21 | ||||
| -rw-r--r-- | runtime/stack.cc | 10 | ||||
| -rw-r--r-- | runtime/stack_map.cc | 21 | ||||
| -rw-r--r-- | runtime/stack_map.h | 14 | ||||
| -rw-r--r-- | runtime/thread.cc | 3 |
11 files changed, 72 insertions, 83 deletions
diff --git a/compiler/debug/elf_debug_info_writer.h b/compiler/debug/elf_debug_info_writer.h index f2002a0af6..f2a942f34a 100644 --- a/compiler/debug/elf_debug_info_writer.h +++ b/compiler/debug/elf_debug_info_writer.h @@ -210,8 +210,7 @@ class ElfCompilationUnitWriter { code_info.reset(new CodeInfo(mi->code_info)); for (size_t s = 0; s < code_info->GetNumberOfStackMaps(); ++s) { const StackMap stack_map = code_info->GetStackMapAt(s); - dex_reg_maps.push_back(code_info->GetDexRegisterMapOf( - stack_map, accessor.RegistersSize())); + dex_reg_maps.push_back(code_info->GetDexRegisterMapOf(stack_map)); } } diff --git a/compiler/debug/elf_debug_loc_writer.h b/compiler/debug/elf_debug_loc_writer.h index 8cb4e55bbc..4009acb992 100644 --- a/compiler/debug/elf_debug_loc_writer.h +++ b/compiler/debug/elf_debug_loc_writer.h @@ -147,7 +147,7 @@ static std::vector<VariableLocation> GetVariableLocations( DexRegisterLocation reg_hi = DexRegisterLocation::None(); DCHECK_LT(stack_map_index, dex_register_maps.size()); DexRegisterMap dex_register_map = dex_register_maps[stack_map_index]; - DCHECK(dex_register_map.IsValid()); + DCHECK(!dex_register_map.empty()); CodeItemDataAccessor accessor(*method_info->dex_file, method_info->code_item); reg_lo = dex_register_map.GetDexRegisterLocation(vreg); if (is64bitValue) { diff --git a/compiler/optimizing/stack_map_test.cc b/compiler/optimizing/stack_map_test.cc index 0be276cfd6..9adc4c5ba6 100644 --- a/compiler/optimizing/stack_map_test.cc +++ b/compiler/optimizing/stack_map_test.cc @@ -81,8 +81,8 @@ TEST(StackMapTest, Test1) { ASSERT_TRUE(CheckStackMask(code_info, stack_map, sp_mask)); ASSERT_TRUE(stack_map.HasDexRegisterMap()); - DexRegisterMap dex_register_map = - code_info.GetDexRegisterMapOf(stack_map, number_of_dex_registers); + DexRegisterMap dex_register_map = code_info.GetDexRegisterMapOf(stack_map); + ASSERT_EQ(number_of_dex_registers, dex_register_map.size()); ASSERT_TRUE(dex_register_map.IsDexRegisterLive(0)); ASSERT_TRUE(dex_register_map.IsDexRegisterLive(1)); ASSERT_EQ(2u, dex_register_map.GetNumberOfLiveDexRegisters()); @@ -170,8 +170,8 @@ TEST(StackMapTest, Test2) { ASSERT_TRUE(CheckStackMask(code_info, stack_map, sp_mask1)); ASSERT_TRUE(stack_map.HasDexRegisterMap()); - DexRegisterMap dex_register_map = - code_info.GetDexRegisterMapOf(stack_map, number_of_dex_registers); + DexRegisterMap dex_register_map = code_info.GetDexRegisterMapOf(stack_map); + ASSERT_EQ(number_of_dex_registers, dex_register_map.size()); ASSERT_TRUE(dex_register_map.IsDexRegisterLive(0)); ASSERT_TRUE(dex_register_map.IsDexRegisterLive(1)); ASSERT_EQ(2u, dex_register_map.GetNumberOfLiveDexRegisters()); @@ -210,8 +210,8 @@ TEST(StackMapTest, Test2) { ASSERT_TRUE(CheckStackMask(code_info, stack_map, sp_mask2)); ASSERT_TRUE(stack_map.HasDexRegisterMap()); - DexRegisterMap dex_register_map = - code_info.GetDexRegisterMapOf(stack_map, number_of_dex_registers); + DexRegisterMap dex_register_map = code_info.GetDexRegisterMapOf(stack_map); + ASSERT_EQ(number_of_dex_registers, dex_register_map.size()); ASSERT_TRUE(dex_register_map.IsDexRegisterLive(0)); ASSERT_TRUE(dex_register_map.IsDexRegisterLive(1)); ASSERT_EQ(2u, dex_register_map.GetNumberOfLiveDexRegisters()); @@ -243,8 +243,8 @@ TEST(StackMapTest, Test2) { ASSERT_TRUE(CheckStackMask(code_info, stack_map, sp_mask3)); ASSERT_TRUE(stack_map.HasDexRegisterMap()); - DexRegisterMap dex_register_map = - code_info.GetDexRegisterMapOf(stack_map, number_of_dex_registers); + DexRegisterMap dex_register_map = code_info.GetDexRegisterMapOf(stack_map); + ASSERT_EQ(number_of_dex_registers, dex_register_map.size()); ASSERT_TRUE(dex_register_map.IsDexRegisterLive(0)); ASSERT_TRUE(dex_register_map.IsDexRegisterLive(1)); ASSERT_EQ(2u, dex_register_map.GetNumberOfLiveDexRegisters()); @@ -276,8 +276,8 @@ TEST(StackMapTest, Test2) { ASSERT_TRUE(CheckStackMask(code_info, stack_map, sp_mask4)); ASSERT_TRUE(stack_map.HasDexRegisterMap()); - DexRegisterMap dex_register_map = - code_info.GetDexRegisterMapOf(stack_map, number_of_dex_registers); + DexRegisterMap dex_register_map = code_info.GetDexRegisterMapOf(stack_map); + ASSERT_EQ(number_of_dex_registers, dex_register_map.size()); ASSERT_TRUE(dex_register_map.IsDexRegisterLive(0)); ASSERT_TRUE(dex_register_map.IsDexRegisterLive(1)); ASSERT_EQ(2u, dex_register_map.GetNumberOfLiveDexRegisters()); @@ -342,7 +342,8 @@ TEST(StackMapTest, TestDeduplicateInlineInfoDexRegisterMap) { ASSERT_TRUE(CheckStackMask(code_info, stack_map, sp_mask1)); ASSERT_TRUE(stack_map.HasDexRegisterMap()); - DexRegisterMap map(code_info.GetDexRegisterMapOf(stack_map, number_of_dex_registers)); + DexRegisterMap map(code_info.GetDexRegisterMapOf(stack_map)); + ASSERT_EQ(number_of_dex_registers, map.size()); ASSERT_TRUE(map.IsDexRegisterLive(0)); ASSERT_TRUE(map.IsDexRegisterLive(1)); ASSERT_EQ(2u, map.GetNumberOfLiveDexRegisters()); @@ -393,8 +394,8 @@ TEST(StackMapTest, TestNonLiveDexRegisters) { ASSERT_EQ(0x3u, code_info.GetRegisterMaskOf(stack_map)); ASSERT_TRUE(stack_map.HasDexRegisterMap()); - DexRegisterMap dex_register_map = - code_info.GetDexRegisterMapOf(stack_map, number_of_dex_registers); + DexRegisterMap dex_register_map = code_info.GetDexRegisterMapOf(stack_map); + ASSERT_EQ(number_of_dex_registers, dex_register_map.size()); ASSERT_FALSE(dex_register_map.IsDexRegisterLive(0)); ASSERT_TRUE(dex_register_map.IsDexRegisterLive(1)); ASSERT_EQ(1u, dex_register_map.GetNumberOfLiveDexRegisters()); @@ -443,19 +444,22 @@ TEST(StackMapTest, TestShareDexRegisterMap) { // Verify first stack map. StackMap sm0 = ci.GetStackMapAt(0); - DexRegisterMap dex_registers0 = ci.GetDexRegisterMapOf(sm0, number_of_dex_registers); + DexRegisterMap dex_registers0 = ci.GetDexRegisterMapOf(sm0); + ASSERT_EQ(number_of_dex_registers, dex_registers0.size()); ASSERT_EQ(0, dex_registers0.GetMachineRegister(0)); ASSERT_EQ(-2, dex_registers0.GetConstant(1)); // Verify second stack map. StackMap sm1 = ci.GetStackMapAt(1); - DexRegisterMap dex_registers1 = ci.GetDexRegisterMapOf(sm1, number_of_dex_registers); + DexRegisterMap dex_registers1 = ci.GetDexRegisterMapOf(sm1); + ASSERT_EQ(number_of_dex_registers, dex_registers1.size()); ASSERT_EQ(0, dex_registers1.GetMachineRegister(0)); ASSERT_EQ(-2, dex_registers1.GetConstant(1)); // Verify third stack map. StackMap sm2 = ci.GetStackMapAt(2); - DexRegisterMap dex_registers2 = ci.GetDexRegisterMapOf(sm2, number_of_dex_registers); + DexRegisterMap dex_registers2 = ci.GetDexRegisterMapOf(sm2); + ASSERT_EQ(number_of_dex_registers, dex_registers2.size()); ASSERT_EQ(2, dex_registers2.GetMachineRegister(0)); ASSERT_EQ(-2, dex_registers2.GetConstant(1)); @@ -591,7 +595,8 @@ TEST(StackMapTest, InlineTest) { // Verify first stack map. StackMap sm0 = ci.GetStackMapAt(0); - DexRegisterMap dex_registers0 = ci.GetDexRegisterMapOf(sm0, 2); + DexRegisterMap dex_registers0 = ci.GetDexRegisterMapOf(sm0); + ASSERT_EQ(2u, dex_registers0.size()); ASSERT_EQ(0, dex_registers0.GetStackOffsetInBytes(0)); ASSERT_EQ(4, dex_registers0.GetConstant(1)); @@ -603,10 +608,12 @@ TEST(StackMapTest, InlineTest) { ASSERT_EQ(3u, if0_1.GetDexPc()); ASSERT_TRUE(if0_1.EncodesArtMethod()); - DexRegisterMap dex_registers1 = ci.GetDexRegisterMapAtDepth(0, sm0, 1); + DexRegisterMap dex_registers1 = ci.GetDexRegisterMapAtDepth(0, sm0); + ASSERT_EQ(1u, dex_registers1.size()); ASSERT_EQ(8, dex_registers1.GetStackOffsetInBytes(0)); - DexRegisterMap dex_registers2 = ci.GetDexRegisterMapAtDepth(1, sm0, 3); + DexRegisterMap dex_registers2 = ci.GetDexRegisterMapAtDepth(1, sm0); + ASSERT_EQ(3u, dex_registers2.size()); ASSERT_EQ(16, dex_registers2.GetStackOffsetInBytes(0)); ASSERT_EQ(20, dex_registers2.GetConstant(1)); ASSERT_EQ(15, dex_registers2.GetMachineRegister(2)); @@ -616,7 +623,8 @@ TEST(StackMapTest, InlineTest) { // Verify second stack map. StackMap sm1 = ci.GetStackMapAt(1); - DexRegisterMap dex_registers0 = ci.GetDexRegisterMapOf(sm1, 2); + DexRegisterMap dex_registers0 = ci.GetDexRegisterMapOf(sm1); + ASSERT_EQ(2u, dex_registers0.size()); ASSERT_EQ(56, dex_registers0.GetStackOffsetInBytes(0)); ASSERT_EQ(0, dex_registers0.GetConstant(1)); @@ -631,10 +639,12 @@ TEST(StackMapTest, InlineTest) { ASSERT_EQ(5u, if1_2.GetDexPc()); ASSERT_TRUE(if1_2.EncodesArtMethod()); - DexRegisterMap dex_registers1 = ci.GetDexRegisterMapAtDepth(0, sm1, 1); + DexRegisterMap dex_registers1 = ci.GetDexRegisterMapAtDepth(0, sm1); + ASSERT_EQ(1u, dex_registers1.size()); ASSERT_EQ(12, dex_registers1.GetStackOffsetInBytes(0)); - DexRegisterMap dex_registers2 = ci.GetDexRegisterMapAtDepth(1, sm1, 3); + DexRegisterMap dex_registers2 = ci.GetDexRegisterMapAtDepth(1, sm1); + ASSERT_EQ(3u, dex_registers2.size()); ASSERT_EQ(80, dex_registers2.GetStackOffsetInBytes(0)); ASSERT_EQ(10, dex_registers2.GetConstant(1)); ASSERT_EQ(5, dex_registers2.GetMachineRegister(2)); @@ -644,7 +654,8 @@ TEST(StackMapTest, InlineTest) { // Verify third stack map. StackMap sm2 = ci.GetStackMapAt(2); - DexRegisterMap dex_registers0 = ci.GetDexRegisterMapOf(sm2, 2); + DexRegisterMap dex_registers0 = ci.GetDexRegisterMapOf(sm2); + ASSERT_EQ(2u, dex_registers0.size()); ASSERT_FALSE(dex_registers0.IsDexRegisterLive(0)); ASSERT_EQ(4, dex_registers0.GetConstant(1)); ASSERT_FALSE(sm2.HasInlineInfo()); @@ -654,7 +665,8 @@ TEST(StackMapTest, InlineTest) { // Verify fourth stack map. StackMap sm3 = ci.GetStackMapAt(3); - DexRegisterMap dex_registers0 = ci.GetDexRegisterMapOf(sm3, 2); + DexRegisterMap dex_registers0 = ci.GetDexRegisterMapOf(sm3); + ASSERT_EQ(2u, dex_registers0.size()); ASSERT_EQ(56, dex_registers0.GetStackOffsetInBytes(0)); ASSERT_EQ(0, dex_registers0.GetConstant(1)); @@ -669,10 +681,12 @@ TEST(StackMapTest, InlineTest) { ASSERT_EQ(10u, if2_2.GetDexPc()); ASSERT_TRUE(if2_2.EncodesArtMethod()); - DexRegisterMap dex_registers1 = ci.GetDexRegisterMapAtDepth(1, sm3, 1); + DexRegisterMap dex_registers1 = ci.GetDexRegisterMapAtDepth(1, sm3); + ASSERT_EQ(1u, dex_registers1.size()); ASSERT_EQ(2, dex_registers1.GetMachineRegister(0)); - DexRegisterMap dex_registers2 = ci.GetDexRegisterMapAtDepth(2, sm3, 2); + DexRegisterMap dex_registers2 = ci.GetDexRegisterMapAtDepth(2, sm3); + ASSERT_EQ(2u, dex_registers2.size()); ASSERT_FALSE(dex_registers2.IsDexRegisterLive(0)); ASSERT_EQ(3, dex_registers2.GetMachineRegister(1)); } diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc index 3973edcf73..b28c4d90d1 100644 --- a/oatdump/oatdump.cc +++ b/oatdump/oatdump.cc @@ -1425,7 +1425,7 @@ class OatDumper { DCHECK(code_item_accessor.HasCodeItem()); ScopedIndentation indent1(vios); MethodInfo method_info = oat_method.GetOatQuickMethodHeader()->GetOptimizedMethodInfo(); - DumpCodeInfo(vios, code_info, oat_method, code_item_accessor, method_info); + DumpCodeInfo(vios, code_info, oat_method, method_info); } } else if (IsMethodGeneratedByDexToDexCompiler(oat_method, code_item_accessor)) { // We don't encode the size in the table, so just emit that we have quickened @@ -1441,11 +1441,9 @@ class OatDumper { void DumpCodeInfo(VariableIndentationOutputStream* vios, const CodeInfo& code_info, const OatFile::OatMethod& oat_method, - const CodeItemDataAccessor& code_item_accessor, const MethodInfo& method_info) { code_info.Dump(vios, oat_method.GetCodeOffset(), - code_item_accessor.RegistersSize(), options_.dump_code_info_stack_maps_, instruction_set_, method_info); @@ -1775,7 +1773,6 @@ class OatDumper { helper.GetCodeInfo(), method_info, oat_method.GetCodeOffset(), - code_item_accessor.RegistersSize(), instruction_set_); do { helper.Next(); diff --git a/runtime/check_reference_map_visitor.h b/runtime/check_reference_map_visitor.h index acdb235f8c..8a2a70e7ab 100644 --- a/runtime/check_reference_map_visitor.h +++ b/runtime/check_reference_map_visitor.h @@ -68,8 +68,8 @@ class CheckReferenceMapVisitor : public StackVisitor { StackMap stack_map = code_info.GetStackMapForNativePcOffset(native_pc_offset); CodeItemDataAccessor accessor(m->DexInstructionData()); uint16_t number_of_dex_registers = accessor.RegistersSize(); - DexRegisterMap dex_register_map = - code_info.GetDexRegisterMapOf(stack_map, number_of_dex_registers); + DexRegisterMap dex_register_map = code_info.GetDexRegisterMapOf(stack_map); + DCHECK_EQ(dex_register_map.size(), number_of_dex_registers); uint32_t register_mask = code_info.GetRegisterMaskOf(stack_map); BitMemoryRegion stack_mask = code_info.GetStackMaskOf(stack_map); for (int i = 0; i < number_of_references; ++i) { diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc index b7b779ce31..5a5634ef62 100644 --- a/runtime/jit/jit.cc +++ b/runtime/jit/jit.cc @@ -493,8 +493,7 @@ bool Jit::MaybeDoOnStackReplacement(Thread* thread, // We found a stack map, now fill the frame with dex register values from the interpreter's // shadow frame. - DexRegisterMap vreg_map = - code_info.GetDexRegisterMapOf(stack_map, number_of_vregs); + DexRegisterMap vreg_map = code_info.GetDexRegisterMapOf(stack_map); frame_size = osr_method->GetFrameSizeInBytes(); @@ -510,10 +509,11 @@ bool Jit::MaybeDoOnStackReplacement(Thread* thread, memory[0] = method; shadow_frame = thread->PopShadowFrame(); - if (!vreg_map.IsValid()) { + if (vreg_map.empty()) { // If we don't have a dex register map, then there are no live dex registers at // this dex pc. } else { + DCHECK_EQ(vreg_map.size(), number_of_vregs); for (uint16_t vreg = 0; vreg < number_of_vregs; ++vreg) { DexRegisterLocation::Kind location = vreg_map.GetLocationKind(vreg); if (location == DexRegisterLocation::Kind::kNone) { diff --git a/runtime/quick_exception_handler.cc b/runtime/quick_exception_handler.cc index 23ccf6ad58..cf1cbe7f7b 100644 --- a/runtime/quick_exception_handler.cc +++ b/runtime/quick_exception_handler.cc @@ -230,19 +230,18 @@ void QuickExceptionHandler::SetCatchEnvironmentForOptimizedHandler(StackVisitor* // Find stack map of the catch block. StackMap catch_stack_map = code_info.GetCatchStackMapForDexPc(GetHandlerDexPc()); DCHECK(catch_stack_map.IsValid()); - DexRegisterMap catch_vreg_map = - code_info.GetDexRegisterMapOf(catch_stack_map, number_of_vregs); - if (!catch_vreg_map.IsValid() || !catch_vreg_map.HasAnyLiveDexRegisters()) { + DexRegisterMap catch_vreg_map = code_info.GetDexRegisterMapOf(catch_stack_map); + if (!catch_vreg_map.HasAnyLiveDexRegisters()) { return; } + DCHECK_EQ(catch_vreg_map.size(), number_of_vregs); // Find stack map of the throwing instruction. StackMap throw_stack_map = code_info.GetStackMapForNativePcOffset(stack_visitor->GetNativePcOffset()); DCHECK(throw_stack_map.IsValid()); - DexRegisterMap throw_vreg_map = - code_info.GetDexRegisterMapOf(throw_stack_map, number_of_vregs); - DCHECK(throw_vreg_map.IsValid()); + DexRegisterMap throw_vreg_map = code_info.GetDexRegisterMapOf(throw_stack_map); + DCHECK_EQ(throw_vreg_map.size(), number_of_vregs); // Copy values between them. for (uint16_t vreg = 0; vreg < number_of_vregs; ++vreg) { @@ -405,14 +404,12 @@ class DeoptimizeStackVisitor FINAL : public StackVisitor { uint32_t register_mask = code_info.GetRegisterMaskOf(stack_map); BitMemoryRegion stack_mask = code_info.GetStackMaskOf(stack_map); DexRegisterMap vreg_map = IsInInlinedFrame() - ? code_info.GetDexRegisterMapAtDepth(GetCurrentInliningDepth() - 1, - stack_map, - number_of_vregs) - : code_info.GetDexRegisterMapOf(stack_map, number_of_vregs); - - if (!vreg_map.IsValid()) { + ? code_info.GetDexRegisterMapAtDepth(GetCurrentInliningDepth() - 1, stack_map) + : code_info.GetDexRegisterMapOf(stack_map); + if (vreg_map.empty()) { return; } + DCHECK_EQ(vreg_map.size(), number_of_vregs); for (uint16_t vreg = 0; vreg < number_of_vregs; ++vreg) { if (updated_vregs != nullptr && updated_vregs[vreg]) { diff --git a/runtime/stack.cc b/runtime/stack.cc index 0b3441aa45..56e47b9c77 100644 --- a/runtime/stack.cc +++ b/runtime/stack.cc @@ -236,14 +236,12 @@ bool StackVisitor::GetVRegFromOptimizedCode(ArtMethod* m, uint16_t vreg, VRegKin size_t depth_in_stack_map = current_inlining_depth_ - 1; DexRegisterMap dex_register_map = IsInInlinedFrame() - ? code_info.GetDexRegisterMapAtDepth(depth_in_stack_map, - stack_map, - number_of_dex_registers) - : code_info.GetDexRegisterMapOf(stack_map, number_of_dex_registers); - - if (!dex_register_map.IsValid()) { + ? code_info.GetDexRegisterMapAtDepth(depth_in_stack_map, stack_map) + : code_info.GetDexRegisterMapOf(stack_map); + if (dex_register_map.empty()) { return false; } + DCHECK_EQ(dex_register_map.size(), number_of_dex_registers); DexRegisterLocation::Kind location_kind = dex_register_map.GetLocationKind(vreg); switch (location_kind) { case DexRegisterLocation::Kind::kInStack: { diff --git a/runtime/stack_map.cc b/runtime/stack_map.cc index 59a89e12b8..a25c9fdee0 100644 --- a/runtime/stack_map.cc +++ b/runtime/stack_map.cc @@ -115,7 +115,7 @@ std::ostream& operator<<(std::ostream& stream, const DexRegisterLocation& reg) { static void DumpDexRegisterMap(VariableIndentationOutputStream* vios, const DexRegisterMap& map) { - if (map.IsValid()) { + if (!map.empty()) { ScopedIndentation indent1(vios); for (size_t i = 0; i < map.size(); ++i) { if (map.IsDexRegisterLive(i)) { @@ -163,7 +163,6 @@ static void DumpTable(VariableIndentationOutputStream* vios, void CodeInfo::Dump(VariableIndentationOutputStream* vios, uint32_t code_offset, - uint16_t num_dex_registers, bool verbose, InstructionSet instruction_set, const MethodInfo& method_info) const { @@ -185,7 +184,7 @@ void CodeInfo::Dump(VariableIndentationOutputStream* vios, if (verbose) { for (size_t i = 0; i < GetNumberOfStackMaps(); ++i) { StackMap stack_map = GetStackMapAt(i); - stack_map.Dump(vios, *this, method_info, code_offset, num_dex_registers, instruction_set); + stack_map.Dump(vios, *this, method_info, code_offset, instruction_set); } } } @@ -194,7 +193,6 @@ void StackMap::Dump(VariableIndentationOutputStream* vios, const CodeInfo& code_info, const MethodInfo& method_info, uint32_t code_offset, - uint16_t number_of_dex_registers, InstructionSet instruction_set) const { const uint32_t pc_offset = GetNativePcOffset(instruction_set); vios->Stream() @@ -210,22 +208,18 @@ void StackMap::Dump(VariableIndentationOutputStream* vios, vios->Stream() << stack_mask.LoadBit(e - i - 1); } vios->Stream() << ")\n"; - DumpDexRegisterMap(vios, code_info.GetDexRegisterMapOf(*this, number_of_dex_registers)); + DumpDexRegisterMap(vios, code_info.GetDexRegisterMapOf(*this)); uint32_t depth = code_info.GetInlineDepthOf(*this); for (size_t d = 0; d < depth; d++) { InlineInfo inline_info = code_info.GetInlineInfoAtDepth(*this, d); - // We do not know the length of the dex register maps of inlined frames - // at this level, so we just pass null to `InlineInfo::Dump` to tell - // it not to look at these maps. - inline_info.Dump(vios, code_info, *this, method_info, 0); + inline_info.Dump(vios, code_info, *this, method_info); } } void InlineInfo::Dump(VariableIndentationOutputStream* vios, const CodeInfo& code_info, const StackMap& stack_map, - const MethodInfo& method_info, - uint16_t number_of_dex_registers) const { + const MethodInfo& method_info) const { uint32_t depth = Row() - stack_map.GetInlineInfoIndex(); vios->Stream() << "InlineInfo[" << Row() << "]" @@ -241,10 +235,7 @@ void InlineInfo::Dump(VariableIndentationOutputStream* vios, << ", method_index=" << GetMethodIndex(method_info); } vios->Stream() << ")\n"; - if (number_of_dex_registers != 0) { - uint16_t vregs = number_of_dex_registers; - DumpDexRegisterMap(vios, code_info.GetDexRegisterMapAtDepth(depth, stack_map, vregs)); - } + DumpDexRegisterMap(vios, code_info.GetDexRegisterMapAtDepth(depth, stack_map)); } } // namespace art diff --git a/runtime/stack_map.h b/runtime/stack_map.h index ff70b6c759..53f80e5203 100644 --- a/runtime/stack_map.h +++ b/runtime/stack_map.h @@ -75,7 +75,7 @@ class DexRegisterMap { size_t size() const { return count_; } - bool IsValid() const { return count_ != 0; } + bool empty() const { return count_ == 0; } DexRegisterLocation Get(size_t index) const { DCHECK_LT(index, count_); @@ -194,7 +194,6 @@ class StackMap : public BitTable<7>::Accessor { const CodeInfo& code_info, const MethodInfo& method_info, uint32_t code_offset, - uint16_t number_of_dex_registers, InstructionSet instruction_set) const; }; @@ -234,8 +233,7 @@ class InlineInfo : public BitTable<6>::Accessor { void Dump(VariableIndentationOutputStream* vios, const CodeInfo& info, const StackMap& stack_map, - const MethodInfo& method_info, - uint16_t number_of_dex_registers) const; + const MethodInfo& method_info) const; }; class InvokeInfo : public BitTable<3>::Accessor { @@ -358,8 +356,7 @@ class CodeInfo { return InvokeInfo(&invoke_infos_, index); } - ALWAYS_INLINE DexRegisterMap GetDexRegisterMapOf(StackMap stack_map, - size_t vregs ATTRIBUTE_UNUSED = 0) const { + ALWAYS_INLINE DexRegisterMap GetDexRegisterMapOf(StackMap stack_map) const { if (stack_map.HasDexRegisterMap()) { DexRegisterMap map(number_of_dex_registers_, DexRegisterLocation::Invalid()); DecodeDexRegisterMap(stack_map.Row(), /* first_dex_register */ 0, &map); @@ -368,9 +365,7 @@ class CodeInfo { return DexRegisterMap(0, DexRegisterLocation::None()); } - ALWAYS_INLINE DexRegisterMap GetDexRegisterMapAtDepth(uint8_t depth, - StackMap stack_map, - size_t vregs ATTRIBUTE_UNUSED = 0) const { + ALWAYS_INLINE DexRegisterMap GetDexRegisterMapAtDepth(uint8_t depth, StackMap stack_map) const { if (stack_map.HasDexRegisterMap()) { // The register counts are commutative and include all outer levels. // This allows us to determine the range [first, last) in just two lookups. @@ -481,7 +476,6 @@ class CodeInfo { // `code_offset` is the (absolute) native PC of the compiled method. void Dump(VariableIndentationOutputStream* vios, uint32_t code_offset, - uint16_t number_of_dex_registers, bool verbose, InstructionSet instruction_set, const MethodInfo& method_info) const; diff --git a/runtime/thread.cc b/runtime/thread.cc index b59606a06b..bb4f186c95 100644 --- a/runtime/thread.cc +++ b/runtime/thread.cc @@ -3656,8 +3656,7 @@ class ReferenceMapVisitor : public StackVisitor { RootVisitor& _visitor) : number_of_dex_registers(method->DexInstructionData().RegistersSize()), code_info(_code_info), - dex_register_map(code_info.GetDexRegisterMapOf(map, - number_of_dex_registers)), + dex_register_map(code_info.GetDexRegisterMapOf(map)), visitor(_visitor) { } |