src/hotspot/share/oops/method.cpp
changeset 47634 6a0c42c40cd1
parent 47216 71c04702a3d5
child 47687 fb290fd1f9d4
--- a/src/hotspot/share/oops/method.cpp	Mon Oct 16 20:22:41 2017 +0000
+++ b/src/hotspot/share/oops/method.cpp	Mon Oct 16 22:36:06 2017 -0400
@@ -444,6 +444,11 @@
   return mh->method_counters();
 }
 
+bool Method::init_method_counters(MethodCounters* counters) {
+  // Try to install a pointer to MethodCounters, return true on success.
+  return Atomic::cmpxchg(counters, &_method_counters, (MethodCounters*)NULL) == NULL;
+}
+
 void Method::cleanup_inline_caches() {
   // The current system doesn't use inline caches in the interpreter
   // => nothing to do (keep this method around for future use)
@@ -1108,8 +1113,8 @@
   }
 }
 
-volatile address Method::from_compiled_entry_no_trampoline() const {
-  nmethod *code = (nmethod *)OrderAccess::load_ptr_acquire(&_code);
+address Method::from_compiled_entry_no_trampoline() const {
+  CompiledMethod *code = OrderAccess::load_acquire(&_code);
   if (code) {
     return code->verified_entry_point();
   } else {
@@ -1135,7 +1140,7 @@
 // Not inline to avoid circular ref.
 bool Method::check_code() const {
   // cached in a register or local.  There's a race on the value of the field.
-  CompiledMethod *code = (CompiledMethod *)OrderAccess::load_ptr_acquire(&_code);
+  CompiledMethod *code = OrderAccess::load_acquire(&_code);
   return code == NULL || (code->method() == NULL) || (code->method() == (Method*)this && !code->is_osr_method());
 }