< prev index next >

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

Print this page




  70   }
  71 
  72   virtual bool do_operation() = 0;
  73 
  74   virtual bool doit_prologue() {
  75     Heap_lock->lock();
  76     return true;
  77   }
  78 
  79   virtual void doit() {
  80     // Abort if GC locker state is incompatible
  81     if (needs_inactive_gc_locker() && GCLocker::check_active_before_gc()) {
  82       _gc_locked = true;
  83       return;
  84     }
  85 
  86     // Setup GC id and active marker
  87     GCIdMark gc_id_mark(_gc_id);
  88     IsGCActiveMark gc_active_mark;
  89 
  90     // Verify roots
  91     ZVerify::roots_strong();
  92 
  93     // Execute operation
  94     _success = do_operation();
  95 
  96     // Update statistics
  97     ZStatSample(ZSamplerJavaThreads, Threads::number_of_threads());
  98   }
  99 
 100   virtual void doit_epilogue() {
 101     Heap_lock->unlock();
 102   }
 103 
 104   bool gc_locked() const {
 105     return _gc_locked;
 106   }
 107 
 108   bool success() const {
 109     return _success;
 110   }
 111 };


 194 };
 195 
 196 class VM_ZRelocateStart : public VM_ZOperation {
 197 public:
 198   virtual VMOp_Type type() const {
 199     return VMOp_ZRelocateStart;
 200   }
 201 
 202   virtual bool needs_inactive_gc_locker() const {
 203     return true;
 204   }
 205 
 206   virtual bool do_operation() {
 207     ZStatTimer timer(ZPhasePauseRelocateStart);
 208     ZServiceabilityRelocateStartTracer tracer;
 209     ZHeap::heap()->relocate_start();
 210     return true;
 211   }
 212 };
 213 











 214 ZDriver::ZDriver() :
 215     _gc_cycle_port(),
 216     _gc_locker_port() {
 217   set_name("ZDriver");
 218   create_and_start();
 219 }
 220 
 221 void ZDriver::collect(GCCause::Cause cause) {
 222   switch (cause) {
 223   case GCCause::_wb_young_gc:
 224   case GCCause::_wb_conc_mark:
 225   case GCCause::_wb_full_gc:
 226   case GCCause::_dcmd_gc_run:
 227   case GCCause::_java_lang_system_gc:
 228   case GCCause::_full_gc_alot:
 229   case GCCause::_scavenge_alot:
 230   case GCCause::_jvmti_force_gc:
 231   case GCCause::_metadata_GC_clear_soft_refs:
 232     // Start synchronous GC
 233     _gc_cycle_port.send_sync(cause);


 291 void ZDriver::concurrent_mark_continue() {
 292   ZStatTimer timer(ZPhaseConcurrentMarkContinue);
 293   ZHeap::heap()->mark(false /* initial */);
 294 }
 295 
 296 void ZDriver::concurrent_process_non_strong_references() {
 297   ZStatTimer timer(ZPhaseConcurrentProcessNonStrongReferences);
 298   ZHeap::heap()->process_non_strong_references();
 299 }
 300 
 301 void ZDriver::concurrent_reset_relocation_set() {
 302   ZStatTimer timer(ZPhaseConcurrentResetRelocationSet);
 303   ZHeap::heap()->reset_relocation_set();
 304 }
 305 
 306 void ZDriver::pause_verify() {
 307   if (VerifyBeforeGC || VerifyDuringGC || VerifyAfterGC) {
 308     // Full verification
 309     VM_Verify op;
 310     VMThread::execute(&op);
 311 
 312   } else if (ZVerifyRoots || ZVerifyObjects) {
 313     // Limited verification
 314     VM_ZVerifyOperation op;
 315     VMThread::execute(&op);
 316   }
 317 }
 318 
 319 void ZDriver::concurrent_select_relocation_set() {
 320   ZStatTimer timer(ZPhaseConcurrentSelectRelocationSet);
 321   ZHeap::heap()->select_relocation_set();
 322 }
 323 
 324 void ZDriver::pause_relocate_start() {
 325   pause<VM_ZRelocateStart>();
 326 }
 327 
 328 void ZDriver::concurrent_relocate() {
 329   ZStatTimer timer(ZPhaseConcurrentRelocated);
 330   ZHeap::heap()->relocate();
 331 }
 332 
 333 void ZDriver::check_out_of_memory() {
 334   ZHeap::heap()->check_out_of_memory();




  70   }
  71 
  72   virtual bool do_operation() = 0;
  73 
  74   virtual bool doit_prologue() {
  75     Heap_lock->lock();
  76     return true;
  77   }
  78 
  79   virtual void doit() {
  80     // Abort if GC locker state is incompatible
  81     if (needs_inactive_gc_locker() && GCLocker::check_active_before_gc()) {
  82       _gc_locked = true;
  83       return;
  84     }
  85 
  86     // Setup GC id and active marker
  87     GCIdMark gc_id_mark(_gc_id);
  88     IsGCActiveMark gc_active_mark;
  89 
  90     // Verify before operation
  91     ZVerify::before_zoperation();
  92 
  93     // Execute operation
  94     _success = do_operation();
  95 
  96     // Update statistics
  97     ZStatSample(ZSamplerJavaThreads, Threads::number_of_threads());
  98   }
  99 
 100   virtual void doit_epilogue() {
 101     Heap_lock->unlock();
 102   }
 103 
 104   bool gc_locked() const {
 105     return _gc_locked;
 106   }
 107 
 108   bool success() const {
 109     return _success;
 110   }
 111 };


 194 };
 195 
 196 class VM_ZRelocateStart : public VM_ZOperation {
 197 public:
 198   virtual VMOp_Type type() const {
 199     return VMOp_ZRelocateStart;
 200   }
 201 
 202   virtual bool needs_inactive_gc_locker() const {
 203     return true;
 204   }
 205 
 206   virtual bool do_operation() {
 207     ZStatTimer timer(ZPhasePauseRelocateStart);
 208     ZServiceabilityRelocateStartTracer tracer;
 209     ZHeap::heap()->relocate_start();
 210     return true;
 211   }
 212 };
 213 
 214 class VM_ZVerify : public VM_Operation {
 215 public:
 216   virtual VMOp_Type type() const {
 217     return VMOp_ZVerify;
 218   }
 219 
 220   virtual void doit() {
 221     ZVerify::after_weak_processing();
 222   }
 223 };
 224 
 225 ZDriver::ZDriver() :
 226     _gc_cycle_port(),
 227     _gc_locker_port() {
 228   set_name("ZDriver");
 229   create_and_start();
 230 }
 231 
 232 void ZDriver::collect(GCCause::Cause cause) {
 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);


 302 void ZDriver::concurrent_mark_continue() {
 303   ZStatTimer timer(ZPhaseConcurrentMarkContinue);
 304   ZHeap::heap()->mark(false /* initial */);
 305 }
 306 
 307 void ZDriver::concurrent_process_non_strong_references() {
 308   ZStatTimer timer(ZPhaseConcurrentProcessNonStrongReferences);
 309   ZHeap::heap()->process_non_strong_references();
 310 }
 311 
 312 void ZDriver::concurrent_reset_relocation_set() {
 313   ZStatTimer timer(ZPhaseConcurrentResetRelocationSet);
 314   ZHeap::heap()->reset_relocation_set();
 315 }
 316 
 317 void ZDriver::pause_verify() {
 318   if (VerifyBeforeGC || VerifyDuringGC || VerifyAfterGC) {
 319     // Full verification
 320     VM_Verify op;
 321     VMThread::execute(&op);

 322   } else if (ZVerifyRoots || ZVerifyObjects) {
 323     // Limited verification
 324     VM_ZVerify op;
 325     VMThread::execute(&op);
 326   }
 327 }
 328 
 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();


< prev index next >