< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp

Print this page
rev 55429 : 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots


1504     // Otherwise, bypass the rest of the cycle.
1505     if (!collection_set()->is_empty()) {
1506       ShenandoahGCPhase init_evac(ShenandoahPhaseTimings::init_evac);
1507 
1508       if (ShenandoahVerify) {
1509         verifier()->verify_before_evacuation();
1510       }
1511 
1512       set_evacuation_in_progress(true);
1513       // From here on, we need to update references.
1514       set_has_forwarded_objects(true);
1515 
1516       evacuate_and_update_roots();
1517 
1518       if (ShenandoahPacing) {
1519         pacer()->setup_for_evac();
1520       }
1521 
1522       if (ShenandoahVerify) {
1523         if (ShenandoahConcurrentRoots::should_do_concurrent_roots()) {
1524           verifier()->verify_roots_no_forwarded_except(ShenandoahRootVerifier::JNIHandleRoots);

1525         } else {
1526           verifier()->verify_roots_no_forwarded();
1527         }
1528         verifier()->verify_during_evacuation();
1529       }
1530     } else {
1531       if (ShenandoahVerify) {
1532         verifier()->verify_after_concmark();
1533       }
1534 
1535       if (VerifyAfterGC) {
1536         Universe::verify();
1537       }
1538     }
1539 
1540   } else {
1541     concurrent_mark()->cancel();
1542     stop_concurrent_marking();
1543 
1544     if (process_references()) {


1571   ShenandoahEvacuationTask task(this, _collection_set, true);
1572   workers()->run_task(&task);
1573 }
1574 
1575 void ShenandoahHeap::op_stw_evac() {
1576   ShenandoahEvacuationTask task(this, _collection_set, false);
1577   workers()->run_task(&task);
1578 }
1579 
1580 void ShenandoahHeap::op_updaterefs() {
1581   update_heap_references(true);
1582 }
1583 
1584 void ShenandoahHeap::op_cleanup() {
1585   free_set()->recycle_trash();
1586 }
1587 
1588 class ShenandoahConcurrentRootsEvacUpdateTask : public AbstractGangTask {
1589 private:
1590   ShenandoahJNIHandleRoots<true /*concurrent*/>         _jni_roots;

1591 
1592 public:
1593   ShenandoahConcurrentRootsEvacUpdateTask() :
1594     AbstractGangTask("Shenandoah Evacuate/Update Concurrent Roots Task") {
1595   }
1596 
1597   void work(uint worker_id) {
1598     ShenandoahEvacOOMScope oom;
1599     ShenandoahEvacuateUpdateRootsClosure cl;

1600     _jni_roots.oops_do<ShenandoahEvacuateUpdateRootsClosure>(&cl);

1601   }
1602 };
1603 
1604 void ShenandoahHeap::op_roots() {
1605   if (is_evacuation_in_progress() &&
1606       ShenandoahConcurrentRoots::should_do_concurrent_roots()) {
1607     ShenandoahConcurrentRootsEvacUpdateTask task;
1608     workers()->run_task(&task);
1609   }
1610 }
1611 
1612 void ShenandoahHeap::op_reset() {
1613   reset_mark_bitmap();
1614 }
1615 
1616 void ShenandoahHeap::op_preclean() {
1617   concurrent_mark()->preclean_weak_refs();
1618 }
1619 
1620 void ShenandoahHeap::op_init_traversal() {




1504     // Otherwise, bypass the rest of the cycle.
1505     if (!collection_set()->is_empty()) {
1506       ShenandoahGCPhase init_evac(ShenandoahPhaseTimings::init_evac);
1507 
1508       if (ShenandoahVerify) {
1509         verifier()->verify_before_evacuation();
1510       }
1511 
1512       set_evacuation_in_progress(true);
1513       // From here on, we need to update references.
1514       set_has_forwarded_objects(true);
1515 
1516       evacuate_and_update_roots();
1517 
1518       if (ShenandoahPacing) {
1519         pacer()->setup_for_evac();
1520       }
1521 
1522       if (ShenandoahVerify) {
1523         if (ShenandoahConcurrentRoots::should_do_concurrent_roots()) {
1524           ShenandoahRootVerifier::RootTypes types = ShenandoahRootVerifier::combine(ShenandoahRootVerifier::JNIHandleRoots, ShenandoahRootVerifier::WeakRoots);
1525           verifier()->verify_roots_no_forwarded_except(types);
1526         } else {
1527           verifier()->verify_roots_no_forwarded();
1528         }
1529         verifier()->verify_during_evacuation();
1530       }
1531     } else {
1532       if (ShenandoahVerify) {
1533         verifier()->verify_after_concmark();
1534       }
1535 
1536       if (VerifyAfterGC) {
1537         Universe::verify();
1538       }
1539     }
1540 
1541   } else {
1542     concurrent_mark()->cancel();
1543     stop_concurrent_marking();
1544 
1545     if (process_references()) {


1572   ShenandoahEvacuationTask task(this, _collection_set, true);
1573   workers()->run_task(&task);
1574 }
1575 
1576 void ShenandoahHeap::op_stw_evac() {
1577   ShenandoahEvacuationTask task(this, _collection_set, false);
1578   workers()->run_task(&task);
1579 }
1580 
1581 void ShenandoahHeap::op_updaterefs() {
1582   update_heap_references(true);
1583 }
1584 
1585 void ShenandoahHeap::op_cleanup() {
1586   free_set()->recycle_trash();
1587 }
1588 
1589 class ShenandoahConcurrentRootsEvacUpdateTask : public AbstractGangTask {
1590 private:
1591   ShenandoahJNIHandleRoots<true /*concurrent*/>         _jni_roots;
1592   ShenandoahWeakRoots<true /*concurrent*/>              _weak_roots;
1593 
1594 public:
1595   ShenandoahConcurrentRootsEvacUpdateTask() :
1596     AbstractGangTask("Shenandoah Evacuate/Update Concurrent Roots Task") {
1597   }
1598 
1599   void work(uint worker_id) {
1600     ShenandoahEvacOOMScope oom;
1601     ShenandoahEvacuateUpdateRootsClosure cl;
1602 
1603     _jni_roots.oops_do<ShenandoahEvacuateUpdateRootsClosure>(&cl);
1604     _weak_roots.oops_do<ShenandoahEvacuateUpdateRootsClosure>(&cl);
1605   }
1606 };
1607 
1608 void ShenandoahHeap::op_roots() {
1609   if (is_evacuation_in_progress() &&
1610       ShenandoahConcurrentRoots::should_do_concurrent_roots()) {
1611     ShenandoahConcurrentRootsEvacUpdateTask task;
1612     workers()->run_task(&task);
1613   }
1614 }
1615 
1616 void ShenandoahHeap::op_reset() {
1617   reset_mark_bitmap();
1618 }
1619 
1620 void ShenandoahHeap::op_preclean() {
1621   concurrent_mark()->preclean_weak_refs();
1622 }
1623 
1624 void ShenandoahHeap::op_init_traversal() {


< prev index next >