< prev index next >

src/share/vm/runtime/synchronizer.cpp

Print this page
rev 8961 : [mq]: diff-shenandoah.patch

*** 158,167 **** --- 158,168 ---- bool ObjectSynchronizer::quick_notify(oopDesc * obj, Thread * self, bool all) { assert(!SafepointSynchronize::is_at_safepoint(), "invariant"); assert(self->is_Java_thread(), "invariant"); assert(((JavaThread *) self)->thread_state() == _thread_in_Java, "invariant"); + assert(obj == oopDesc::bs()->resolve_and_maybe_copy_oop(obj), "expect to-space copy"); No_Safepoint_Verifier nsv; if (obj == NULL) return false; // slow-path for invalid obj const markOop mark = obj->mark(); if (mark->has_locker() && self->is_lock_owned((address)mark->locker())) {
*** 208,217 **** --- 209,219 ---- bool ObjectSynchronizer::quick_enter(oop obj, Thread * Self, BasicLock * Lock) { assert(!SafepointSynchronize::is_at_safepoint(), "invariant"); assert(Self->is_Java_thread(), "invariant"); assert(((JavaThread *) Self)->thread_state() == _thread_in_Java, "invariant"); + assert(obj == oopDesc::bs()->resolve_and_maybe_copy_oop(obj), "expect to-space copy"); No_Safepoint_Verifier nsv; if (obj == NULL) return false; // Need to throw NPE const markOop mark = obj->mark(); if (mark->has_monitor()) {
*** 254,263 **** --- 256,266 ---- // if the following function is changed. The implementation is // extremely sensitive to race condition. Be careful. void ObjectSynchronizer::fast_enter(Handle obj, BasicLock* lock, bool attempt_rebias, TRAPS) { + assert(obj() == oopDesc::bs()->resolve_and_maybe_copy_oop(obj()), "expect to-space copy"); if (UseBiasedLocking) { if (!SafepointSynchronize::is_at_safepoint()) { BiasedLocking::Condition cond = BiasedLocking::revoke_and_rebias(obj, attempt_rebias, THREAD); if (cond == BiasedLocking::BIAS_REVOKED_AND_REBIASED) { return;
*** 273,282 **** --- 276,287 ---- } void ObjectSynchronizer::fast_exit(oop object, BasicLock* lock, TRAPS) { assert(!object->mark()->has_bias_pattern(), "should not see bias pattern here"); // if displaced header is null, the previous enter is recursive enter, no-op + assert(object == oopDesc::bs()->resolve_and_maybe_copy_oop(object), "expect to-space copy"); + markOop dhw = lock->displaced_header(); markOop mark; if (dhw == NULL) { // Recursive stack-lock. // Diagnostics -- Could be: stack-locked, inflating, inflated.
*** 312,321 **** --- 317,327 ---- // Interpreter/Compiler Slow Case // This routine is used to handle interpreter/compiler slow case // We don't need to use fast path here, because it must have been // failed in the interpreter/compiler code. void ObjectSynchronizer::slow_enter(Handle obj, BasicLock* lock, TRAPS) { + assert(obj() == oopDesc::bs()->resolve_and_maybe_copy_oop(obj()), "expect to-space copy"); markOop mark = obj->mark(); assert(!mark->has_bias_pattern(), "should not see bias pattern here"); if (mark->is_neutral()) { // Anticipate successful CAS -- the ST of the displaced mark must
*** 362,371 **** --- 368,378 ---- // 4) reenter lock1 with original recursion count // 5) lock lock2 // NOTE: must use heavy weight monitor to handle complete_exit/reenter() intptr_t ObjectSynchronizer::complete_exit(Handle obj, TRAPS) { TEVENT(complete_exit); + assert(obj() == oopDesc::bs()->resolve_and_maybe_copy_oop(obj()), "expect to-space copy"); if (UseBiasedLocking) { BiasedLocking::revoke_and_rebias(obj, false, THREAD); assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now"); }
*** 375,384 **** --- 382,392 ---- } // NOTE: must use heavy weight monitor to handle complete_exit/reenter() void ObjectSynchronizer::reenter(Handle obj, intptr_t recursion, TRAPS) { TEVENT(reenter); + assert(obj() == oopDesc::bs()->resolve_and_maybe_copy_oop(obj()), "expect to-space copy"); if (UseBiasedLocking) { BiasedLocking::revoke_and_rebias(obj, false, THREAD); assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now"); }
*** 390,399 **** --- 398,408 ---- // JNI locks on java objects // NOTE: must use heavy weight monitor to handle jni monitor enter void ObjectSynchronizer::jni_enter(Handle obj, TRAPS) { // the current locking is from JNI instead of Java code TEVENT(jni_enter); + assert(obj() == oopDesc::bs()->resolve_and_maybe_copy_oop(obj()), "expect to-space copy"); if (UseBiasedLocking) { BiasedLocking::revoke_and_rebias(obj, false, THREAD); assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now"); } THREAD->set_current_pending_monitor_is_from_java(false);
*** 402,411 **** --- 411,421 ---- } // NOTE: must use heavy weight monitor to handle jni monitor exit void ObjectSynchronizer::jni_exit(oop obj, Thread* THREAD) { TEVENT(jni_exit); + assert(obj == oopDesc::bs()->resolve_and_maybe_copy_oop(obj), "expect to-space copy"); if (UseBiasedLocking) { Handle h_obj(THREAD, obj); BiasedLocking::revoke_and_rebias(h_obj, false, THREAD); obj = h_obj(); }
*** 444,453 **** --- 454,464 ---- // ----------------------------------------------------------------------------- // Wait/Notify/NotifyAll // NOTE: must use heavy weight monitor to handle wait() int ObjectSynchronizer::wait(Handle obj, jlong millis, TRAPS) { + assert(obj() == oopDesc::bs()->resolve_and_maybe_copy_oop(obj()), "expect to-space copy"); if (UseBiasedLocking) { BiasedLocking::revoke_and_rebias(obj, false, THREAD); assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now"); } if (millis < 0) {
*** 464,473 **** --- 475,485 ---- // DTRACE_MONITOR_PROBE(waited, monitor, obj(), THREAD); return dtrace_waited_probe(monitor, obj, THREAD); } void ObjectSynchronizer::waitUninterruptibly(Handle obj, jlong millis, TRAPS) { + assert(obj() == oopDesc::bs()->resolve_and_maybe_copy_oop(obj()), "expect to-space copy"); if (UseBiasedLocking) { BiasedLocking::revoke_and_rebias(obj, false, THREAD); assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now"); } if (millis < 0) {
*** 476,485 **** --- 488,498 ---- } ObjectSynchronizer::inflate(THREAD, obj()) -> wait(millis, false, THREAD); } void ObjectSynchronizer::notify(Handle obj, TRAPS) { + assert(obj() == oopDesc::bs()->resolve_and_maybe_copy_oop(obj()), "expect to-space copy"); if (UseBiasedLocking) { BiasedLocking::revoke_and_rebias(obj, false, THREAD); assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now"); }
*** 490,499 **** --- 503,513 ---- ObjectSynchronizer::inflate(THREAD, obj())->notify(THREAD); } // NOTE: see comment of notify() void ObjectSynchronizer::notifyall(Handle obj, TRAPS) { + assert(obj() == oopDesc::bs()->resolve_and_maybe_copy_oop(obj()), "expect to-space copy"); if (UseBiasedLocking) { BiasedLocking::revoke_and_rebias(obj, false, THREAD); assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now"); }
*** 667,676 **** --- 681,691 ---- TEVENT(hashCode: GENERATE); return value; } intptr_t ObjectSynchronizer::FastHashCode(Thread * Self, oop obj) { + assert(obj == oopDesc::bs()->resolve_and_maybe_copy_oop(obj), "expect to-space copy"); if (UseBiasedLocking) { // NOTE: many places throughout the JVM do not expect a safepoint // to be taken here, in particular most operations on perm gen // objects. However, we only ever bias Java instances and all of // the call sites of identity_hash that might revoke biases have
*** 780,789 **** --- 795,805 ---- } bool ObjectSynchronizer::current_thread_holds_lock(JavaThread* thread, Handle h_obj) { + assert(h_obj() == oopDesc::bs()->resolve_and_maybe_copy_oop(h_obj()), "expect to-space copy"); if (UseBiasedLocking) { BiasedLocking::revoke_and_rebias(h_obj, false, thread); assert(!h_obj->mark()->has_bias_pattern(), "biases should be revoked by now"); }
*** 852,861 **** --- 868,878 ---- return owner_none; // it's unlocked } // FIXME: jvmti should call this JavaThread* ObjectSynchronizer::get_lock_owner(Handle h_obj, bool doLock) { + assert(h_obj() == oopDesc::bs()->resolve_and_maybe_copy_oop(h_obj()), "expect to-space copy"); if (UseBiasedLocking) { if (SafepointSynchronize::is_at_safepoint()) { BiasedLocking::revoke_at_safepoint(h_obj); } else { BiasedLocking::revoke_and_rebias(h_obj, false, JavaThread::current());
*** 1273,1282 **** --- 1290,1300 ---- TEVENT(omFlush); } // Fast path code shared by multiple functions ObjectMonitor* ObjectSynchronizer::inflate_helper(oop obj) { + assert(obj == oopDesc::bs()->resolve_and_maybe_copy_oop(obj), "expect to-space copy"); markOop mark = obj->mark(); if (mark->has_monitor()) { assert(ObjectSynchronizer::verify_objmon_isinpool(mark->monitor()), "monitor is invalid"); assert(mark->monitor()->header()->is_neutral(), "monitor must record a good object header"); return mark->monitor();
*** 1287,1296 **** --- 1305,1315 ---- ObjectMonitor * NOINLINE ObjectSynchronizer::inflate(Thread * Self, oop object) { // Inflate mutates the heap ... // Relaxing assertion for bug 6320749. + assert(object == oopDesc::bs()->resolve_and_maybe_copy_oop(object), "expect to-space copy"); assert(Universe::verify_in_progress() || !SafepointSynchronize::is_at_safepoint(), "invariant"); for (;;) { const markOop mark = object->mark();
*** 1305,1315 **** // CASE: inflated if (mark->has_monitor()) { ObjectMonitor * inf = mark->monitor(); assert(inf->header()->is_neutral(), "invariant"); ! assert(inf->object() == object, "invariant"); assert(ObjectSynchronizer::verify_objmon_isinpool(inf), "monitor is invalid"); return inf; } // CASE: inflation in progress - inflating over a stack-lock. --- 1324,1334 ---- // CASE: inflated if (mark->has_monitor()) { ObjectMonitor * inf = mark->monitor(); assert(inf->header()->is_neutral(), "invariant"); ! assert((oop) inf->object() == object, "invariant"); assert(ObjectSynchronizer::verify_objmon_isinpool(inf), "monitor is invalid"); return inf; } // CASE: inflation in progress - inflating over a stack-lock.
*** 1511,1520 **** --- 1530,1540 ---- bool ObjectSynchronizer::deflate_monitor(ObjectMonitor* mid, oop obj, ObjectMonitor** freeHeadp, ObjectMonitor** freeTailp) { bool deflated; // Normal case ... The monitor is associated with obj. + assert(obj == oopDesc::bs()->resolve_and_maybe_copy_oop(obj), "expect to-space copy"); guarantee(obj->mark() == markOopDesc::encode(mid), "invariant"); guarantee(mid == obj->mark()->monitor(), "invariant"); guarantee(mid->header()->is_neutral(), "invariant"); if (mid->is_busy()) {
*** 1796,1805 **** --- 1816,1826 ---- while (block) { assert(block->object() == CHAINMARKER, "must be a block header"); for (int i = 1; i < _BLOCKSIZE; i++) { mid = (ObjectMonitor *)(block + i); oop object = (oop) mid->object(); + if (object != NULL) { mid->verify(); } } block = (PaddedEnd<ObjectMonitor> *) block->FreeNext;
< prev index next >