From 09ed09866da6d8c7448ef297c148bfa577a247c2 Mon Sep 17 00:00:00 2001 From: David Srbecky Date: Fri, 12 Feb 2016 21:58:43 +0000 Subject: Pack stack map entries on bit level to save space. Use only the minimum number of bits required to store stack map data. For example, if native_pc needs 5 bits and dex_pc needs 3 bits, they will share the first byte of the stack map entry. The header is changed to store bit offsets of the fields rather than byte sizes. Offsets also make it easier to access later fields without calculating sum of all previous sizes. All of the header fields are byte sized or encoded as ULEB128 instead of the previous fixed size encoding. This shrinks it by about half. It saves 3.6 MB from non-debuggable boot.oat (AOSP). It saves 3.1 MB from debuggable boot.oat (AOSP). It saves 2.8 MB (of 99.4 MB) from /system/framework/arm/ (GOOG). It saves 1.0 MB (of 27.8 MB) from /system/framework/oat/arm/ (GOOG). Field loads from stackmaps seem to get around 10% faster. (based on the time it takes to load all stackmap entries from boot.oat) Bug: 27640410 Change-Id: I8bf0996b4eb24300c1b0dfc6e9d99fe85d04a1b7 --- compiler/optimizing/stack_map_stream.h | 7 +++---- 1 file changed, 3 insertions(+), 4 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 016a911424..b686748802 100644 --- a/compiler/optimizing/stack_map_stream.h +++ b/compiler/optimizing/stack_map_stream.h @@ -74,13 +74,12 @@ class StackMapStream : public ValueObject { allocator->Adapter(kArenaAllocStackMapStream)), current_entry_(), current_inline_info_(), - stack_mask_size_(0), + code_info_encoding_(allocator->Adapter(kArenaAllocStackMapStream)), inline_info_size_(0), dex_register_maps_size_(0), stack_maps_size_(0), dex_register_location_catalog_size_(0), dex_register_location_catalog_start_(0), - stack_maps_start_(0), dex_register_maps_start_(0), inline_infos_start_(0), needed_size_(0), @@ -90,6 +89,7 @@ class StackMapStream : public ValueObject { location_catalog_entries_.reserve(4); dex_register_locations_.reserve(10 * 4); inline_infos_.reserve(2); + code_info_encoding_.reserve(16); } // See runtime/stack_map.h to know what these fields contain. @@ -200,13 +200,12 @@ class StackMapStream : public ValueObject { StackMapEntry current_entry_; InlineInfoEntry current_inline_info_; StackMapEncoding stack_map_encoding_; - size_t stack_mask_size_; + ArenaVector code_info_encoding_; size_t inline_info_size_; size_t dex_register_maps_size_; size_t stack_maps_size_; size_t dex_register_location_catalog_size_; size_t dex_register_location_catalog_start_; - size_t stack_maps_start_; size_t dex_register_maps_start_; size_t inline_infos_start_; size_t needed_size_; -- cgit v1.2.3-59-g8ed1b