src/hotspot/share/gc/z/zDriver.cpp
changeset 59148 877c000fd688
parent 58701 5d10ba4a0468
equal deleted inserted replaced
59147:e735301d76b9 59148:877c000fd688
   248   case GCCause::_z_warmup:
   248   case GCCause::_z_warmup:
   249   case GCCause::_z_allocation_rate:
   249   case GCCause::_z_allocation_rate:
   250   case GCCause::_z_allocation_stall:
   250   case GCCause::_z_allocation_stall:
   251   case GCCause::_z_proactive:
   251   case GCCause::_z_proactive:
   252   case GCCause::_z_high_usage:
   252   case GCCause::_z_high_usage:
       
   253   case GCCause::_metadata_GC_threshold:
   253     // Start asynchronous GC
   254     // Start asynchronous GC
   254     _gc_cycle_port.send_async(cause);
   255     _gc_cycle_port.send_async(cause);
   255     break;
       
   256 
       
   257   case GCCause::_metadata_GC_threshold:
       
   258     // Start asynchronous GC, but only if the GC is warm
       
   259     if (ZStatCycle::is_warm()) {
       
   260       _gc_cycle_port.send_async(cause);
       
   261     }
       
   262     break;
   256     break;
   263 
   257 
   264   case GCCause::_gc_locker:
   258   case GCCause::_gc_locker:
   265     // Restart VM operation previously blocked by the GC locker
   259     // Restart VM operation previously blocked by the GC locker
   266     _gc_locker_port.signal();
   260     _gc_locker_port.signal();
   350   ZHeap::heap()->check_out_of_memory();
   344   ZHeap::heap()->check_out_of_memory();
   351 }
   345 }
   352 
   346 
   353 class ZDriverGCScope : public StackObj {
   347 class ZDriverGCScope : public StackObj {
   354 private:
   348 private:
   355   GCIdMark      _gc_id;
   349   GCIdMark       _gc_id;
   356   GCCauseSetter _gc_cause_setter;
   350   GCCause::Cause _gc_cause;
   357   ZStatTimer    _timer;
   351   GCCauseSetter  _gc_cause_setter;
       
   352   ZStatTimer     _timer;
   358 
   353 
   359 public:
   354 public:
   360   ZDriverGCScope(GCCause::Cause cause) :
   355   ZDriverGCScope(GCCause::Cause cause) :
   361       _gc_id(),
   356       _gc_id(),
       
   357       _gc_cause(cause),
   362       _gc_cause_setter(ZCollectedHeap::heap(), cause),
   358       _gc_cause_setter(ZCollectedHeap::heap(), cause),
   363       _timer(ZPhaseCycle) {
   359       _timer(ZPhaseCycle) {
   364     // Update statistics
   360     // Update statistics
   365     ZStatCycle::at_start();
   361     ZStatCycle::at_start();
   366   }
   362   }
   369     // Calculate boost factor
   365     // Calculate boost factor
   370     const double boost_factor = (double)ZHeap::heap()->nconcurrent_worker_threads() /
   366     const double boost_factor = (double)ZHeap::heap()->nconcurrent_worker_threads() /
   371                                 (double)ZHeap::heap()->nconcurrent_no_boost_worker_threads();
   367                                 (double)ZHeap::heap()->nconcurrent_no_boost_worker_threads();
   372 
   368 
   373     // Update statistics
   369     // Update statistics
   374     ZStatCycle::at_end(boost_factor);
   370     ZStatCycle::at_end(_gc_cause, boost_factor);
   375 
   371 
   376     // Update data used by soft reference policy
   372     // Update data used by soft reference policy
   377     Universe::update_heap_info_at_gc();
   373     Universe::update_heap_info_at_gc();
   378   }
   374   }
   379 };
   375 };