diff src/share/vm/oops/method.hpp @ 20489:966205f0e717

8058564: Tiered compilation performance drop in PIT Summary: Ensure MethodCounters are created before method is enqueued for compilation Reviewed-by: kvn, drchase, jiangli, roland
author iveresov
date Fri, 19 Sep 2014 11:53:58 -0700
parents 7301840ea20e
children 3c87c13918fb
line wrap: on
line diff
--- a/src/share/vm/oops/method.hpp	Fri Sep 19 11:12:39 2014 -0400
+++ b/src/share/vm/oops/method.hpp	Fri Sep 19 11:53:58 2014 -0700
@@ -365,11 +365,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