src/share/vm/runtime/synchronizer.cpp

Print this page

        

*** 38,47 **** --- 38,48 ---- #include "runtime/objectMonitor.inline.hpp" #include "runtime/osThread.hpp" #include "runtime/stubRoutines.hpp" #include "runtime/synchronizer.hpp" #include "runtime/thread.inline.hpp" + #include "runtime/vframe.hpp" #include "utilities/dtrace.hpp" #include "utilities/events.hpp" #include "utilities/preserveException.hpp" #if defined(__GNUC__) && !defined(PPC64)
*** 925,946 **** // of active monitors passes the specified threshold. // TODO: assert thread state is reasonable if (ForceMonitorScavenge == 0 && Atomic::xchg (1, &ForceMonitorScavenge) == 0) { if (ObjectMonitor::Knob_Verbose) { ! ::printf ("Monitor scavenge - Induced STW @%s (%d)\n", Whence, ForceMonitorScavenge) ; ! ::fflush(stdout); } // 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_ForceAsyncSafepoint()); if (ObjectMonitor::Knob_Verbose) { ! ::printf ("Monitor scavenge - STW posted @%s (%d)\n", Whence, ForceMonitorScavenge) ; ! ::fflush(stdout); } } } void ObjectSynchronizer::verifyInUse(Thread *Self) { --- 926,949 ---- // of active monitors passes the specified threshold. // TODO: assert thread state is reasonable if (ForceMonitorScavenge == 0 && Atomic::xchg (1, &ForceMonitorScavenge) == 0) { if (ObjectMonitor::Knob_Verbose) { ! tty->print_cr("INFO: Monitor scavenge - Induced STW @%s (%d)", ! Whence, ForceMonitorScavenge) ; ! tty->flush(); } // 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_ForceAsyncSafepoint()); if (ObjectMonitor::Knob_Verbose) { ! tty->print_cr("INFO: Monitor scavenge - STW posted @%s (%d)", ! Whence, ForceMonitorScavenge) ; ! tty->flush(); } } } void ObjectSynchronizer::verifyInUse(Thread *Self) {
*** 1601,1614 **** gMonitorFreeCount += nScavenged; // Consider: audit gFreeList to ensure that gMonitorFreeCount and list agree. if (ObjectMonitor::Knob_Verbose) { ! ::printf("Deflate: InCirc=%d InUse=%d Scavenged=%d ForceMonitorScavenge=%d : pop=%d free=%d\n", nInCirculation, nInuse, nScavenged, ForceMonitorScavenge, gMonitorPopulation, gMonitorFreeCount); ! ::fflush(stdout); } ForceMonitorScavenge = 0; // Reset // Move the scavenged monitors back to the global free list. --- 1604,1618 ---- gMonitorFreeCount += nScavenged; // Consider: audit gFreeList to ensure that gMonitorFreeCount and list agree. if (ObjectMonitor::Knob_Verbose) { ! tty->print_cr("INFO: Deflate: InCirc=%d InUse=%d Scavenged=%d " ! "ForceMonitorScavenge=%d : pop=%d free=%d", nInCirculation, nInuse, nScavenged, ForceMonitorScavenge, gMonitorPopulation, gMonitorFreeCount); ! tty->flush(); } ForceMonitorScavenge = 0; // Reset // Move the scavenged monitors back to the global free list.
*** 1641,1650 **** --- 1645,1663 ---- public: ReleaseJavaMonitorsClosure(Thread* thread) : THREAD(thread) {} void do_monitor(ObjectMonitor* mid) { if (mid->owner() == THREAD) { + if (ObjectMonitor::Knob_VerifyMatch != 0) { + Handle obj((oop) mid->object()); + tty->print("INFO: unexpected locked object:"); + javaVFrame::print_locked_object_class_name(tty, obj, "locked"); + } + guarantee(ObjectMonitor::Knob_VerifyMatch == 0, + err_msg("exiting JavaThread=" INTPTR_FORMAT + " unexpectedly owns ObjectMonitor=" INTPTR_FORMAT, + THREAD, mid)); (void)mid->complete_exit(CHECK); } } };