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 if (!is_degenerated_gc_in_progress()) {
1517 evacuate_and_update_roots();
1518 }
1519
1520 if (ShenandoahPacing) {
1521 pacer()->setup_for_evac();
1522 }
1523
1524 if (ShenandoahVerify) {
1525 if (ShenandoahConcurrentRoots::should_do_concurrent_roots()) {
1526 ShenandoahRootVerifier::RootTypes types = ShenandoahRootVerifier::combine(ShenandoahRootVerifier::JNIHandleRoots, ShenandoahRootVerifier::WeakRoots);
1527 verifier()->verify_roots_no_forwarded_except(types);
1528 } else {
1529 verifier()->verify_roots_no_forwarded();
1530 }
1531 verifier()->verify_during_evacuation();
1532 }
1533 } else {
1534 if (ShenandoahVerify) {
1535 verifier()->verify_after_concmark();
1536 }
1537
1538 if (VerifyAfterGC) {
1539 Universe::verify();
1540 }
1541 }
1542
1543 } else {
1544 concurrent_mark()->cancel();
1545 stop_concurrent_marking();
1546
1575 workers()->run_task(&task);
1576 }
1577
1578 void ShenandoahHeap::op_stw_evac() {
1579 ShenandoahEvacuationTask task(this, _collection_set, false);
1580 workers()->run_task(&task);
1581 }
1582
1583 void ShenandoahHeap::op_updaterefs() {
1584 update_heap_references(true);
1585 }
1586
1587 void ShenandoahHeap::op_cleanup() {
1588 free_set()->recycle_trash();
1589 }
1590
1591 class ShenandoahConcurrentRootsEvacUpdateTask : public AbstractGangTask {
1592 private:
1593 ShenandoahJNIHandleRoots<true /*concurrent*/> _jni_roots;
1594 ShenandoahWeakRoots<true /*concurrent*/> _weak_roots;
1595
1596 public:
1597 ShenandoahConcurrentRootsEvacUpdateTask() :
1598 AbstractGangTask("Shenandoah Evacuate/Update Concurrent Roots Task") {
1599 }
1600
1601 void work(uint worker_id) {
1602 ShenandoahEvacOOMScope oom;
1603 ShenandoahEvacuateUpdateRootsClosure cl;
1604
1605 _jni_roots.oops_do<ShenandoahEvacuateUpdateRootsClosure>(&cl);
1606 _weak_roots.oops_do<ShenandoahEvacuateUpdateRootsClosure>(&cl);
1607 }
1608 };
1609
1610 void ShenandoahHeap::op_roots() {
1611 if (is_evacuation_in_progress() &&
1612 ShenandoahConcurrentRoots::should_do_concurrent_roots()) {
1613 ShenandoahConcurrentRootsEvacUpdateTask task;
1614 workers()->run_task(&task);
1615 }
1616 }
1617
1618 void ShenandoahHeap::op_reset() {
1619 reset_mark_bitmap();
1620 }
1621
1622 void ShenandoahHeap::op_preclean() {
1623 concurrent_mark()->preclean_weak_refs();
1624 }
1625
|
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 if (!is_degenerated_gc_in_progress()) {
1517 evacuate_and_update_roots();
1518 }
1519
1520 if (ShenandoahPacing) {
1521 pacer()->setup_for_evac();
1522 }
1523
1524 if (ShenandoahVerify) {
1525 if (ShenandoahConcurrentRoots::should_do_concurrent_roots()) {
1526 ShenandoahRootVerifier::RootTypes types = ShenandoahRootVerifier::combine(ShenandoahRootVerifier::JNIHandleRoots, ShenandoahRootVerifier::WeakRoots);
1527 types = ShenandoahRootVerifier::combine(types, ShenandoahRootVerifier::CLDGRoots);
1528 verifier()->verify_roots_no_forwarded_except(types);
1529 } else {
1530 verifier()->verify_roots_no_forwarded();
1531 }
1532 verifier()->verify_during_evacuation();
1533 }
1534 } else {
1535 if (ShenandoahVerify) {
1536 verifier()->verify_after_concmark();
1537 }
1538
1539 if (VerifyAfterGC) {
1540 Universe::verify();
1541 }
1542 }
1543
1544 } else {
1545 concurrent_mark()->cancel();
1546 stop_concurrent_marking();
1547
1576 workers()->run_task(&task);
1577 }
1578
1579 void ShenandoahHeap::op_stw_evac() {
1580 ShenandoahEvacuationTask task(this, _collection_set, false);
1581 workers()->run_task(&task);
1582 }
1583
1584 void ShenandoahHeap::op_updaterefs() {
1585 update_heap_references(true);
1586 }
1587
1588 void ShenandoahHeap::op_cleanup() {
1589 free_set()->recycle_trash();
1590 }
1591
1592 class ShenandoahConcurrentRootsEvacUpdateTask : public AbstractGangTask {
1593 private:
1594 ShenandoahJNIHandleRoots<true /*concurrent*/> _jni_roots;
1595 ShenandoahWeakRoots<true /*concurrent*/> _weak_roots;
1596 ShenandoahClassLoaderDataRoots<true /*concurrent*/, false /*single threaded*/> _cld_roots;
1597
1598 public:
1599 ShenandoahConcurrentRootsEvacUpdateTask() :
1600 AbstractGangTask("Shenandoah Evacuate/Update Concurrent Roots Task") {
1601 }
1602
1603 void work(uint worker_id) {
1604 ShenandoahEvacOOMScope oom;
1605 ShenandoahEvacuateUpdateRootsClosure cl;
1606 CLDToOopClosure clds(&cl, ClassLoaderData::_claim_strong);
1607
1608 _jni_roots.oops_do<ShenandoahEvacuateUpdateRootsClosure>(&cl);
1609 _cld_roots.cld_do(&clds);
1610 _weak_roots.oops_do<ShenandoahEvacuateUpdateRootsClosure>(&cl);
1611 }
1612 };
1613
1614 void ShenandoahHeap::op_roots() {
1615 if (is_evacuation_in_progress() &&
1616 ShenandoahConcurrentRoots::should_do_concurrent_roots()) {
1617 ShenandoahConcurrentRootsEvacUpdateTask task;
1618 workers()->run_task(&task);
1619 }
1620 }
1621
1622 void ShenandoahHeap::op_reset() {
1623 reset_mark_bitmap();
1624 }
1625
1626 void ShenandoahHeap::op_preclean() {
1627 concurrent_mark()->preclean_weak_refs();
1628 }
1629
|