Remove depth argument from InlineInfo accessors in stack maps.
The InlineInfo class actually represented a list of inlining
information for a given stack map, and the depth argument was
used everywhere to select to desired element from the list.
This was verbose and inconsistent with the other classes.
Change the InlineInfo class to represent a single inlining,
and select the desired depth when getting it from CodeInfo.
Test: test-art-host-gtest-stack_map_test
Change-Id: I35b73e6704854f0203f51d4dbdbed5b1d1cd5a3b
diff --git a/runtime/stack_map.cc b/runtime/stack_map.cc
index 923bb35..a5749b8 100644
--- a/runtime/stack_map.cc
+++ b/runtime/stack_map.cc
@@ -146,38 +146,39 @@
}
vios->Stream() << ")\n";
DumpDexRegisterMap(vios, code_info.GetDexRegisterMapOf(*this, number_of_dex_registers));
- if (HasInlineInfo()) {
- InlineInfo inline_info = code_info.GetInlineInfoOf(*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, method_info, nullptr);
+ inline_info.Dump(vios, code_info, *this, method_info, 0);
}
}
void InlineInfo::Dump(VariableIndentationOutputStream* vios,
const CodeInfo& code_info,
+ const StackMap& stack_map,
const MethodInfo& method_info,
- uint16_t number_of_dex_registers[]) const {
- for (size_t i = 0; i < GetDepth(); ++i) {
+ uint16_t number_of_dex_registers) const {
+ uint32_t depth = Row() - stack_map.GetInlineInfoIndex();
+ vios->Stream()
+ << "InlineInfo[" << Row() << "]"
+ << " (depth=" << depth
+ << std::hex
+ << ", dex_pc=0x" << GetDexPc();
+ if (EncodesArtMethod()) {
+ ScopedObjectAccess soa(Thread::Current());
+ vios->Stream() << ", method=" << GetArtMethod()->PrettyMethod();
+ } else {
vios->Stream()
- << "InlineInfo[" << Row() + i << "]"
- << " (depth=" << i
- << std::hex
- << ", dex_pc=0x" << GetDexPcAtDepth(i);
- if (EncodesArtMethodAtDepth(i)) {
- ScopedObjectAccess soa(Thread::Current());
- vios->Stream() << ", method=" << GetArtMethodAtDepth(i)->PrettyMethod();
- } else {
- vios->Stream()
- << std::dec
- << ", method_index=" << GetMethodIndexAtDepth(method_info, i);
- }
- vios->Stream() << ")\n";
- if (number_of_dex_registers != nullptr) {
- uint16_t vregs = number_of_dex_registers[i];
- DumpDexRegisterMap(vios, code_info.GetDexRegisterMapAtDepth(i, *this, vregs));
- }
+ << std::dec
+ << ", 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));
}
}