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/oatdump/oatdump.cc b/oatdump/oatdump.cc
index e039d10..96d5654 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -1346,9 +1346,11 @@
const void* raw_code_info = oat_method.GetVmapTable();
if (raw_code_info != nullptr) {
CodeInfo code_info(raw_code_info);
- StackMap stack_map = code_info.GetStackMapForNativePcOffset(offset);
+ StackMapEncoding encoding = code_info.ExtractEncoding();
+ StackMap stack_map = code_info.GetStackMapForNativePcOffset(offset, encoding);
if (stack_map.IsValid()) {
- stack_map.Dump(os, code_info, oat_method.GetCodeOffset(), code_item->registers_size_);
+ stack_map.Dump(
+ os, code_info, encoding, oat_method.GetCodeOffset(), code_item->registers_size_);
}
}
}