summaryrefslogtreecommitdiff
path: root/compiler/optimizing/stack_map_stream.cc
diff options
context:
space:
mode:
author David Srbecky <dsrbecky@google.com> 2018-06-13 18:55:35 +0100
committer David Srbecky <dsrbecky@google.com> 2018-06-13 19:03:09 +0100
commit50fac06c51864f293c61ff9d0983b82698cf6dac (patch)
tree7f7d09fa8aeacf4b5a255085af02970347a54cd0 /compiler/optimizing/stack_map_stream.cc
parent86decb6a3e3ebba8c3c67bfd25c12d9a85794f65 (diff)
Add Kind column to stack maps.
Add 'Kind' column to stack maps which marks special stack map types, and use it at run-time to add extra sanity checks. It will also allow us to binary search the stack maps. The column increases .oat file by 0.2%. Test: test-art-host-gtest-stack_map_test Change-Id: I2a9143afa0e32bb06174604ca81a64c41fed232f
Diffstat (limited to 'compiler/optimizing/stack_map_stream.cc')
-rw-r--r--compiler/optimizing/stack_map_stream.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/optimizing/stack_map_stream.cc b/compiler/optimizing/stack_map_stream.cc
index 094b75de69..cd115499a6 100644
--- a/compiler/optimizing/stack_map_stream.cc
+++ b/compiler/optimizing/stack_map_stream.cc
@@ -43,7 +43,8 @@ void StackMapStream::BeginStackMapEntry(uint32_t dex_pc,
uint32_t register_mask,
BitVector* stack_mask,
uint32_t num_dex_registers,
- uint8_t inlining_depth) {
+ uint8_t inlining_depth,
+ StackMap::Kind kind) {
DCHECK(!in_stack_map_) << "Mismatched Begin/End calls";
in_stack_map_ = true;
// num_dex_registers_ is the constant per-method number of registers.
@@ -55,6 +56,7 @@ void StackMapStream::BeginStackMapEntry(uint32_t dex_pc,
}
current_stack_map_ = StackMapEntry {
+ .kind = static_cast<uint32_t>(kind),
.packed_native_pc = StackMap::PackNativePc(native_pc_offset, instruction_set_),
.dex_pc = dex_pc,
.register_mask_index = kNoValue,
@@ -81,8 +83,17 @@ void StackMapStream::BeginStackMapEntry(uint32_t dex_pc,
// Create lambda method, which will be executed at the very end to verify data.
// Parameters and local variables will be captured(stored) by the lambda "[=]".
dchecks_.emplace_back([=](const CodeInfo& code_info) {
+ if (kind == StackMap::Kind::Default || kind == StackMap::Kind::OSR) {
+ StackMap stack_map = code_info.GetStackMapForNativePcOffset(native_pc_offset,
+ instruction_set_);
+ CHECK_EQ(stack_map.Row(), stack_map_index);
+ } else if (kind == StackMap::Kind::Catch) {
+ StackMap stack_map = code_info.GetCatchStackMapForDexPc(dex_pc);
+ CHECK_EQ(stack_map.Row(), stack_map_index);
+ }
StackMap stack_map = code_info.GetStackMapAt(stack_map_index);
CHECK_EQ(stack_map.GetNativePcOffset(instruction_set_), native_pc_offset);
+ CHECK_EQ(stack_map.GetKind(), static_cast<uint32_t>(kind));
CHECK_EQ(stack_map.GetDexPc(), dex_pc);
CHECK_EQ(code_info.GetRegisterMaskOf(stack_map), register_mask);
BitMemoryRegion seen_stack_mask = code_info.GetStackMaskOf(stack_map);