< prev index next >

src/share/vm/runtime/synchronizer.cpp

Print this page
rev 13098 : imported patch deflation
rev 13099 : [mq]: deflation_2


 945     assert(block->object() == CHAINMARKER, "must be a block header");
 946     for (int i = _BLOCKSIZE - 1; i > 0; i--) {
 947       ObjectMonitor* mid = (ObjectMonitor *)(block + i);
 948       oop object = (oop)mid->object();
 949       if (object != NULL) {
 950         closure->do_monitor(mid);
 951       }
 952     }
 953     block = (PaddedEnd<ObjectMonitor> *)block->FreeNext;
 954   }
 955 }
 956 
 957 // Get the next block in the block list.
 958 static inline ObjectMonitor* next(ObjectMonitor* block) {
 959   assert(block->object() == CHAINMARKER, "must be a block header");
 960   block = block->FreeNext;
 961   assert(block == NULL || block->object() == CHAINMARKER, "must be a block header");
 962   return block;
 963 }
 964 




 965 
 966 void ObjectSynchronizer::oops_do(OopClosure* f) {
 967   if (MonitorInUseLists) {
 968     // When using thread local monitor lists, we only scan the
 969     // global used list here (for moribund threads), and
 970     // the thread-local monitors in Thread::oops_do().
 971     global_used_oops_do(f);
 972   } else {
 973     global_oops_do(f);
 974   }
 975 }
 976 
 977 void ObjectSynchronizer::global_oops_do(OopClosure* f) {
 978   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
 979   PaddedEnd<ObjectMonitor> * block =
 980     (PaddedEnd<ObjectMonitor> *)OrderAccess::load_ptr_acquire(&gBlockList);
 981   for (; block != NULL; block = (PaddedEnd<ObjectMonitor> *)next(block)) {
 982     assert(block->object() == CHAINMARKER, "must be a block header");
 983     for (int i = 1; i < _BLOCKSIZE; i++) {
 984       ObjectMonitor* mid = (ObjectMonitor *)&block[i];




 945     assert(block->object() == CHAINMARKER, "must be a block header");
 946     for (int i = _BLOCKSIZE - 1; i > 0; i--) {
 947       ObjectMonitor* mid = (ObjectMonitor *)(block + i);
 948       oop object = (oop)mid->object();
 949       if (object != NULL) {
 950         closure->do_monitor(mid);
 951       }
 952     }
 953     block = (PaddedEnd<ObjectMonitor> *)block->FreeNext;
 954   }
 955 }
 956 
 957 // Get the next block in the block list.
 958 static inline ObjectMonitor* next(ObjectMonitor* block) {
 959   assert(block->object() == CHAINMARKER, "must be a block header");
 960   block = block->FreeNext;
 961   assert(block == NULL || block->object() == CHAINMARKER, "must be a block header");
 962   return block;
 963 }
 964 
 965 bool ObjectSynchronizer::is_cleanup_needed() {
 966   int monitors_used = gMonitorPopulation - gMonitorFreeCount;
 967   return MonitorUsedDeflationThreshold > 0 && (monitors_used * 100LL) / gMonitorPopulation > MonitorUsedDeflationThreshold;
 968 }
 969 
 970 void ObjectSynchronizer::oops_do(OopClosure* f) {
 971   if (MonitorInUseLists) {
 972     // When using thread local monitor lists, we only scan the
 973     // global used list here (for moribund threads), and
 974     // the thread-local monitors in Thread::oops_do().
 975     global_used_oops_do(f);
 976   } else {
 977     global_oops_do(f);
 978   }
 979 }
 980 
 981 void ObjectSynchronizer::global_oops_do(OopClosure* f) {
 982   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
 983   PaddedEnd<ObjectMonitor> * block =
 984     (PaddedEnd<ObjectMonitor> *)OrderAccess::load_ptr_acquire(&gBlockList);
 985   for (; block != NULL; block = (PaddedEnd<ObjectMonitor> *)next(block)) {
 986     assert(block->object() == CHAINMARKER, "must be a block header");
 987     for (int i = 1; i < _BLOCKSIZE; i++) {
 988       ObjectMonitor* mid = (ObjectMonitor *)&block[i];


< prev index next >