summaryrefslogtreecommitdiff
path: root/oatdump/oatdump.cc
diff options
context:
space:
mode:
Diffstat (limited to 'oatdump/oatdump.cc')
-rw-r--r--oatdump/oatdump.cc45
1 files changed, 33 insertions, 12 deletions
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index aab4f8bc0c..9ae3b79f62 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -1039,6 +1039,33 @@ class OatDumper {
}
}
+ void DumpRegisterMapping(std::ostream& os,
+ size_t dex_register_num,
+ DexRegisterLocation::Kind kind,
+ int32_t value,
+ const std::string& prefix = "v",
+ const std::string& suffix = "") {
+ os << " " << prefix << dex_register_num << ": "
+ << DexRegisterLocation::PrettyDescriptor(kind)
+ << " (" << value << ")" << suffix << '\n';
+ }
+
+ void DumpStackMapHeader(std::ostream& os, const CodeInfo& code_info, size_t stack_map_num) {
+ StackMap stack_map = code_info.GetStackMapAt(stack_map_num);
+ os << " StackMap " << stack_map_num
+ << std::hex
+ << " (dex_pc=0x" << stack_map.GetDexPc()
+ << ", native_pc_offset=0x" << stack_map.GetNativePcOffset()
+ << ", register_mask=0x" << stack_map.GetRegisterMask()
+ << std::dec
+ << ", stack_mask=0b";
+ MemoryRegion stack_mask = stack_map.GetStackMask();
+ for (size_t i = 0, e = stack_mask.size_in_bits(); i < e; ++i) {
+ os << stack_mask.LoadBit(e - i - 1);
+ }
+ os << ")\n";
+ };
+
// Display a CodeInfo object emitted by the optimizing compiler.
void DumpCodeInfo(std::ostream& os,
const CodeInfo& code_info,
@@ -1049,27 +1076,21 @@ class OatDumper {
os << " Optimized CodeInfo (size=" << code_info_size
<< ", number_of_dex_registers=" << number_of_dex_registers
<< ", number_of_stack_maps=" << number_of_stack_maps << ")\n";
+
+ // Display stack maps along with Dex register maps.
for (size_t i = 0; i < number_of_stack_maps; ++i) {
StackMap stack_map = code_info.GetStackMapAt(i);
- // TODO: Display stack_mask value.
- os << " StackMap " << i
- << std::hex
- << " (dex_pc=0x" << stack_map.GetDexPc()
- << ", native_pc_offset=0x" << stack_map.GetNativePcOffset()
- << ", register_mask=0x" << stack_map.GetRegisterMask()
- << std::dec
- << ")\n";
+ DumpStackMapHeader(os, code_info, i);
if (stack_map.HasDexRegisterMap()) {
DexRegisterMap dex_register_map =
code_info.GetDexRegisterMapOf(stack_map, number_of_dex_registers);
for (size_t j = 0; j < number_of_dex_registers; ++j) {
- os << " v" << j << ": "
- << DexRegisterMap::PrettyDescriptor(dex_register_map.GetLocationKind(j))
- << " (" << dex_register_map.GetValue(j) << ")\n";
+ DexRegisterLocation location = dex_register_map.GetLocationKindAndValue(j);
+ DumpRegisterMapping(os, j, location.GetInternalKind(), location.GetValue());
}
}
- // TODO: Display more information from code_info.
}
+ // TODO: Dump the stack map's inline information.
}
// Display a vmap table.