summaryrefslogtreecommitdiff
path: root/runtime/quick_exception_handler.cc
diff options
context:
space:
mode:
authorDavid Srbecky <dsrbecky@google.com>2016-02-12 21:58:43 +0000
committerDavid Srbecky <dsrbecky@google.com>2016-03-31 22:12:07 +0100
commit09ed09866da6d8c7448ef297c148bfa577a247c2 (patch)
treedad6a5dae6ca6131f1eba201eaa371edc6d9929d /runtime/quick_exception_handler.cc
parente28ad4b91591c226ed404a2b01104bb99bfeb28f (diff)
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
Diffstat (limited to 'runtime/quick_exception_handler.cc')
-rw-r--r--runtime/quick_exception_handler.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/runtime/quick_exception_handler.cc b/runtime/quick_exception_handler.cc
index 6317f5e401..b9cd67786a 100644
--- a/runtime/quick_exception_handler.cc
+++ b/runtime/quick_exception_handler.cc
@@ -220,7 +220,7 @@ void QuickExceptionHandler::SetCatchEnvironmentForOptimizedHandler(StackVisitor*
const size_t number_of_vregs = handler_method_->GetCodeItem()->registers_size_;
CodeInfo code_info = handler_method_header_->GetOptimizedCodeInfo();
- StackMapEncoding encoding = code_info.ExtractEncoding();
+ CodeInfoEncoding encoding = code_info.ExtractEncoding();
// Find stack map of the catch block.
StackMap catch_stack_map = code_info.GetCatchStackMapForDexPc(GetHandlerDexPc(), encoding);
@@ -386,11 +386,10 @@ class DeoptimizeStackVisitor FINAL : public StackVisitor {
const OatQuickMethodHeader* method_header = GetCurrentOatQuickMethodHeader();
CodeInfo code_info = method_header->GetOptimizedCodeInfo();
uintptr_t native_pc_offset = method_header->NativeQuickPcOffset(GetCurrentQuickFramePc());
- StackMapEncoding encoding = code_info.ExtractEncoding();
+ CodeInfoEncoding encoding = code_info.ExtractEncoding();
StackMap stack_map = code_info.GetStackMapForNativePcOffset(native_pc_offset, encoding);
const size_t number_of_vregs = m->GetCodeItem()->registers_size_;
- MemoryRegion stack_mask = stack_map.GetStackMask(encoding);
- uint32_t register_mask = stack_map.GetRegisterMask(encoding);
+ uint32_t register_mask = stack_map.GetRegisterMask(encoding.stack_map_encoding);
DexRegisterMap vreg_map = IsInInlinedFrame()
? code_info.GetDexRegisterMapAtDepth(GetCurrentInliningDepth() - 1,
code_info.GetInlineInfoOf(stack_map, encoding),
@@ -423,7 +422,8 @@ class DeoptimizeStackVisitor FINAL : public StackVisitor {
const uint8_t* addr = reinterpret_cast<const uint8_t*>(GetCurrentQuickFrame()) + offset;
value = *reinterpret_cast<const uint32_t*>(addr);
uint32_t bit = (offset >> 2);
- if (stack_mask.size_in_bits() > bit && stack_mask.LoadBit(bit)) {
+ if (stack_map.GetNumberOfStackMaskBits(encoding.stack_map_encoding) > bit &&
+ stack_map.GetStackMaskBit(encoding.stack_map_encoding, bit)) {
is_reference = true;
}
break;