Implement shared counters for boot image / zygote methods.
Add a thread-local counter which the interpreter increments. When
hitting zero, the interpreter goes into the runtime and updates a map of
counters. If the counter for the particular method hits a threshold, we
JIT it.
Test: test.py
Test: imgdiag looking at boot.art
Bug: 162110941
Change-Id: I6493332eafc51856494ef20592ca83bc716c994e
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 3f0de3b..7f2d926 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -3751,6 +3751,10 @@
std::none_of(shorty.begin() + slow_args_search_start, shorty.end(), is_slow_arg))) {
dst->SetNterpInvokeFastPathFlag();
}
+
+ if (Runtime::Current()->IsZygote()) {
+ dst->SetMemorySharedMethod();
+ }
}
void ClassLinker::AppendToBootClassPath(Thread* self, const DexFile* dex_file) {