comparison src/share/vm/runtime/synchronizer.cpp @ 702:b9fba36710f2

6699669: Hotspot server leaves synchronized block with monitor in bad state Summary: Remove usage of _highest_lock field in Thread so that is_lock_owned won't depend on the correct update of that field. Reviewed-by: never, dice, acorn
author xlu
date Mon, 06 Apr 2009 15:47:39 -0700
parents 0fbdb4381b99
children b30a2cd5e3a2 c18cbe5936b8 b96a3e44582f
comparison
equal deleted inserted replaced
697:922aedc96ef5 702:b9fba36710f2
1115 // Setup monitor fields to proper values -- prepare the monitor 1115 // Setup monitor fields to proper values -- prepare the monitor
1116 m->set_header(dmw) ; 1116 m->set_header(dmw) ;
1117 1117
1118 // Optimization: if the mark->locker stack address is associated 1118 // Optimization: if the mark->locker stack address is associated
1119 // with this thread we could simply set m->_owner = Self and 1119 // with this thread we could simply set m->_owner = Self and
1120 // m->OwnerIsThread = 1. Note that a thread can inflate an object 1120 // m->OwnerIsThread = 1. Note that a thread can inflate an object
1121 // that it has stack-locked -- as might happen in wait() -- directly 1121 // that it has stack-locked -- as might happen in wait() -- directly
1122 // with CAS. That is, we can avoid the xchg-NULL .... ST idiom. 1122 // with CAS. That is, we can avoid the xchg-NULL .... ST idiom.
1123 m->set_owner (mark->locker()); 1123 m->set_owner(mark->locker());
1124 m->set_object(object); 1124 m->set_object(object);
1125 // TODO-FIXME: assert BasicLock->dhw != 0. 1125 // TODO-FIXME: assert BasicLock->dhw != 0.
1126 1126
1127 // Must preserve store ordering. The monitor state must 1127 // Must preserve store ordering. The monitor state must
1128 // be stable at the time of publishing the monitor address. 1128 // be stable at the time of publishing the monitor address.
1212 } else { 1212 } else {
1213 assert(!attempt_rebias, "can not rebias toward VM thread"); 1213 assert(!attempt_rebias, "can not rebias toward VM thread");
1214 BiasedLocking::revoke_at_safepoint(obj); 1214 BiasedLocking::revoke_at_safepoint(obj);
1215 } 1215 }
1216 assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now"); 1216 assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
1217 } 1217 }
1218 1218
1219 THREAD->update_highest_lock((address)lock); 1219 slow_enter (obj, lock, THREAD) ;
1220 slow_enter (obj, lock, THREAD) ;
1221 } 1220 }
1222 1221
1223 void ObjectSynchronizer::fast_exit(oop object, BasicLock* lock, TRAPS) { 1222 void ObjectSynchronizer::fast_exit(oop object, BasicLock* lock, TRAPS) {
1224 assert(!object->mark()->has_bias_pattern(), "should not see bias pattern here"); 1223 assert(!object->mark()->has_bias_pattern(), "should not see bias pattern here");
1225 // if displaced header is null, the previous enter is recursive enter, no-op 1224 // if displaced header is null, the previous enter is recursive enter, no-op