1.1 --- a/src/share/vm/oops/method.hpp Fri Sep 19 11:12:39 2014 -0400 1.2 +++ b/src/share/vm/oops/method.hpp Fri Sep 19 11:53:58 2014 -0700 1.3 @@ -365,11 +365,13 @@ 1.4 return _method_counters; 1.5 } 1.6 1.7 - void set_method_counters(MethodCounters* counters) { 1.8 - // The store into method must be released. On platforms without 1.9 - // total store order (TSO) the reference may become visible before 1.10 - // the initialization of data otherwise. 1.11 - OrderAccess::release_store_ptr((volatile void *)&_method_counters, counters); 1.12 + void clear_method_counters() { 1.13 + _method_counters = NULL; 1.14 + } 1.15 + 1.16 + bool init_method_counters(MethodCounters* counters) { 1.17 + // Try to install a pointer to MethodCounters, return true on success. 1.18 + return Atomic::cmpxchg_ptr(counters, (volatile void*)&_method_counters, NULL) == NULL; 1.19 } 1.20 1.21 #ifdef TIERED