1643 }
1644
1645 void ShenandoahHeap::op_cleanup_early() {
1646 free_set()->recycle_trash();
1647 }
1648
1649 void ShenandoahHeap::op_cleanup_complete() {
1650 free_set()->recycle_trash();
1651 }
1652
1653 class ShenandoahConcurrentRootsEvacUpdateTask : public AbstractGangTask {
1654 private:
1655 ShenandoahVMRoots<true /*concurrent*/> _vm_roots;
1656 ShenandoahClassLoaderDataRoots<true /*concurrent*/, false /*single threaded*/> _cld_roots;
1657 ShenandoahConcurrentStringDedupRoots _dedup_roots;
1658
1659 public:
1660 ShenandoahConcurrentRootsEvacUpdateTask(ShenandoahPhaseTimings::Phase phase) :
1661 AbstractGangTask("Shenandoah Evacuate/Update Concurrent Strong Roots Task"),
1662 _vm_roots(phase),
1663 _cld_roots(phase) {}
1664
1665 void work(uint worker_id) {
1666 ShenandoahConcurrentWorkerSession worker_session(worker_id);
1667 ShenandoahEvacOOMScope oom;
1668 {
1669 // vm_roots and weak_roots are OopStorage backed roots, concurrent iteration
1670 // may race against OopStorage::release() calls.
1671 ShenandoahEvacUpdateOopStorageRootsClosure cl;
1672 _vm_roots.oops_do<ShenandoahEvacUpdateOopStorageRootsClosure>(&cl, worker_id);
1673 }
1674
1675 {
1676 ShenandoahEvacuateUpdateRootsClosure<> cl;
1677 CLDToOopClosure clds(&cl, ClassLoaderData::_claim_strong);
1678 _cld_roots.cld_do(&clds, worker_id);
1679 }
1680
1681 {
1682 ShenandoahForwardedIsAliveClosure is_alive;
1683 ShenandoahEvacuateUpdateRootsClosure<MO_RELEASE> keep_alive;
1764 class ShenandoahConcurrentWeakRootsEvacUpdateTask : public AbstractGangTask {
1765 private:
1766 ShenandoahWeakRoot<true /*concurrent*/> _jni_roots;
1767 ShenandoahWeakRoot<true /*concurrent*/> _string_table_roots;
1768 ShenandoahWeakRoot<true /*concurrent*/> _resolved_method_table_roots;
1769 ShenandoahWeakRoot<true /*concurrent*/> _vm_roots;
1770
1771 // Roots related to concurrent class unloading
1772 ShenandoahClassLoaderDataRoots<true /* concurrent */, false /* single thread*/>
1773 _cld_roots;
1774 ShenandoahConcurrentNMethodIterator _nmethod_itr;
1775 bool _concurrent_class_unloading;
1776
1777 public:
1778 ShenandoahConcurrentWeakRootsEvacUpdateTask(ShenandoahPhaseTimings::Phase phase) :
1779 AbstractGangTask("Shenandoah Concurrent Weak Root Task"),
1780 _jni_roots(OopStorageSet::jni_weak(), phase, ShenandoahPhaseTimings::JNIWeakRoots),
1781 _string_table_roots(OopStorageSet::string_table_weak(), phase, ShenandoahPhaseTimings::StringTableRoots),
1782 _resolved_method_table_roots(OopStorageSet::resolved_method_table_weak(), phase, ShenandoahPhaseTimings::ResolvedMethodTableRoots),
1783 _vm_roots(OopStorageSet::vm_weak(), phase, ShenandoahPhaseTimings::VMWeakRoots),
1784 _cld_roots(phase),
1785 _nmethod_itr(ShenandoahCodeRoots::table()),
1786 _concurrent_class_unloading(ShenandoahConcurrentRoots::should_do_concurrent_class_unloading()) {
1787 StringTable::reset_dead_counter();
1788 ResolvedMethodTable::reset_dead_counter();
1789 if (_concurrent_class_unloading) {
1790 MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
1791 _nmethod_itr.nmethods_do_begin();
1792 }
1793 }
1794
1795 ~ShenandoahConcurrentWeakRootsEvacUpdateTask() {
1796 StringTable::finish_dead_counter();
1797 ResolvedMethodTable::finish_dead_counter();
1798 if (_concurrent_class_unloading) {
1799 MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
1800 _nmethod_itr.nmethods_do_end();
1801 }
1802 }
1803
1804 void work(uint worker_id) {
|
1643 }
1644
1645 void ShenandoahHeap::op_cleanup_early() {
1646 free_set()->recycle_trash();
1647 }
1648
1649 void ShenandoahHeap::op_cleanup_complete() {
1650 free_set()->recycle_trash();
1651 }
1652
1653 class ShenandoahConcurrentRootsEvacUpdateTask : public AbstractGangTask {
1654 private:
1655 ShenandoahVMRoots<true /*concurrent*/> _vm_roots;
1656 ShenandoahClassLoaderDataRoots<true /*concurrent*/, false /*single threaded*/> _cld_roots;
1657 ShenandoahConcurrentStringDedupRoots _dedup_roots;
1658
1659 public:
1660 ShenandoahConcurrentRootsEvacUpdateTask(ShenandoahPhaseTimings::Phase phase) :
1661 AbstractGangTask("Shenandoah Evacuate/Update Concurrent Strong Roots Task"),
1662 _vm_roots(phase),
1663 _cld_roots(phase, ShenandoahHeap::heap()->workers()->active_workers()) {}
1664
1665 void work(uint worker_id) {
1666 ShenandoahConcurrentWorkerSession worker_session(worker_id);
1667 ShenandoahEvacOOMScope oom;
1668 {
1669 // vm_roots and weak_roots are OopStorage backed roots, concurrent iteration
1670 // may race against OopStorage::release() calls.
1671 ShenandoahEvacUpdateOopStorageRootsClosure cl;
1672 _vm_roots.oops_do<ShenandoahEvacUpdateOopStorageRootsClosure>(&cl, worker_id);
1673 }
1674
1675 {
1676 ShenandoahEvacuateUpdateRootsClosure<> cl;
1677 CLDToOopClosure clds(&cl, ClassLoaderData::_claim_strong);
1678 _cld_roots.cld_do(&clds, worker_id);
1679 }
1680
1681 {
1682 ShenandoahForwardedIsAliveClosure is_alive;
1683 ShenandoahEvacuateUpdateRootsClosure<MO_RELEASE> keep_alive;
1764 class ShenandoahConcurrentWeakRootsEvacUpdateTask : public AbstractGangTask {
1765 private:
1766 ShenandoahWeakRoot<true /*concurrent*/> _jni_roots;
1767 ShenandoahWeakRoot<true /*concurrent*/> _string_table_roots;
1768 ShenandoahWeakRoot<true /*concurrent*/> _resolved_method_table_roots;
1769 ShenandoahWeakRoot<true /*concurrent*/> _vm_roots;
1770
1771 // Roots related to concurrent class unloading
1772 ShenandoahClassLoaderDataRoots<true /* concurrent */, false /* single thread*/>
1773 _cld_roots;
1774 ShenandoahConcurrentNMethodIterator _nmethod_itr;
1775 bool _concurrent_class_unloading;
1776
1777 public:
1778 ShenandoahConcurrentWeakRootsEvacUpdateTask(ShenandoahPhaseTimings::Phase phase) :
1779 AbstractGangTask("Shenandoah Concurrent Weak Root Task"),
1780 _jni_roots(OopStorageSet::jni_weak(), phase, ShenandoahPhaseTimings::JNIWeakRoots),
1781 _string_table_roots(OopStorageSet::string_table_weak(), phase, ShenandoahPhaseTimings::StringTableRoots),
1782 _resolved_method_table_roots(OopStorageSet::resolved_method_table_weak(), phase, ShenandoahPhaseTimings::ResolvedMethodTableRoots),
1783 _vm_roots(OopStorageSet::vm_weak(), phase, ShenandoahPhaseTimings::VMWeakRoots),
1784 _cld_roots(phase, ShenandoahHeap::heap()->workers()->active_workers()),
1785 _nmethod_itr(ShenandoahCodeRoots::table()),
1786 _concurrent_class_unloading(ShenandoahConcurrentRoots::should_do_concurrent_class_unloading()) {
1787 StringTable::reset_dead_counter();
1788 ResolvedMethodTable::reset_dead_counter();
1789 if (_concurrent_class_unloading) {
1790 MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
1791 _nmethod_itr.nmethods_do_begin();
1792 }
1793 }
1794
1795 ~ShenandoahConcurrentWeakRootsEvacUpdateTask() {
1796 StringTable::finish_dead_counter();
1797 ResolvedMethodTable::finish_dead_counter();
1798 if (_concurrent_class_unloading) {
1799 MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
1800 _nmethod_itr.nmethods_do_end();
1801 }
1802 }
1803
1804 void work(uint worker_id) {
|