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_stream.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'compiler/optimizing/stack_map_stream.h') diff --git a/compiler/optimizing/stack_map_stream.h b/compiler/optimizing/stack_map_stream.h index d634c703ff..02fb6cb434 100644 --- a/compiler/optimizing/stack_map_stream.h +++ b/compiler/optimizing/stack_map_stream.h @@ -55,6 +55,8 @@ class StackMapStream : public ValueObject { in_inline_info_(false), current_inline_infos_(allocator->Adapter(kArenaAllocStackMapStream)), current_dex_registers_(allocator->Adapter(kArenaAllocStackMapStream)), + previous_dex_registers_(allocator->Adapter(kArenaAllocStackMapStream)), + dex_register_timestamp_(allocator->Adapter(kArenaAllocStackMapStream)), temp_dex_register_mask_(allocator, 32, true, kArenaAllocStackMapStream), temp_dex_register_map_(allocator->Adapter(kArenaAllocStackMapStream)) { } @@ -113,8 +115,7 @@ class StackMapStream : public ValueObject { uint32_t method_info_index; uint32_t art_method_hi; uint32_t art_method_lo; - uint32_t dex_register_mask_index; - uint32_t dex_register_map_index; + uint32_t num_dex_registers; }; // The fields must be uint32_t and mirror the InvokeInfo accessor in stack_map.h! @@ -147,6 +148,7 @@ class StackMapStream : public ValueObject { BitmapTableBuilder dex_register_masks_; BitTableBuilder dex_register_maps_; BitTableBuilder dex_register_catalog_; + uint32_t num_dex_registers_ = 0; // TODO: Make this const and get the value in constructor. ScopedArenaVector out_; BitTableBuilder method_infos_; @@ -159,6 +161,8 @@ class StackMapStream : public ValueObject { StackMapEntry current_stack_map_; ScopedArenaVector current_inline_infos_; ScopedArenaVector current_dex_registers_; + ScopedArenaVector previous_dex_registers_; + ScopedArenaVector dex_register_timestamp_; // Stack map index of last change. size_t expected_num_dex_registers_; // Temporary variables used in CreateDexRegisterMap. -- cgit v1.2.3-59-g8ed1b