From 6de8833fb64e59301eada4005ed04da995796170 Mon Sep 17 00:00:00 2001 From: David Srbecky Date: Sun, 3 Jun 2018 12:00:11 +0100 Subject: Delta-compress register maps in stack maps. The register maps tend to be similar from stack map to stack map, so instead of encoding them again, store only the modified ones. The dex register bitmap stores the delta now - if register has been modified since the previous stack map, the bit will be set. The decoding logic scans backwards through stack maps until it eventfully finds the most recent value of each register. This CL saves ~2.5% of .oat file size (~10% of stackmap size). Due to the scan, this makes dex register decoding slower by factor of 2.5, but that still beats the old algorithm before refactoring. Test: test-art-host-gtest-stack_map_test Change-Id: Id5217a329eb757954e0c9447f38b05ec34118f84 --- compiler/optimizing/stack_map_test.cc | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'compiler/optimizing/stack_map_test.cc') diff --git a/compiler/optimizing/stack_map_test.cc b/compiler/optimizing/stack_map_test.cc index 77aa3ef965..0be276cfd6 100644 --- a/compiler/optimizing/stack_map_test.cc +++ b/compiler/optimizing/stack_map_test.cc @@ -358,13 +358,6 @@ TEST(StackMapTest, TestDeduplicateInlineInfoDexRegisterMap) { ASSERT_EQ(Kind::kConstant, location1.GetKind()); ASSERT_EQ(0, location0.GetValue()); ASSERT_EQ(-2, location1.GetValue()); - - // 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.GetInlineInfoAtDepth(stack_map, 0); - EXPECT_EQ(inline_info.GetDexRegisterMapIndex(), - stack_map.GetDexRegisterMapIndex()); } } @@ -466,13 +459,9 @@ TEST(StackMapTest, TestShareDexRegisterMap) { ASSERT_EQ(2, dex_registers2.GetMachineRegister(0)); ASSERT_EQ(-2, dex_registers2.GetConstant(1)); - // Verify dex register map offsets. - ASSERT_EQ(sm0.GetDexRegisterMapIndex(), - sm1.GetDexRegisterMapIndex()); - ASSERT_NE(sm0.GetDexRegisterMapIndex(), - sm2.GetDexRegisterMapIndex()); - ASSERT_NE(sm1.GetDexRegisterMapIndex(), - sm2.GetDexRegisterMapIndex()); + // Verify dex register mask offsets. + ASSERT_FALSE(sm1.HasDexRegisterMaskIndex()); // No delta. + ASSERT_TRUE(sm2.HasDexRegisterMaskIndex()); // Has delta. } TEST(StackMapTest, TestNoDexRegisterMap) { @@ -649,8 +638,6 @@ TEST(StackMapTest, InlineTest) { ASSERT_EQ(80, dex_registers2.GetStackOffsetInBytes(0)); ASSERT_EQ(10, dex_registers2.GetConstant(1)); ASSERT_EQ(5, dex_registers2.GetMachineRegister(2)); - - ASSERT_FALSE(if1_2.HasDexRegisterMap()); } { @@ -682,8 +669,6 @@ TEST(StackMapTest, InlineTest) { ASSERT_EQ(10u, if2_2.GetDexPc()); ASSERT_TRUE(if2_2.EncodesArtMethod()); - ASSERT_FALSE(if2_0.HasDexRegisterMap()); - DexRegisterMap dex_registers1 = ci.GetDexRegisterMapAtDepth(1, sm3, 1); ASSERT_EQ(2, dex_registers1.GetMachineRegister(0)); -- cgit v1.2.3