summaryrefslogtreecommitdiffstats
path: root/runtime/check_reference_map_visitor.h
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 /runtime/check_reference_map_visitor.h
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 'runtime/check_reference_map_visitor.h')
-rw-r--r--runtime/check_reference_map_visitor.h27
1 files changed, 16 insertions, 11 deletions
diff --git a/runtime/check_reference_map_visitor.h b/runtime/check_reference_map_visitor.h
index 93062a7..893ab11 100644
--- a/runtime/check_reference_map_visitor.h
+++ b/runtime/check_reference_map_visitor.h
@@ -66,31 +66,36 @@ class CheckReferenceMapVisitor : public StackVisitor {
mirror::ArtMethod* m = GetMethod();
CodeInfo code_info = m->GetOptimizedCodeInfo();
StackMap stack_map = code_info.GetStackMapForNativePcOffset(native_pc_offset);
- DexRegisterMap dex_register_map = code_info.GetDexRegisterMapOf(stack_map, m->GetCodeItem()->registers_size_);
+ DexRegisterMap dex_register_map =
+ code_info.GetDexRegisterMapOf(stack_map, m->GetCodeItem()->registers_size_);
MemoryRegion stack_mask = stack_map.GetStackMask();
uint32_t register_mask = stack_map.GetRegisterMask();
for (int i = 0; i < number_of_references; ++i) {
int reg = registers[i];
CHECK(reg < m->GetCodeItem()->registers_size_);
- DexRegisterMap::LocationKind location = dex_register_map.GetLocationKind(reg);
- switch (location) {
- case DexRegisterMap::kNone:
+ DexRegisterLocation location = dex_register_map.GetLocationKindAndValue(reg);
+ switch (location.GetKind()) {
+ case DexRegisterLocation::Kind::kNone:
// Not set, should not be a reference.
CHECK(false);
break;
- case DexRegisterMap::kInStack:
- CHECK(stack_mask.LoadBit(dex_register_map.GetValue(reg) >> 2));
+ case DexRegisterLocation::Kind::kInStack:
+ DCHECK_EQ(location.GetValue() % kFrameSlotSize, 0);
+ CHECK(stack_mask.LoadBit(location.GetValue() / kFrameSlotSize));
break;
- case DexRegisterMap::kInRegister:
- CHECK_NE(register_mask & (1 << dex_register_map.GetValue(reg)), 0u);
+ case DexRegisterLocation::Kind::kInRegister:
+ CHECK_NE(register_mask & (1 << location.GetValue()), 0u);
break;
- case DexRegisterMap::kInFpuRegister:
+ case DexRegisterLocation::Kind::kInFpuRegister:
// In Fpu register, should not be a reference.
CHECK(false);
break;
- case DexRegisterMap::kConstant:
- CHECK_EQ(dex_register_map.GetValue(reg), 0);
+ case DexRegisterLocation::Kind::kConstant:
+ CHECK_EQ(location.GetValue(), 0);
break;
+ default:
+ LOG(FATAL) << "Unexpected location kind"
+ << DexRegisterLocation::PrettyDescriptor(location.GetInternalKind());
}
}
}