< prev index next >

src/share/vm/runtime/synchronizer.cpp

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


 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 static bool monitors_used_above_threshold() {
 966   int monitors_used = gMonitorPopulation - gMonitorFreeCount;
 967   int monitor_useage = (monitors_used * 100LL) / gMonitorPopulation;
 968   return monitor_useage > MonitorUsedDeflationThreshold;
 969 }
 970 
 971 bool ObjectSynchronizer::is_cleanup_needed() {
 972   if (MonitorUsedDeflationThreshold > 0) {
 973     return monitors_used_above_threshold();
 974   }
 975   return false;
 976 }
 977 
 978 void ObjectSynchronizer::oops_do(OopClosure* f) {
 979   if (MonitorInUseLists) {
 980     // When using thread local monitor lists, we only scan the
 981     // global used list here (for moribund threads), and
 982     // the thread-local monitors in Thread::oops_do().
 983     global_used_oops_do(f);
 984   } else {
 985     global_oops_do(f);
 986   }
 987 }
 988 
 989 void ObjectSynchronizer::global_oops_do(OopClosure* f) {
 990   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
 991   PaddedEnd<ObjectMonitor> * block =
 992     (PaddedEnd<ObjectMonitor> *)OrderAccess::load_ptr_acquire(&gBlockList);
 993   for (; block != NULL; block = (PaddedEnd<ObjectMonitor> *)next(block)) {
 994     assert(block->object() == CHAINMARKER, "must be a block header");
 995     for (int i = 1; i < _BLOCKSIZE; i++) {
 996       ObjectMonitor* mid = (ObjectMonitor *)&block[i];


< prev index next >