--- a/hotspot/src/share/vm/oops/method.hpp Wed Sep 17 06:05:41 2014 +0000
+++ b/hotspot/src/share/vm/oops/method.hpp Wed Sep 17 21:15:03 2014 -0700
@@ -333,11 +333,13 @@
return _method_counters;
}
- void set_method_counters(MethodCounters* counters) {
- // The store into method must be released. On platforms without
- // total store order (TSO) the reference may become visible before
- // the initialization of data otherwise.
- OrderAccess::release_store_ptr((volatile void *)&_method_counters, counters);
+ void clear_method_counters() {
+ _method_counters = NULL;
+ }
+
+ bool init_method_counters(MethodCounters* counters) {
+ // Try to install a pointer to MethodCounters, return true on success.
+ return Atomic::cmpxchg_ptr(counters, (volatile void*)&_method_counters, NULL) == NULL;
}
#ifdef TIERED