summaryrefslogtreecommitdiffstats
path: root/oatdump
diff options
context:
space:
mode:
authorRoland Levillain <rpl@google.com>2015-03-12 15:25:29 +0000
committerRoland Levillain <rpl@google.com>2015-03-12 15:25:29 +0000
commita2d8ec6876325e89e5d82f5dbeca59f96ced3ec1 (patch)
tree65bf174b669ff3cd9694dc5a1124fb9f2225ade1 /oatdump
parent39d9fe2eb3552a002c53ed41701c6faffe3cd75a (diff)
downloadart-a2d8ec6876325e89e5d82f5dbeca59f96ced3ec1.zip
art-a2d8ec6876325e89e5d82f5dbeca59f96ced3ec1.tar.gz
art-a2d8ec6876325e89e5d82f5dbeca59f96ced3ec1.tar.bz2
Compress the Dex register maps built by the optimizing compiler.
- Replace the current list-based (fixed-size) Dex register encoding in stack maps emitted by the optimizing compiler with another list-based variable-size Dex register encoding compressing short locations on 1 byte (3 bits for the location kind, 5 bits for the value); other (large) values remain encoded on 5 bytes. - In addition, use slot offsets instead of byte offsets to encode the location of Dex registers placed in stack slots at small offsets, as it enables more values to use the short (1-byte wide) encoding instead of the large (5-byte wide) one. - Rename art::DexRegisterMap::LocationKind as art::DexRegisterLocation::Kind, turn it into a strongly-typed enum based on a uint8_t, and extend it to support new kinds (kInStackLargeOffset and kConstantLargeValue). - Move art::DexRegisterEntry from compiler/optimizing/stack_map_stream.h to runtime/stack_map.h and rename it as art::DexRegisterLocation. - Adjust art::StackMapStream, art::CodeGenerator::RecordPcInfo, art::CheckReferenceMapVisitor::CheckOptimizedMethod, art::StackVisitor::GetVRegFromOptimizedCode, and art::StackVisitor::SetVRegFromOptimizedCode. - Implement unaligned memory accesses in art::MemoryRegion. - Use them to manipulate data in Dex register maps. - Adjust oatdump to support the new Dex register encoding. - Update compiler/optimizing/stack_map_test.cc. Change-Id: Icefaa2e2b36b3c80bb1b882fe7ea2f77ba85c505
Diffstat (limited to 'oatdump')
-rw-r--r--oatdump/oatdump.cc45
1 files changed, 33 insertions, 12 deletions
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index aab4f8b..9ae3b79 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.