1678 pt.print_all_references();
1679
1680 // The do_oop work routines of the keep_alive and drain_marking_stack
1681 // oop closures will set the has_overflown flag if we overflow the
1682 // global marking stack.
1683
1684 assert(has_overflown() || _global_mark_stack.is_empty(),
1685 "Mark stack should be empty (unless it has overflown)");
1686
1687 assert(rp->num_q() == active_workers, "why not");
1688
1689 rp->enqueue_discovered_references(executor, &pt);
1690
1691 rp->verify_no_references_recorded();
1692
1693 pt.print_enqueue_phase();
1694
1695 assert(!rp->discovery_enabled(), "Post condition");
1696 }
1697
1698 assert(has_overflown() || _global_mark_stack.is_empty(),
1699 "Mark stack should be empty (unless it has overflown)");
1700
1701 {
1702 GCTraceTime(Debug, gc, phases) debug("Weak Processing", _gc_timer_cm);
1703 WeakProcessor::weak_oops_do(&g1_is_alive, &do_nothing_cl);
1704 }
1705
1706 if (has_overflown()) {
1707 // We can not trust g1_is_alive if the marking stack overflowed
1708 return;
1709 }
1710
1711 assert(_global_mark_stack.is_empty(), "Marking should have completed");
1712
1713 // Unload Klasses, String, Symbols, Code Cache, etc.
1714 if (ClassUnloadingWithConcurrentMark) {
1715 GCTraceTime(Debug, gc, phases) debug("Class Unloading", _gc_timer_cm);
1716 bool purged_classes = SystemDictionary::do_unloading(&g1_is_alive, _gc_timer_cm, false /* Defer cleaning */);
1717 _g1h->complete_cleaning(&g1_is_alive, purged_classes);
1718 } else {
1719 GCTraceTime(Debug, gc, phases) debug("Cleanup", _gc_timer_cm);
1720 // No need to clean string table and symbol table as they are treated as strong roots when
1721 // class unloading is disabled.
1722 _g1h->partial_cleaning(&g1_is_alive, false, false, G1StringDedup::is_enabled());
1723 }
1724 }
1725
1726 // When sampling object counts, we already swapped the mark bitmaps, so we need to use
1727 // the prev bitmap determining liveness.
1728 class G1ObjectCountIsAliveClosure: public BoolObjectClosure {
1729 G1CollectedHeap* _g1h;
1730 public:
1731 G1ObjectCountIsAliveClosure(G1CollectedHeap* g1h) : _g1h(g1h) { }
|
1678 pt.print_all_references();
1679
1680 // The do_oop work routines of the keep_alive and drain_marking_stack
1681 // oop closures will set the has_overflown flag if we overflow the
1682 // global marking stack.
1683
1684 assert(has_overflown() || _global_mark_stack.is_empty(),
1685 "Mark stack should be empty (unless it has overflown)");
1686
1687 assert(rp->num_q() == active_workers, "why not");
1688
1689 rp->enqueue_discovered_references(executor, &pt);
1690
1691 rp->verify_no_references_recorded();
1692
1693 pt.print_enqueue_phase();
1694
1695 assert(!rp->discovery_enabled(), "Post condition");
1696 }
1697
1698 if (has_overflown()) {
1699 // We can not trust g1_is_alive if the marking stack overflowed
1700 return;
1701 }
1702
1703 assert(_global_mark_stack.is_empty(), "Marking should have completed");
1704
1705 {
1706 GCTraceTime(Debug, gc, phases) debug("Weak Processing", _gc_timer_cm);
1707 WeakProcessor::weak_oops_do(&g1_is_alive, &do_nothing_cl);
1708 }
1709
1710 // Unload Klasses, String, Symbols, Code Cache, etc.
1711 if (ClassUnloadingWithConcurrentMark) {
1712 GCTraceTime(Debug, gc, phases) debug("Class Unloading", _gc_timer_cm);
1713 bool purged_classes = SystemDictionary::do_unloading(&g1_is_alive, _gc_timer_cm, false /* Defer cleaning */);
1714 _g1h->complete_cleaning(&g1_is_alive, purged_classes);
1715 } else {
1716 GCTraceTime(Debug, gc, phases) debug("Cleanup", _gc_timer_cm);
1717 // No need to clean string table and symbol table as they are treated as strong roots when
1718 // class unloading is disabled.
1719 _g1h->partial_cleaning(&g1_is_alive, false, false, G1StringDedup::is_enabled());
1720 }
1721 }
1722
1723 // When sampling object counts, we already swapped the mark bitmaps, so we need to use
1724 // the prev bitmap determining liveness.
1725 class G1ObjectCountIsAliveClosure: public BoolObjectClosure {
1726 G1CollectedHeap* _g1h;
1727 public:
1728 G1ObjectCountIsAliveClosure(G1CollectedHeap* g1h) : _g1h(g1h) { }
|