summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2016-03-22 11:38:50 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2016-03-22 11:38:51 +0000
commit0c25da0276f5b6f6119793ae9d45d1bca8172c2b (patch)
treed8db7fbf79ff21bc4b0b367918d556e48eaa75fd
parenteecf60d51b481647c8508f22b3d6ce437773ea0c (diff)
parentb9a639df2f21dd67b9f4379f31b7ccc5dd48ebd6 (diff)
Merge "Fix braino in JitCodeCache."
-rw-r--r--runtime/jit/jit_code_cache.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc
index 344fcb98ee..53d645ce29 100644
--- a/runtime/jit/jit_code_cache.cc
+++ b/runtime/jit/jit_code_cache.cc
@@ -682,10 +682,6 @@ void JitCodeCache::RemoveUnmarkedCode(Thread* self) {
if (GetLiveBitmap()->Test(allocation)) {
++it;
} else {
- const OatQuickMethodHeader* method_header = OatQuickMethodHeader::FromCodePointer(code_ptr);
- if (method_header->GetEntryPoint() == GetQuickToInterpreterBridge()) {
- method->ClearCounter();
- }
FreeCode(code_ptr, method);
it = method_code_map_.erase(it);
}
@@ -704,7 +700,13 @@ void JitCodeCache::DoCollection(Thread* self, bool collect_profiling_info) {
if (!ContainsPc(ptr) && !info->IsInUseByCompiler()) {
info->GetMethod()->SetProfilingInfo(nullptr);
}
- info->SetSavedEntryPoint(nullptr);
+
+ if (info->GetSavedEntryPoint() != nullptr) {
+ info->SetSavedEntryPoint(nullptr);
+ // We are going to move this method back to interpreter. Clear the counter now to
+ // give it a chance to be hot again.
+ info->GetMethod()->ClearCounter();
+ }
}
} else if (kIsDebugBuild) {
// Sanity check that the profiling infos do not have a dangling entry point.
@@ -930,6 +932,10 @@ bool JitCodeCache::NotifyCompilationOf(ArtMethod* method, Thread* self, bool osr
ProfilingInfo* info = method->GetProfilingInfo(sizeof(void*));
if (info == nullptr) {
VLOG(jit) << PrettyMethod(method) << " needs a ProfilingInfo to be compiled";
+ // Because the counter is not atomic, there are some rare cases where we may not
+ // hit the threshold for creating the ProfilingInfo. Reset the counter now to
+ // "correct" this.
+ method->ClearCounter();
return false;
}