< prev index next >

src/hotspot/share/runtime/synchronizer.cpp

Print this page

        

@@ -238,11 +238,11 @@
     // stack-locking in the object's header, the third check is for
     // recursive stack-locking in the displaced header in the BasicLock,
     // and last are the inflated Java Monitor (ObjectMonitor) checks.
     lock->set_displaced_header(markWord::unused_mark());
 
-    if (owner == NULL && Atomic::replace_if_null(self, &(m->_owner))) {
+    if (owner == NULL && Atomic::replace_if_null(&(m->_owner), self)) {
       assert(m->_recursions == 0, "invariant");
       return true;
     }
   }
 

@@ -743,11 +743,11 @@
   hash = mark.hash();
   if (hash == 0) {
     hash = get_next_hash(self, obj);
     temp = mark.copy_set_hash(hash); // merge hash code into header
     assert(temp.is_neutral(), "invariant: header=" INTPTR_FORMAT, temp.value());
-    uintptr_t v = Atomic::cmpxchg(temp.value(), (volatile uintptr_t*)monitor->header_addr(), mark.value());
+    uintptr_t v = Atomic::cmpxchg((volatile uintptr_t*)monitor->header_addr(), mark.value(), temp.value());
     test = markWord(v);
     if (test != mark) {
       // The only non-deflation update to the ObjectMonitor's
       // header/dmw field is to merge in the hash code. If someone
       // adds a new usage of the header/dmw field, please update

@@ -991,11 +991,11 @@
   // Ultimately, this results in a call to deflate_idle_monitors() in the near future.
   // More precisely, trigger an asynchronous STW safepoint as the number
   // of active monitors passes the specified threshold.
   // TODO: assert thread state is reasonable
 
-  if (ForceMonitorScavenge == 0 && Atomic::xchg (1, &ForceMonitorScavenge) == 0) {
+  if (ForceMonitorScavenge == 0 && Atomic::xchg(&ForceMonitorScavenge, 1) == 0) {
     // Induce a 'null' safepoint to scavenge monitors
     // Must VM_Operation instance be heap allocated as the op will be enqueue and posted
     // to the VMthread and have a lifespan longer than that of this activation record.
     // The VMThread will delete the op when completed.
     VMThread::execute(new VM_ScavengeMonitors());
< prev index next >