diff options
Diffstat (limited to 'runtime/jit/jit_code_cache.cc')
-rw-r--r-- | runtime/jit/jit_code_cache.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc index 4f59930806..4e3cf40ac3 100644 --- a/runtime/jit/jit_code_cache.cc +++ b/runtime/jit/jit_code_cache.cc @@ -1476,7 +1476,8 @@ void* JitCodeCache::MoreCore(const void* mspace, intptr_t increment) { } void JitCodeCache::GetProfiledMethods(const std::set<std::string>& dex_base_locations, - std::vector<ProfileMethodInfo>& methods) { + std::vector<ProfileMethodInfo>& methods, + uint16_t inline_cache_threshold) { Thread* self = Thread::Current(); WaitUntilInlineCacheAccessible(self); // TODO: Avoid read barriers for potentially dead methods. @@ -1495,13 +1496,17 @@ void JitCodeCache::GetProfiledMethods(const std::set<std::string>& dex_base_loca } std::vector<ProfileMethodInfo::ProfileInlineCache> inline_caches; - // If the method is still baseline compiled, don't save the inline caches. - // They might be incomplete and cause unnecessary deoptimizations. + // If the method is still baseline compiled and doesn't meet the inline cache threshold, don't + // save the inline caches because they might be incomplete. + // Although we don't deoptimize for incomplete inline caches in AOT-compiled code, inlining + // leads to larger generated code. // If the inline cache is empty the compiler will generate a regular invoke virtual/interface. const void* entry_point = method->GetEntryPointFromQuickCompiledCode(); if (ContainsPc(entry_point) && CodeInfo::IsBaseline( - OatQuickMethodHeader::FromEntryPoint(entry_point)->GetOptimizedCodeInfoPtr())) { + OatQuickMethodHeader::FromEntryPoint(entry_point)->GetOptimizedCodeInfoPtr()) && + (ProfilingInfo::GetOptimizeThreshold() - info->GetBaselineHotnessCount()) < + inline_cache_threshold) { methods.emplace_back(/*ProfileMethodInfo*/ MethodReference(dex_file, method->GetDexMethodIndex()), inline_caches); continue; |