Cache stack map encoding
Operations on CodeInfo and StackMap objects repeatedly read encoding
information from the MemoryRegion. Since these are 3-bit-loads of
values that never change, caching them can measurably reduce compile
times.
According to benchmarks, this patch saves 1-3% on armv7, 2-4% on x86,
and 0-1% on x64.
Change-Id: I46b197513601325d8bab562cc80100c00ec28a3b
diff --git a/runtime/art_method.cc b/runtime/art_method.cc
index 349013c..fe26438 100644
--- a/runtime/art_method.cc
+++ b/runtime/art_method.cc
@@ -182,9 +182,10 @@
uint32_t sought_offset = pc - reinterpret_cast<uintptr_t>(entry_point);
if (IsOptimized(sizeof(void*))) {
CodeInfo code_info = GetOptimizedCodeInfo();
- StackMap stack_map = code_info.GetStackMapForNativePcOffset(sought_offset);
+ StackMapEncoding encoding = code_info.ExtractEncoding();
+ StackMap stack_map = code_info.GetStackMapForNativePcOffset(sought_offset, encoding);
if (stack_map.IsValid()) {
- return stack_map.GetDexPc(code_info);
+ return stack_map.GetDexPc(encoding);
}
} else {
MappingTable table(entry_point != nullptr ?