Fix thread race when fetching the ProfilingInfo object.
Problem is:
1) Compiler fetches the ProfilingInfo of A, it's null.
2) Mutator creates the ProfilingInfo.
3) Compiler notifies it's not using A anymore, calls
ProfilingInfo::DecrementInlineUse -> Crash as we expected
ProfilingInfo::IncrementUse to be called before.
Also update some namings to better reflect what is going on.
Change-Id: I55ea4c5d81988131467095e18a0d13a8be9d0ef7
diff --git a/runtime/jit/jit_code_cache.h b/runtime/jit/jit_code_cache.h
index 113bebf..98dd70d 100644
--- a/runtime/jit/jit_code_cache.h
+++ b/runtime/jit/jit_code_cache.h
@@ -71,7 +71,11 @@
SHARED_REQUIRES(Locks::mutator_lock_)
REQUIRES(!lock_);
- void NotifyInliningOf(ArtMethod* method, Thread* self)
+ // Notify to the code cache that the compiler wants to use the
+ // profiling info of `method` to drive optimizations,
+ // and therefore ensure the returned profiling info object is not
+ // collected.
+ ProfilingInfo* NotifyCompilerUse(ArtMethod* method, Thread* self)
SHARED_REQUIRES(Locks::mutator_lock_)
REQUIRES(!lock_);
@@ -79,7 +83,7 @@
SHARED_REQUIRES(Locks::mutator_lock_)
REQUIRES(!lock_);
- void DoneInlining(ArtMethod* method, Thread* self)
+ void DoneCompilerUse(ArtMethod* method, Thread* self)
SHARED_REQUIRES(Locks::mutator_lock_)
REQUIRES(!lock_);