18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
21 *
22 */
23
24 #include "precompiled.hpp"
25
26 #include "classfile/classLoaderData.hpp"
27 #include "classfile/classLoaderDataGraph.hpp"
28 #include "gc/shared/referenceProcessor.hpp"
29 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
30 #include "gc/shared/workgroup.hpp"
31 #include "gc/shared/weakProcessor.inline.hpp"
32 #include "gc/shenandoah/shenandoahBarrierSet.hpp"
33 #include "gc/shenandoah/shenandoahClosures.inline.hpp"
34 #include "gc/shenandoah/shenandoahCodeRoots.hpp"
35 #include "gc/shenandoah/shenandoahCollectionSet.hpp"
36 #include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
37 #include "gc/shenandoah/shenandoahFreeSet.hpp"
38 #include "gc/shenandoah/shenandoahForwarding.hpp"
39 #include "gc/shenandoah/shenandoahPhaseTimings.hpp"
40 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
41 #include "gc/shenandoah/shenandoahHeapRegionSet.inline.hpp"
42 #include "gc/shenandoah/shenandoahHeuristics.hpp"
43 #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp"
44 #include "gc/shenandoah/shenandoahOopClosures.inline.hpp"
45 #include "gc/shenandoah/shenandoahRootProcessor.inline.hpp"
46 #include "gc/shenandoah/shenandoahStringDedup.hpp"
47 #include "gc/shenandoah/shenandoahTaskqueue.inline.hpp"
48 #include "gc/shenandoah/shenandoahTimingTracker.hpp"
49 #include "gc/shenandoah/shenandoahTraversalGC.hpp"
50 #include "gc/shenandoah/shenandoahUtils.hpp"
51 #include "gc/shenandoah/shenandoahVerifier.hpp"
52
53 #include "memory/iterator.hpp"
54 #include "memory/metaspace.hpp"
55 #include "memory/resourceArea.hpp"
56
57 /**
58 * NOTE: We are using the SATB buffer in thread.hpp and satbMarkQueue.hpp, however, it is not an SATB algorithm.
621 // Still good? We can now trash the cset, and make final verification
622 {
623 ShenandoahGCPhase phase_cleanup(ShenandoahPhaseTimings::traversal_gc_cleanup);
624 ShenandoahHeapLocker lock(_heap->lock());
625
626 // Trash everything
627 // Clear immediate garbage regions.
628 size_t num_regions = _heap->num_regions();
629
630 ShenandoahHeapRegionSet* traversal_regions = traversal_set();
631 ShenandoahFreeSet* free_regions = _heap->free_set();
632 ShenandoahMarkingContext* const ctx = _heap->marking_context();
633 free_regions->clear();
634 for (size_t i = 0; i < num_regions; i++) {
635 ShenandoahHeapRegion* r = _heap->get_region(i);
636 bool not_allocated = ctx->top_at_mark_start(r) == r->top();
637
638 bool candidate = traversal_regions->is_in(r) && !r->has_live() && not_allocated;
639 if (r->is_humongous_start() && candidate) {
640 // Trash humongous.
641 HeapWord* humongous_obj = r->bottom() + ShenandoahForwarding::word_size();
642 assert(!ctx->is_marked(oop(humongous_obj)), "must not be marked");
643 r->make_trash_immediate();
644 while (i + 1 < num_regions && _heap->get_region(i + 1)->is_humongous_continuation()) {
645 i++;
646 r = _heap->get_region(i);
647 assert(r->is_humongous_continuation(), "must be humongous continuation");
648 r->make_trash_immediate();
649 }
650 } else if (!r->is_empty() && candidate) {
651 // Trash regular.
652 assert(!r->is_humongous(), "handled above");
653 assert(!r->is_trash(), "must not already be trashed");
654 r->make_trash_immediate();
655 }
656 }
657 _heap->collection_set()->clear();
658 _heap->free_set()->rebuild();
659 reset();
660 }
661
|
18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
21 *
22 */
23
24 #include "precompiled.hpp"
25
26 #include "classfile/classLoaderData.hpp"
27 #include "classfile/classLoaderDataGraph.hpp"
28 #include "gc/shared/referenceProcessor.hpp"
29 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
30 #include "gc/shared/workgroup.hpp"
31 #include "gc/shared/weakProcessor.inline.hpp"
32 #include "gc/shenandoah/shenandoahBarrierSet.hpp"
33 #include "gc/shenandoah/shenandoahClosures.inline.hpp"
34 #include "gc/shenandoah/shenandoahCodeRoots.hpp"
35 #include "gc/shenandoah/shenandoahCollectionSet.hpp"
36 #include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
37 #include "gc/shenandoah/shenandoahFreeSet.hpp"
38 #include "gc/shenandoah/shenandoahPhaseTimings.hpp"
39 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
40 #include "gc/shenandoah/shenandoahHeapRegionSet.inline.hpp"
41 #include "gc/shenandoah/shenandoahHeuristics.hpp"
42 #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp"
43 #include "gc/shenandoah/shenandoahOopClosures.inline.hpp"
44 #include "gc/shenandoah/shenandoahRootProcessor.inline.hpp"
45 #include "gc/shenandoah/shenandoahStringDedup.hpp"
46 #include "gc/shenandoah/shenandoahTaskqueue.inline.hpp"
47 #include "gc/shenandoah/shenandoahTimingTracker.hpp"
48 #include "gc/shenandoah/shenandoahTraversalGC.hpp"
49 #include "gc/shenandoah/shenandoahUtils.hpp"
50 #include "gc/shenandoah/shenandoahVerifier.hpp"
51
52 #include "memory/iterator.hpp"
53 #include "memory/metaspace.hpp"
54 #include "memory/resourceArea.hpp"
55
56 /**
57 * NOTE: We are using the SATB buffer in thread.hpp and satbMarkQueue.hpp, however, it is not an SATB algorithm.
620 // Still good? We can now trash the cset, and make final verification
621 {
622 ShenandoahGCPhase phase_cleanup(ShenandoahPhaseTimings::traversal_gc_cleanup);
623 ShenandoahHeapLocker lock(_heap->lock());
624
625 // Trash everything
626 // Clear immediate garbage regions.
627 size_t num_regions = _heap->num_regions();
628
629 ShenandoahHeapRegionSet* traversal_regions = traversal_set();
630 ShenandoahFreeSet* free_regions = _heap->free_set();
631 ShenandoahMarkingContext* const ctx = _heap->marking_context();
632 free_regions->clear();
633 for (size_t i = 0; i < num_regions; i++) {
634 ShenandoahHeapRegion* r = _heap->get_region(i);
635 bool not_allocated = ctx->top_at_mark_start(r) == r->top();
636
637 bool candidate = traversal_regions->is_in(r) && !r->has_live() && not_allocated;
638 if (r->is_humongous_start() && candidate) {
639 // Trash humongous.
640 HeapWord* humongous_obj = r->bottom();
641 assert(!ctx->is_marked(oop(humongous_obj)), "must not be marked");
642 r->make_trash_immediate();
643 while (i + 1 < num_regions && _heap->get_region(i + 1)->is_humongous_continuation()) {
644 i++;
645 r = _heap->get_region(i);
646 assert(r->is_humongous_continuation(), "must be humongous continuation");
647 r->make_trash_immediate();
648 }
649 } else if (!r->is_empty() && candidate) {
650 // Trash regular.
651 assert(!r->is_humongous(), "handled above");
652 assert(!r->is_trash(), "must not already be trashed");
653 r->make_trash_immediate();
654 }
655 }
656 _heap->collection_set()->clear();
657 _heap->free_set()->rebuild();
658 reset();
659 }
660
|