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 public:
1592 ShenandoahConcurrentRootsEvacUpdateTask() :
1593 AbstractGangTask("Shenandoah Evacuate/Update Concurrent Roots Task") {
1594 }
1595
1596 void work(uint worker_id) {
1597 ShenandoahEvacOOMScope oom;
1598 ShenandoahEvacuateUpdateRootsClosure cl;
1599 _jni_roots.oops_do<ShenandoahEvacuateUpdateRootsClosure>(&cl);
1600 }
1601 };
1602
1603 void ShenandoahHeap::op_concurrent_roots() {
1604 if (is_evacuation_in_progress() &&
1605 ShenandoahConcurrentRoots::should_do_concurrent_roots()) {
1606 ShenandoahConcurrentRootsEvacUpdateTask task;
1607 workers()->run_task(&task);
1608 }
1609 }
1610
1611 void ShenandoahHeap::op_reset() {
1612 reset_mark_bitmap();
1613 }
1614
1615 void ShenandoahHeap::op_preclean() {
1616 concurrent_mark()->preclean_weak_refs();
1617 }
1618
1619 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 public:
1594 ShenandoahConcurrentRootsEvacUpdateTask() :
1595 AbstractGangTask("Shenandoah Evacuate/Update Concurrent Roots Task") {
1596 }
1597
1598 void work(uint worker_id) {
1599 ShenandoahEvacOOMScope oom;
1600 ShenandoahEvacuateUpdateRootsClosure cl;
1601
1602 _jni_roots.oops_do<ShenandoahEvacuateUpdateRootsClosure>(&cl);
1603 _weak_roots.oops_do<ShenandoahEvacuateUpdateRootsClosure>(&cl);
1604 }
1605 };
1606
1607 void ShenandoahHeap::op_concurrent_roots() {
1608 if (is_evacuation_in_progress() &&
1609 ShenandoahConcurrentRoots::should_do_concurrent_roots()) {
1610 ShenandoahConcurrentRootsEvacUpdateTask task;
1611 workers()->run_task(&task);
1612 }
1613 }
1614
1615 void ShenandoahHeap::op_reset() {
1616 reset_mark_bitmap();
1617 }
1618
1619 void ShenandoahHeap::op_preclean() {
1620 concurrent_mark()->preclean_weak_refs();
1621 }
1622
1623 void ShenandoahHeap::op_init_traversal() {
|