summaryrefslogtreecommitdiff
path: root/compiler/optimizing
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/optimizing')
-rw-r--r--compiler/optimizing/stack_map_stream.cc20
-rw-r--r--compiler/optimizing/stack_map_test.cc84
2 files changed, 53 insertions, 51 deletions
diff --git a/compiler/optimizing/stack_map_stream.cc b/compiler/optimizing/stack_map_stream.cc
index 7a60d4aa20..d80e2fc0e3 100644
--- a/compiler/optimizing/stack_map_stream.cc
+++ b/compiler/optimizing/stack_map_stream.cc
@@ -84,9 +84,7 @@ void StackMapStream::BeginStackMapEntry(uint32_t dex_pc,
CHECK_EQ(seen_stack_mask.LoadBit(b), stack_mask != nullptr && stack_mask->IsBitSet(b));
}
CHECK_EQ(stack_map.HasInlineInfo(), (inlining_depth != 0));
- if (inlining_depth != 0) {
- CHECK_EQ(code_info.GetInlineInfoOf(stack_map).GetDepth(), inlining_depth);
- }
+ CHECK_EQ(code_info.GetInlineDepthOf(stack_map), inlining_depth);
CHECK_EQ(stack_map.HasDexRegisterMap(), (num_dex_registers != 0));
});
}
@@ -174,17 +172,17 @@ void StackMapStream::BeginInlineInfoEntry(ArtMethod* method,
size_t depth = current_inline_infos_.size() - 1;
dchecks_.emplace_back([=](const CodeInfo& code_info) {
StackMap stack_map = code_info.GetStackMapAt(stack_map_index);
- InlineInfo inline_info = code_info.GetInlineInfoOf(stack_map);
- CHECK_EQ(inline_info.GetDexPcAtDepth(depth), dex_pc);
+ InlineInfo inline_info = code_info.GetInlineInfoAtDepth(stack_map, depth);
+ CHECK_EQ(inline_info.GetDexPc(), dex_pc);
bool encode_art_method = EncodeArtMethodInInlineInfo(method);
- CHECK_EQ(inline_info.EncodesArtMethodAtDepth(depth), encode_art_method);
+ CHECK_EQ(inline_info.EncodesArtMethod(), encode_art_method);
if (encode_art_method) {
- CHECK_EQ(inline_info.GetArtMethodAtDepth(depth), method);
+ CHECK_EQ(inline_info.GetArtMethod(), method);
} else {
- CHECK_EQ(method_infos_[inline_info.GetMethodIndexIdxAtDepth(depth)],
+ CHECK_EQ(method_infos_[inline_info.GetMethodIndexIdx()],
method->GetDexMethodIndexUnchecked());
}
- CHECK_EQ(inline_info.HasDexRegisterMapAtDepth(depth), (num_dex_registers != 0));
+ CHECK_EQ(inline_info.HasDexRegisterMap(), (num_dex_registers != 0));
});
}
}
@@ -240,9 +238,7 @@ void StackMapStream::CreateDexRegisterMap() {
size_t num_dex_registers = expected_dex_registers->size();
DexRegisterMap map = (depth == -1)
? code_info.GetDexRegisterMapOf(stack_map, num_dex_registers)
- : code_info.GetDexRegisterMapAtDepth(depth,
- code_info.GetInlineInfoOf(stack_map),
- num_dex_registers);
+ : code_info.GetDexRegisterMapAtDepth(depth, stack_map, num_dex_registers);
CHECK_EQ(map.size(), num_dex_registers);
for (size_t r = 0; r < num_dex_registers; r++) {
CHECK_EQ(expected_dex_registers->at(r), map.Get(r));
diff --git a/compiler/optimizing/stack_map_test.cc b/compiler/optimizing/stack_map_test.cc
index 262c240bc7..77aa3ef965 100644
--- a/compiler/optimizing/stack_map_test.cc
+++ b/compiler/optimizing/stack_map_test.cc
@@ -189,12 +189,13 @@ TEST(StackMapTest, Test2) {
ASSERT_EQ(-2, location1.GetValue());
ASSERT_TRUE(stack_map.HasInlineInfo());
- InlineInfo inline_info = code_info.GetInlineInfoOf(stack_map);
- ASSERT_EQ(2u, inline_info.GetDepth());
- ASSERT_EQ(3u, inline_info.GetDexPcAtDepth(0));
- ASSERT_EQ(2u, inline_info.GetDexPcAtDepth(1));
- ASSERT_TRUE(inline_info.EncodesArtMethodAtDepth(0));
- ASSERT_TRUE(inline_info.EncodesArtMethodAtDepth(1));
+ InlineInfo inline_info0 = code_info.GetInlineInfoAtDepth(stack_map, 0);
+ InlineInfo inline_info1 = code_info.GetInlineInfoAtDepth(stack_map, 1);
+ ASSERT_EQ(2u, code_info.GetInlineDepthOf(stack_map));
+ ASSERT_EQ(3u, inline_info0.GetDexPc());
+ ASSERT_EQ(2u, inline_info1.GetDexPc());
+ ASSERT_TRUE(inline_info0.EncodesArtMethod());
+ ASSERT_TRUE(inline_info1.EncodesArtMethod());
}
// Second stack map.
@@ -361,8 +362,8 @@ TEST(StackMapTest, TestDeduplicateInlineInfoDexRegisterMap) {
// Test that the inline info dex register map deduplicated to the same offset as the stack map
// one.
ASSERT_TRUE(stack_map.HasInlineInfo());
- InlineInfo inline_info = code_info.GetInlineInfoOf(stack_map);
- EXPECT_EQ(inline_info.GetDexRegisterMapIndexAtDepth(0),
+ InlineInfo inline_info = code_info.GetInlineInfoAtDepth(stack_map, 0);
+ EXPECT_EQ(inline_info.GetDexRegisterMapIndex(),
stack_map.GetDexRegisterMapIndex());
}
}
@@ -605,17 +606,18 @@ TEST(StackMapTest, InlineTest) {
ASSERT_EQ(0, dex_registers0.GetStackOffsetInBytes(0));
ASSERT_EQ(4, dex_registers0.GetConstant(1));
- InlineInfo if0 = ci.GetInlineInfoOf(sm0);
- ASSERT_EQ(2u, if0.GetDepth());
- ASSERT_EQ(2u, if0.GetDexPcAtDepth(0));
- ASSERT_TRUE(if0.EncodesArtMethodAtDepth(0));
- ASSERT_EQ(3u, if0.GetDexPcAtDepth(1));
- ASSERT_TRUE(if0.EncodesArtMethodAtDepth(1));
+ InlineInfo if0_0 = ci.GetInlineInfoAtDepth(sm0, 0);
+ InlineInfo if0_1 = ci.GetInlineInfoAtDepth(sm0, 1);
+ ASSERT_EQ(2u, ci.GetInlineDepthOf(sm0));
+ ASSERT_EQ(2u, if0_0.GetDexPc());
+ ASSERT_TRUE(if0_0.EncodesArtMethod());
+ ASSERT_EQ(3u, if0_1.GetDexPc());
+ ASSERT_TRUE(if0_1.EncodesArtMethod());
- DexRegisterMap dex_registers1 = ci.GetDexRegisterMapAtDepth(0, if0, 1);
+ DexRegisterMap dex_registers1 = ci.GetDexRegisterMapAtDepth(0, sm0, 1);
ASSERT_EQ(8, dex_registers1.GetStackOffsetInBytes(0));
- DexRegisterMap dex_registers2 = ci.GetDexRegisterMapAtDepth(1, if0, 3);
+ DexRegisterMap dex_registers2 = ci.GetDexRegisterMapAtDepth(1, sm0, 3);
ASSERT_EQ(16, dex_registers2.GetStackOffsetInBytes(0));
ASSERT_EQ(20, dex_registers2.GetConstant(1));
ASSERT_EQ(15, dex_registers2.GetMachineRegister(2));
@@ -629,24 +631,26 @@ TEST(StackMapTest, InlineTest) {
ASSERT_EQ(56, dex_registers0.GetStackOffsetInBytes(0));
ASSERT_EQ(0, dex_registers0.GetConstant(1));
- InlineInfo if1 = ci.GetInlineInfoOf(sm1);
- ASSERT_EQ(3u, if1.GetDepth());
- ASSERT_EQ(2u, if1.GetDexPcAtDepth(0));
- ASSERT_TRUE(if1.EncodesArtMethodAtDepth(0));
- ASSERT_EQ(3u, if1.GetDexPcAtDepth(1));
- ASSERT_TRUE(if1.EncodesArtMethodAtDepth(1));
- ASSERT_EQ(5u, if1.GetDexPcAtDepth(2));
- ASSERT_TRUE(if1.EncodesArtMethodAtDepth(2));
-
- DexRegisterMap dex_registers1 = ci.GetDexRegisterMapAtDepth(0, if1, 1);
+ InlineInfo if1_0 = ci.GetInlineInfoAtDepth(sm1, 0);
+ InlineInfo if1_1 = ci.GetInlineInfoAtDepth(sm1, 1);
+ InlineInfo if1_2 = ci.GetInlineInfoAtDepth(sm1, 2);
+ ASSERT_EQ(3u, ci.GetInlineDepthOf(sm1));
+ ASSERT_EQ(2u, if1_0.GetDexPc());
+ ASSERT_TRUE(if1_0.EncodesArtMethod());
+ ASSERT_EQ(3u, if1_1.GetDexPc());
+ ASSERT_TRUE(if1_1.EncodesArtMethod());
+ ASSERT_EQ(5u, if1_2.GetDexPc());
+ ASSERT_TRUE(if1_2.EncodesArtMethod());
+
+ DexRegisterMap dex_registers1 = ci.GetDexRegisterMapAtDepth(0, sm1, 1);
ASSERT_EQ(12, dex_registers1.GetStackOffsetInBytes(0));
- DexRegisterMap dex_registers2 = ci.GetDexRegisterMapAtDepth(1, if1, 3);
+ DexRegisterMap dex_registers2 = ci.GetDexRegisterMapAtDepth(1, sm1, 3);
ASSERT_EQ(80, dex_registers2.GetStackOffsetInBytes(0));
ASSERT_EQ(10, dex_registers2.GetConstant(1));
ASSERT_EQ(5, dex_registers2.GetMachineRegister(2));
- ASSERT_FALSE(if1.HasDexRegisterMapAtDepth(2));
+ ASSERT_FALSE(if1_2.HasDexRegisterMap());
}
{
@@ -667,21 +671,23 @@ TEST(StackMapTest, InlineTest) {
ASSERT_EQ(56, dex_registers0.GetStackOffsetInBytes(0));
ASSERT_EQ(0, dex_registers0.GetConstant(1));
- InlineInfo if2 = ci.GetInlineInfoOf(sm3);
- ASSERT_EQ(3u, if2.GetDepth());
- ASSERT_EQ(2u, if2.GetDexPcAtDepth(0));
- ASSERT_TRUE(if2.EncodesArtMethodAtDepth(0));
- ASSERT_EQ(5u, if2.GetDexPcAtDepth(1));
- ASSERT_TRUE(if2.EncodesArtMethodAtDepth(1));
- ASSERT_EQ(10u, if2.GetDexPcAtDepth(2));
- ASSERT_TRUE(if2.EncodesArtMethodAtDepth(2));
+ InlineInfo if2_0 = ci.GetInlineInfoAtDepth(sm3, 0);
+ InlineInfo if2_1 = ci.GetInlineInfoAtDepth(sm3, 1);
+ InlineInfo if2_2 = ci.GetInlineInfoAtDepth(sm3, 2);
+ ASSERT_EQ(3u, ci.GetInlineDepthOf(sm3));
+ ASSERT_EQ(2u, if2_0.GetDexPc());
+ ASSERT_TRUE(if2_0.EncodesArtMethod());
+ ASSERT_EQ(5u, if2_1.GetDexPc());
+ ASSERT_TRUE(if2_1.EncodesArtMethod());
+ ASSERT_EQ(10u, if2_2.GetDexPc());
+ ASSERT_TRUE(if2_2.EncodesArtMethod());
- ASSERT_FALSE(if2.HasDexRegisterMapAtDepth(0));
+ ASSERT_FALSE(if2_0.HasDexRegisterMap());
- DexRegisterMap dex_registers1 = ci.GetDexRegisterMapAtDepth(1, if2, 1);
+ DexRegisterMap dex_registers1 = ci.GetDexRegisterMapAtDepth(1, sm3, 1);
ASSERT_EQ(2, dex_registers1.GetMachineRegister(0));
- DexRegisterMap dex_registers2 = ci.GetDexRegisterMapAtDepth(2, if2, 2);
+ DexRegisterMap dex_registers2 = ci.GetDexRegisterMapAtDepth(2, sm3, 2);
ASSERT_FALSE(dex_registers2.IsDexRegisterLive(0));
ASSERT_EQ(3, dex_registers2.GetMachineRegister(1));
}