Merge "Add a fence to ensure other threads see the correct data."
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc
index 08eac0e..c260ca4 100644
--- a/runtime/jit/jit_code_cache.cc
+++ b/runtime/jit/jit_code_cache.cc
@@ -668,6 +668,11 @@
return nullptr;
}
info = new (data) ProfilingInfo(method, entries);
+
+ // Make sure other threads see the data in the profiling info object before the
+ // store in the ArtMethod's ProfilingInfo pointer.
+ QuasiAtomic::ThreadFenceRelease();
+
method->SetProfilingInfo(info);
profiling_infos_.push_back(info);
return info;