< prev index next >

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

Print this page




 349     // Marking not completed, continue concurrent mark
 350     return false;
 351   }
 352 
 353   // Enter mark completed phase
 354   ZGlobalPhase = ZPhaseMarkCompleted;
 355 
 356   // Resize metaspace
 357   MetaspaceGC::compute_new_size();
 358 
 359   // Update statistics
 360   ZStatSample(ZSamplerHeapUsedAfterMark, used());
 361   ZStatHeap::set_at_mark_end(capacity(), allocated(), used());
 362 
 363   // Block resurrection of weak/phantom references
 364   ZResurrection::block();
 365 
 366   // Process weak roots
 367   _weak_roots_processor.process_weak_roots();
 368 
 369   // Verification
 370   if (VerifyBeforeGC || VerifyDuringGC || VerifyAfterGC) {
 371     Universe::verify();
 372   }
 373 
 374   return true;
 375 }
 376 
 377 void ZHeap::set_soft_reference_policy(bool clear) {
 378   _reference_processor.set_soft_reference_policy(clear);
 379 }
 380 
 381 void ZHeap::process_non_strong_references() {
 382   // Process Soft/Weak/Final/PhantomReferences
 383   _reference_processor.process_references();
 384 
 385   // Process concurrent weak roots
 386   _weak_roots_processor.process_concurrent_weak_roots();
 387 
 388   // Unblock resurrection of weak/phantom references
 389   ZResurrection::unblock();
 390 
 391   // Enqueue Soft/Weak/Final/PhantomReferences. Note that this
 392   // must be done after unblocking resurrection. Otherwise the
 393   // Finalizer thread could call Reference.get() on the Finalizers


 553   ZPageTableIterator iter(&_pagetable);
 554   for (ZPage* page; iter.next(&page);) {
 555     page->print_on(st);
 556   }
 557 
 558   st->cr();
 559 }
 560 
 561 class ZVerifyRootsTask : public ZTask {
 562 private:
 563   ZRootsIterator     _strong_roots;
 564   ZWeakRootsIterator _weak_roots;
 565 
 566 public:
 567   ZVerifyRootsTask() :
 568       ZTask("ZVerifyRootsTask"),
 569       _strong_roots(),
 570       _weak_roots() {}
 571 
 572   virtual void work() {
 573     ZVerifyRootOopClosure cl;
 574     _strong_roots.oops_do(&cl);
 575     _weak_roots.oops_do(&cl);
 576   }
 577 };
 578 
 579 void ZHeap::verify() {
 580   // Heap verification can only be done between mark end and
 581   // relocate start. This is the only window where all oop are
 582   // good and the whole heap is in a consistent state.
 583   guarantee(ZGlobalPhase == ZPhaseMarkCompleted, "Invalid phase");
 584 
 585   {
 586     ZVerifyRootsTask task;
 587     _workers.run_parallel(&task);
 588   }
 589 
 590   {
 591     ZVerifyObjectClosure cl;
 592     object_iterate(&cl, false /* visit_referents */);
 593   }


 349     // Marking not completed, continue concurrent mark
 350     return false;
 351   }
 352 
 353   // Enter mark completed phase
 354   ZGlobalPhase = ZPhaseMarkCompleted;
 355 
 356   // Resize metaspace
 357   MetaspaceGC::compute_new_size();
 358 
 359   // Update statistics
 360   ZStatSample(ZSamplerHeapUsedAfterMark, used());
 361   ZStatHeap::set_at_mark_end(capacity(), allocated(), used());
 362 
 363   // Block resurrection of weak/phantom references
 364   ZResurrection::block();
 365 
 366   // Process weak roots
 367   _weak_roots_processor.process_weak_roots();
 368 





 369   return true;
 370 }
 371 
 372 void ZHeap::set_soft_reference_policy(bool clear) {
 373   _reference_processor.set_soft_reference_policy(clear);
 374 }
 375 
 376 void ZHeap::process_non_strong_references() {
 377   // Process Soft/Weak/Final/PhantomReferences
 378   _reference_processor.process_references();
 379 
 380   // Process concurrent weak roots
 381   _weak_roots_processor.process_concurrent_weak_roots();
 382 
 383   // Unblock resurrection of weak/phantom references
 384   ZResurrection::unblock();
 385 
 386   // Enqueue Soft/Weak/Final/PhantomReferences. Note that this
 387   // must be done after unblocking resurrection. Otherwise the
 388   // Finalizer thread could call Reference.get() on the Finalizers


 548   ZPageTableIterator iter(&_pagetable);
 549   for (ZPage* page; iter.next(&page);) {
 550     page->print_on(st);
 551   }
 552 
 553   st->cr();
 554 }
 555 
 556 class ZVerifyRootsTask : public ZTask {
 557 private:
 558   ZRootsIterator     _strong_roots;
 559   ZWeakRootsIterator _weak_roots;
 560 
 561 public:
 562   ZVerifyRootsTask() :
 563       ZTask("ZVerifyRootsTask"),
 564       _strong_roots(),
 565       _weak_roots() {}
 566 
 567   virtual void work() {
 568     ZVerifyOopClosure cl;
 569     _strong_roots.oops_do(&cl);
 570     _weak_roots.oops_do(&cl);
 571   }
 572 };
 573 
 574 void ZHeap::verify() {
 575   // Heap verification can only be done between mark end and
 576   // relocate start. This is the only window where all oop are
 577   // good and the whole heap is in a consistent state.
 578   guarantee(ZGlobalPhase == ZPhaseMarkCompleted, "Invalid phase");
 579 
 580   {
 581     ZVerifyRootsTask task;
 582     _workers.run_parallel(&task);
 583   }
 584 
 585   {
 586     ZVerifyObjectClosure cl;
 587     object_iterate(&cl, false /* visit_referents */);
 588   }
< prev index next >