< prev index next >

src/hotspot/share/runtime/synchronizer.cpp

Print this page

        

*** 109,121 **** #define NINFLATIONLOCKS 256 static volatile intptr_t gInflationLocks[NINFLATIONLOCKS]; // global list of blocks of monitors ! // gBlockList is really PaddedEnd<ObjectMonitor> *, but we don't ! // want to expose the PaddedEnd template more than necessary. ! ObjectMonitor * volatile ObjectSynchronizer::gBlockList = NULL; // global monitor free list ObjectMonitor * volatile ObjectSynchronizer::gFreeList = NULL; // global monitor in-use list, for moribund threads, // monitors they inflated need to be scanned for deflation ObjectMonitor * volatile ObjectSynchronizer::gOmInUseList = NULL; --- 109,119 ---- #define NINFLATIONLOCKS 256 static volatile intptr_t gInflationLocks[NINFLATIONLOCKS]; // global list of blocks of monitors ! PaddedEnd<ObjectMonitor> * volatile ObjectSynchronizer::gBlockList = NULL; // global monitor free list ObjectMonitor * volatile ObjectSynchronizer::gFreeList = NULL; // global monitor in-use list, for moribund threads, // monitors they inflated need to be scanned for deflation ObjectMonitor * volatile ObjectSynchronizer::gOmInUseList = NULL;
*** 239,249 **** // recursive stack-locking in the displaced header in the BasicLock, // and last are the inflated Java Monitor (ObjectMonitor) checks. lock->set_displaced_header(markOopDesc::unused_mark()); if (owner == NULL && ! Atomic::cmpxchg_ptr(Self, &(m->_owner), NULL) == NULL) { assert(m->_recursions == 0, "invariant"); assert(m->_owner == Self, "invariant"); return true; } } --- 237,247 ---- // recursive stack-locking in the displaced header in the BasicLock, // and last are the inflated Java Monitor (ObjectMonitor) checks. lock->set_displaced_header(markOopDesc::unused_mark()); if (owner == NULL && ! Atomic::cmpxchg((void*)Self, &(m->_owner), (void*)NULL) == NULL) { assert(m->_recursions == 0, "invariant"); assert(m->_owner == Self, "invariant"); return true; } }
*** 800,810 **** 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"); ! test = (markOop) Atomic::cmpxchg_ptr(temp, monitor, mark); if (test != mark) { // The only update to the header in the monitor (outside GC) // is install the hash code. If someone add new usage of // displaced header, please update this code hash = test->hash(); --- 798,808 ---- 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"); ! test = Atomic::cmpxchg(temp, monitor->header_addr(), mark); if (test != mark) { // The only update to the header in the monitor (outside GC) // is install the hash code. If someone add new usage of // displaced header, please update this code hash = test->hash();
*** 937,948 **** } // Visitors ... void ObjectSynchronizer::monitors_iterate(MonitorClosure* closure) { ! PaddedEnd<ObjectMonitor> * block = ! (PaddedEnd<ObjectMonitor> *)OrderAccess::load_ptr_acquire(&gBlockList); while (block != NULL) { assert(block->object() == CHAINMARKER, "must be a block header"); for (int i = _BLOCKSIZE - 1; i > 0; i--) { ObjectMonitor* mid = (ObjectMonitor *)(block + i); oop object = (oop)mid->object(); --- 935,945 ---- } // Visitors ... void ObjectSynchronizer::monitors_iterate(MonitorClosure* closure) { ! PaddedEnd<ObjectMonitor> * block = OrderAccess::load_acquire(&gBlockList); while (block != NULL) { assert(block->object() == CHAINMARKER, "must be a block header"); for (int i = _BLOCKSIZE - 1; i > 0; i--) { ObjectMonitor* mid = (ObjectMonitor *)(block + i); oop object = (oop)mid->object();
*** 989,1000 **** } } void ObjectSynchronizer::global_oops_do(OopClosure* f) { assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); ! PaddedEnd<ObjectMonitor> * block = ! (PaddedEnd<ObjectMonitor> *)OrderAccess::load_ptr_acquire(&gBlockList); for (; block != NULL; block = (PaddedEnd<ObjectMonitor> *)next(block)) { assert(block->object() == CHAINMARKER, "must be a block header"); for (int i = 1; i < _BLOCKSIZE; i++) { ObjectMonitor* mid = (ObjectMonitor *)&block[i]; if (mid->object() != NULL) { --- 986,996 ---- } } void ObjectSynchronizer::global_oops_do(OopClosure* f) { assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); ! PaddedEnd<ObjectMonitor> * block = OrderAccess::load_acquire(&gBlockList); for (; block != NULL; block = (PaddedEnd<ObjectMonitor> *)next(block)) { assert(block->object() == CHAINMARKER, "must be a block header"); for (int i = 1; i < _BLOCKSIZE; i++) { ObjectMonitor* mid = (ObjectMonitor *)&block[i]; if (mid->object() != NULL) {
*** 1230,1240 **** // The very first objectMonitor in a block is reserved and dedicated. // It serves as blocklist "next" linkage. temp[0].FreeNext = gBlockList; // There are lock-free uses of gBlockList so make sure that // the previous stores happen before we update gBlockList. ! OrderAccess::release_store_ptr(&gBlockList, temp); // Add the new string of objectMonitors to the global free list temp[_BLOCKSIZE - 1].FreeNext = gFreeList; gFreeList = temp + 1; Thread::muxRelease(&gListLock); --- 1226,1236 ---- // The very first objectMonitor in a block is reserved and dedicated. // It serves as blocklist "next" linkage. temp[0].FreeNext = gBlockList; // There are lock-free uses of gBlockList so make sure that // the previous stores happen before we update gBlockList. ! OrderAccess::release_store(&gBlockList, temp); // Add the new string of objectMonitors to the global free list temp[_BLOCKSIZE - 1].FreeNext = gFreeList; gFreeList = temp + 1; Thread::muxRelease(&gListLock);
*** 1732,1743 **** counters->nScavenged += deflated_count; counters->nInuse += gOmInUseCount; } } else { ! PaddedEnd<ObjectMonitor> * block = ! (PaddedEnd<ObjectMonitor> *)OrderAccess::load_ptr_acquire(&gBlockList); for (; block != NULL; block = (PaddedEnd<ObjectMonitor> *)next(block)) { // Iterate over all extant monitors - Scavenge all idle monitors. assert(block->object() == CHAINMARKER, "must be a block header"); counters->nInCirculation += _BLOCKSIZE; for (int i = 1; i < _BLOCKSIZE; i++) { --- 1728,1738 ---- counters->nScavenged += deflated_count; counters->nInuse += gOmInUseCount; } } else { ! PaddedEnd<ObjectMonitor> * block = OrderAccess::load_acquire(&gBlockList); for (; block != NULL; block = (PaddedEnd<ObjectMonitor> *)next(block)) { // Iterate over all extant monitors - Scavenge all idle monitors. assert(block->object() == CHAINMARKER, "must be a block header"); counters->nInCirculation += _BLOCKSIZE; for (int i = 1; i < _BLOCKSIZE; i++) {
*** 1967,1978 **** // Check if monitor belongs to the monitor cache // The list is grow-only so it's *relatively* safe to traverse // the list of extant blocks without taking a lock. int ObjectSynchronizer::verify_objmon_isinpool(ObjectMonitor *monitor) { ! PaddedEnd<ObjectMonitor> * block = ! (PaddedEnd<ObjectMonitor> *)OrderAccess::load_ptr_acquire(&gBlockList); while (block != NULL) { assert(block->object() == CHAINMARKER, "must be a block header"); if (monitor > (ObjectMonitor *)&block[0] && monitor < (ObjectMonitor *)&block[_BLOCKSIZE]) { address mon = (address)monitor; --- 1962,1972 ---- // Check if monitor belongs to the monitor cache // The list is grow-only so it's *relatively* safe to traverse // the list of extant blocks without taking a lock. int ObjectSynchronizer::verify_objmon_isinpool(ObjectMonitor *monitor) { ! PaddedEnd<ObjectMonitor> * block = OrderAccess::load_acquire(&gBlockList); while (block != NULL) { assert(block->object() == CHAINMARKER, "must be a block header"); if (monitor > (ObjectMonitor *)&block[0] && monitor < (ObjectMonitor *)&block[_BLOCKSIZE]) { address mon = (address)monitor;
< prev index next >