diff options
Diffstat (limited to 'runtime/jit/jit_code_cache.cc')
-rw-r--r-- | runtime/jit/jit_code_cache.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc index c0342baa23..ecfe9b66f0 100644 --- a/runtime/jit/jit_code_cache.cc +++ b/runtime/jit/jit_code_cache.cc @@ -1686,6 +1686,28 @@ void JitCodeCache::DoneCompiling(ArtMethod* method, Thread* self, bool osr) { } } +void JitCodeCache::InvalidateAllCompiledCode() { + art::MutexLock mu(Thread::Current(), *Locks::jit_lock_); + size_t cnt = profiling_infos_.size(); + size_t osr_size = osr_code_map_.size(); + for (ProfilingInfo* pi : profiling_infos_) { + // NB Due to OSR we might run this on some methods multiple times but this should be fine. + ArtMethod* meth = pi->GetMethod(); + pi->SetSavedEntryPoint(nullptr); + // We had a ProfilingInfo so we must be warm. + ClearMethodCounter(meth, /*was_warm=*/true); + ClassLinker* linker = Runtime::Current()->GetClassLinker(); + if (meth->IsObsolete()) { + linker->SetEntryPointsForObsoleteMethod(meth); + } else { + linker->SetEntryPointsToInterpreter(meth); + } + } + osr_code_map_.clear(); + VLOG(jit) << "Invalidated the compiled code of " << (cnt - osr_size) << " methods and " + << osr_size << " OSRs."; +} + void JitCodeCache::InvalidateCompiledCodeFor(ArtMethod* method, const OatQuickMethodHeader* header) { DCHECK(!method->IsNative()); |