< prev index next >

src/hotspot/share/gc/z/zDriver.cpp

Print this page




 233   switch (cause) {
 234   case GCCause::_wb_young_gc:
 235   case GCCause::_wb_conc_mark:
 236   case GCCause::_wb_full_gc:
 237   case GCCause::_dcmd_gc_run:
 238   case GCCause::_java_lang_system_gc:
 239   case GCCause::_full_gc_alot:
 240   case GCCause::_scavenge_alot:
 241   case GCCause::_jvmti_force_gc:
 242   case GCCause::_metadata_GC_clear_soft_refs:
 243     // Start synchronous GC
 244     _gc_cycle_port.send_sync(cause);
 245     break;
 246 
 247   case GCCause::_z_timer:
 248   case GCCause::_z_warmup:
 249   case GCCause::_z_allocation_rate:
 250   case GCCause::_z_allocation_stall:
 251   case GCCause::_z_proactive:
 252   case GCCause::_z_high_usage:

 253     // Start asynchronous GC
 254     _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;
 263 
 264   case GCCause::_gc_locker:
 265     // Restart VM operation previously blocked by the GC locker
 266     _gc_locker_port.signal();
 267     break;
 268 
 269   default:
 270     // Other causes not supported
 271     fatal("Unsupported GC cause (%s)", GCCause::to_string(cause));
 272     break;
 273   }
 274 }
 275 
 276 template <typename T>
 277 bool ZDriver::pause() {
 278   for (;;) {
 279     T op;
 280     VMThread::execute(&op);
 281     if (op.gc_locked()) {
 282       // Wait for GC to become unlocked and restart the VM operation
 283       ZStatTimer timer(ZCriticalPhaseGCLockerStall);


 335 void ZDriver::concurrent_select_relocation_set() {
 336   ZStatTimer timer(ZPhaseConcurrentSelectRelocationSet);
 337   ZHeap::heap()->select_relocation_set();
 338 }
 339 
 340 void ZDriver::pause_relocate_start() {
 341   pause<VM_ZRelocateStart>();
 342 }
 343 
 344 void ZDriver::concurrent_relocate() {
 345   ZStatTimer timer(ZPhaseConcurrentRelocated);
 346   ZHeap::heap()->relocate();
 347 }
 348 
 349 void ZDriver::check_out_of_memory() {
 350   ZHeap::heap()->check_out_of_memory();
 351 }
 352 
 353 class ZDriverGCScope : public StackObj {
 354 private:
 355   GCIdMark      _gc_id;
 356   GCCauseSetter _gc_cause_setter;
 357   ZStatTimer    _timer;

 358 
 359 public:
 360   ZDriverGCScope(GCCause::Cause cause) :
 361       _gc_id(),

 362       _gc_cause_setter(ZCollectedHeap::heap(), cause),
 363       _timer(ZPhaseCycle) {
 364     // Update statistics
 365     ZStatCycle::at_start();
 366   }
 367 
 368   ~ZDriverGCScope() {
 369     // Calculate boost factor
 370     const double boost_factor = (double)ZHeap::heap()->nconcurrent_worker_threads() /
 371                                 (double)ZHeap::heap()->nconcurrent_no_boost_worker_threads();
 372 
 373     // Update statistics
 374     ZStatCycle::at_end(boost_factor);
 375 
 376     // Update data used by soft reference policy
 377     Universe::update_heap_info_at_gc();
 378   }
 379 };
 380 
 381 void ZDriver::gc(GCCause::Cause cause) {
 382   ZDriverGCScope scope(cause);
 383 
 384   // Phase 1: Pause Mark Start
 385   pause_mark_start();
 386 
 387   // Phase 2: Concurrent Mark
 388   concurrent_mark();
 389 
 390   // Phase 3: Pause Mark End
 391   while (!pause_mark_end()) {
 392     // Phase 3.5: Concurrent Mark Continue
 393     concurrent_mark_continue();
 394   }




 233   switch (cause) {
 234   case GCCause::_wb_young_gc:
 235   case GCCause::_wb_conc_mark:
 236   case GCCause::_wb_full_gc:
 237   case GCCause::_dcmd_gc_run:
 238   case GCCause::_java_lang_system_gc:
 239   case GCCause::_full_gc_alot:
 240   case GCCause::_scavenge_alot:
 241   case GCCause::_jvmti_force_gc:
 242   case GCCause::_metadata_GC_clear_soft_refs:
 243     // Start synchronous GC
 244     _gc_cycle_port.send_sync(cause);
 245     break;
 246 
 247   case GCCause::_z_timer:
 248   case GCCause::_z_warmup:
 249   case GCCause::_z_allocation_rate:
 250   case GCCause::_z_allocation_stall:
 251   case GCCause::_z_proactive:
 252   case GCCause::_z_high_usage:
 253   case GCCause::_metadata_GC_threshold:
 254     // Start asynchronous GC
 255     _gc_cycle_port.send_async(cause);
 256     break;
 257 







 258   case GCCause::_gc_locker:
 259     // Restart VM operation previously blocked by the GC locker
 260     _gc_locker_port.signal();
 261     break;
 262 
 263   default:
 264     // Other causes not supported
 265     fatal("Unsupported GC cause (%s)", GCCause::to_string(cause));
 266     break;
 267   }
 268 }
 269 
 270 template <typename T>
 271 bool ZDriver::pause() {
 272   for (;;) {
 273     T op;
 274     VMThread::execute(&op);
 275     if (op.gc_locked()) {
 276       // Wait for GC to become unlocked and restart the VM operation
 277       ZStatTimer timer(ZCriticalPhaseGCLockerStall);


 329 void ZDriver::concurrent_select_relocation_set() {
 330   ZStatTimer timer(ZPhaseConcurrentSelectRelocationSet);
 331   ZHeap::heap()->select_relocation_set();
 332 }
 333 
 334 void ZDriver::pause_relocate_start() {
 335   pause<VM_ZRelocateStart>();
 336 }
 337 
 338 void ZDriver::concurrent_relocate() {
 339   ZStatTimer timer(ZPhaseConcurrentRelocated);
 340   ZHeap::heap()->relocate();
 341 }
 342 
 343 void ZDriver::check_out_of_memory() {
 344   ZHeap::heap()->check_out_of_memory();
 345 }
 346 
 347 class ZDriverGCScope : public StackObj {
 348 private:
 349   GCIdMark       _gc_id;
 350   GCCause::Cause _gc_cause;
 351   GCCauseSetter  _gc_cause_setter;
 352   ZStatTimer     _timer;
 353 
 354 public:
 355   ZDriverGCScope(GCCause::Cause cause) :
 356       _gc_id(),
 357       _gc_cause(cause),
 358       _gc_cause_setter(ZCollectedHeap::heap(), cause),
 359       _timer(ZPhaseCycle) {
 360     // Update statistics
 361     ZStatCycle::at_start();
 362   }
 363 
 364   ~ZDriverGCScope() {
 365     // Calculate boost factor
 366     const double boost_factor = (double)ZHeap::heap()->nconcurrent_worker_threads() /
 367                                 (double)ZHeap::heap()->nconcurrent_no_boost_worker_threads();
 368 
 369     // Update statistics
 370     ZStatCycle::at_end(_gc_cause, boost_factor);
 371 
 372     // Update data used by soft reference policy
 373     Universe::update_heap_info_at_gc();
 374   }
 375 };
 376 
 377 void ZDriver::gc(GCCause::Cause cause) {
 378   ZDriverGCScope scope(cause);
 379 
 380   // Phase 1: Pause Mark Start
 381   pause_mark_start();
 382 
 383   // Phase 2: Concurrent Mark
 384   concurrent_mark();
 385 
 386   // Phase 3: Pause Mark End
 387   while (!pause_mark_end()) {
 388     // Phase 3.5: Concurrent Mark Continue
 389     concurrent_mark_continue();
 390   }


< prev index next >