Exploratory change for crash running 719-varhandle-concurrency
The failures we see on the buildbot are frustrating hard to repro
locally. This CL tests one theory - a missing store barrier - as a
potential root cause.
Bug: 224733324
Test: art/test/testrunner.py -t 719
Change-Id: I5925e50c1de5f94cfe9aafb8717cd293136bc384
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 4bccd55..12ed605 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -9580,6 +9580,9 @@
Handle<mirror::MethodType> type = hs.NewHandle(
mirror::MethodType::Create(self, return_type, method_params));
if (type != nullptr) {
+ // Ensure all stores for the newly created MethodType are visible, before we attempt to place
+ // it in the DexCache (b/224733324).
+ std::atomic_thread_fence(std::memory_order_release);
dex_cache->SetResolvedMethodType(proto_idx, type.Get());
}