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 --- runtime/stack.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'runtime/stack.cc') diff --git a/runtime/stack.cc b/runtime/stack.cc index ee5da8e150..838678b08c 100644 --- a/runtime/stack.cc +++ b/runtime/stack.cc @@ -117,7 +117,7 @@ InlineInfo StackVisitor::GetCurrentInlineInfo() const { const OatQuickMethodHeader* method_header = GetCurrentOatQuickMethodHeader(); uint32_t native_pc_offset = method_header->NativeQuickPcOffset(cur_quick_frame_pc_); CodeInfo code_info = method_header->GetOptimizedCodeInfo(); - StackMapEncoding encoding = code_info.ExtractEncoding(); + CodeInfoEncoding encoding = code_info.ExtractEncoding(); StackMap stack_map = code_info.GetStackMapForNativePcOffset(native_pc_offset, encoding); DCHECK(stack_map.IsValid()); return code_info.GetInlineInfoOf(stack_map, encoding); @@ -308,7 +308,7 @@ bool StackVisitor::GetVRegFromOptimizedCode(ArtMethod* m, uint16_t vreg, VRegKin DCHECK_LT(vreg, code_item->registers_size_); const OatQuickMethodHeader* method_header = GetCurrentOatQuickMethodHeader(); CodeInfo code_info = method_header->GetOptimizedCodeInfo(); - StackMapEncoding encoding = code_info.ExtractEncoding(); + CodeInfoEncoding encoding = code_info.ExtractEncoding(); uint32_t native_pc_offset = method_header->NativeQuickPcOffset(cur_quick_frame_pc_); StackMap stack_map = code_info.GetStackMapForNativePcOffset(native_pc_offset, encoding); @@ -863,11 +863,11 @@ void StackVisitor::WalkStack(bool include_transitions) { && (cur_oat_quick_method_header_ != nullptr) && cur_oat_quick_method_header_->IsOptimized()) { CodeInfo code_info = cur_oat_quick_method_header_->GetOptimizedCodeInfo(); - StackMapEncoding encoding = code_info.ExtractEncoding(); + CodeInfoEncoding encoding = code_info.ExtractEncoding(); uint32_t native_pc_offset = cur_oat_quick_method_header_->NativeQuickPcOffset(cur_quick_frame_pc_); StackMap stack_map = code_info.GetStackMapForNativePcOffset(native_pc_offset, encoding); - if (stack_map.IsValid() && stack_map.HasInlineInfo(encoding)) { + if (stack_map.IsValid() && stack_map.HasInlineInfo(encoding.stack_map_encoding)) { InlineInfo inline_info = code_info.GetInlineInfoOf(stack_map, encoding); DCHECK_EQ(current_inlining_depth_, 0u); for (current_inlining_depth_ = inline_info.GetDepth(); -- cgit v1.2.3-59-g8ed1b