Fix ProfilingInfo race.
The field can be cleared concurrently, so fetch it only once.
Test: test.py
Bug: 119800099
(cherry picked from commit a3b31ba6ee409f11889af604d91d8786458ea48f)
Change-Id: I44f0438caaa6c1fcc0986e9c2c13698194bf8179
Merged-In: I097a9c6f2175da7a027255c6b81954554bdbcff6
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc
index ff08a45..3770921 100644
--- a/runtime/jit/jit_code_cache.cc
+++ b/runtime/jit/jit_code_cache.cc
@@ -555,8 +555,11 @@
if (code_ptr != nullptr) {
entry_point = OatQuickMethodHeader::FromCodePointer(code_ptr)->GetEntryPoint();
}
- } else if (method->GetProfilingInfo(kRuntimePointerSize) != nullptr) {
- entry_point = method->GetProfilingInfo(kRuntimePointerSize)->GetSavedEntryPoint();
+ } else {
+ ProfilingInfo* profiling_info = method->GetProfilingInfo(kRuntimePointerSize);
+ if (profiling_info != nullptr) {
+ entry_point = profiling_info->GetSavedEntryPoint();
+ }
}
if (Runtime::Current()->IsZygote() || IsInZygoteExecSpace(entry_point)) {
return entry_point;