src/hotspot/share/runtime/synchronizer.cpp
changeset 59252 623722a6aeb9
parent 59251 4cbfa5077d68
child 59325 3636bab5e81e
equal deleted inserted replaced
59251:4cbfa5077d68 59252:623722a6aeb9
   238     // stack-locking in the object's header, the third check is for
   238     // stack-locking in the object's header, the third check is for
   239     // recursive stack-locking in the displaced header in the BasicLock,
   239     // recursive stack-locking in the displaced header in the BasicLock,
   240     // and last are the inflated Java Monitor (ObjectMonitor) checks.
   240     // and last are the inflated Java Monitor (ObjectMonitor) checks.
   241     lock->set_displaced_header(markWord::unused_mark());
   241     lock->set_displaced_header(markWord::unused_mark());
   242 
   242 
   243     if (owner == NULL && Atomic::replace_if_null(self, &(m->_owner))) {
   243     if (owner == NULL && Atomic::replace_if_null(&(m->_owner), self)) {
   244       assert(m->_recursions == 0, "invariant");
   244       assert(m->_recursions == 0, "invariant");
   245       return true;
   245       return true;
   246     }
   246     }
   247   }
   247   }
   248 
   248 
   747   hash = mark.hash();
   747   hash = mark.hash();
   748   if (hash == 0) {                    // if it does not have a hash
   748   if (hash == 0) {                    // if it does not have a hash
   749     hash = get_next_hash(self, obj);  // get a new hash
   749     hash = get_next_hash(self, obj);  // get a new hash
   750     temp = mark.copy_set_hash(hash);  // merge the hash into header
   750     temp = mark.copy_set_hash(hash);  // merge the hash into header
   751     assert(temp.is_neutral(), "invariant: header=" INTPTR_FORMAT, temp.value());
   751     assert(temp.is_neutral(), "invariant: header=" INTPTR_FORMAT, temp.value());
   752     uintptr_t v = Atomic::cmpxchg(temp.value(), (volatile uintptr_t*)monitor->header_addr(), mark.value());
   752     uintptr_t v = Atomic::cmpxchg((volatile uintptr_t*)monitor->header_addr(), mark.value(), temp.value());
   753     test = markWord(v);
   753     test = markWord(v);
   754     if (test != mark) {
   754     if (test != mark) {
   755       // The attempt to update the ObjectMonitor's header/dmw field
   755       // The attempt to update the ObjectMonitor's header/dmw field
   756       // did not work. This can happen if another thread managed to
   756       // did not work. This can happen if another thread managed to
   757       // merge in the hash just before our cmpxchg().
   757       // merge in the hash just before our cmpxchg().