summaryrefslogtreecommitdiff
path: root/runtime/jit/jit_code_cache.cc
diff options
context:
space:
mode:
author Calin Juravle <calin@google.com> 2017-05-18 10:15:52 -0700
committer Calin Juravle <calin@google.com> 2017-05-23 13:29:45 -0700
commita39fd980000d10ee0b3a49555cc8bcbbfacde943 (patch)
treecad6936a2b618ec31fc7d5b724ff8f433b373e23 /runtime/jit/jit_code_cache.cc
parent0b183409d8dd2ed5a720eb28ad77c46bccd09247 (diff)
Record inline caches only for the strictly hot methods
Warm methods might have incomplete inline caches which could cause unnecessary deoptimizations. Test: m test-art-host Bug: 38426301 Bug: 38412648 Change-Id: I3023a2d462cb1bd291f7ea63bcf363a75d8f20a9
Diffstat (limited to 'runtime/jit/jit_code_cache.cc')
-rw-r--r--runtime/jit/jit_code_cache.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc
index 52322529c8..5ce54475d1 100644
--- a/runtime/jit/jit_code_cache.cc
+++ b/runtime/jit/jit_code_cache.cc
@@ -1269,6 +1269,7 @@ void JitCodeCache::GetProfiledMethods(const std::set<std::string>& dex_base_loca
std::vector<ProfileMethodInfo>& methods) {
ScopedTrace trace(__FUNCTION__);
MutexLock mu(Thread::Current(), lock_);
+ uint16_t jit_compile_threshold = Runtime::Current()->GetJITOptions()->GetCompileThreshold();
for (const ProfilingInfo* info : profiling_infos_) {
ArtMethod* method = info->GetMethod();
const DexFile* dex_file = method->GetDexFile();
@@ -1277,6 +1278,16 @@ void JitCodeCache::GetProfiledMethods(const std::set<std::string>& dex_base_loca
continue;
}
std::vector<ProfileMethodInfo::ProfileInlineCache> inline_caches;
+
+ // If the method didn't reach the compilation threshold don't save the inline caches.
+ // They might be incomplete and cause unnecessary deoptimizations.
+ // If the inline cache is empty the compiler will generate a regular invoke virtual/interface.
+ if (method->GetCounter() < jit_compile_threshold) {
+ methods.emplace_back(/*ProfileMethodInfo*/
+ dex_file, method->GetDexMethodIndex(), inline_caches);
+ continue;
+ }
+
for (size_t i = 0; i < info->number_of_inline_caches_; ++i) {
std::vector<ProfileMethodInfo::ProfileClassReference> profile_classes;
const InlineCache& cache = info->cache_[i];