< prev index next >
src/hotspot/share/gc/g1/g1FullCollector.cpp
Print this page
rev 47825 : 8189733: Cleanup Full GC setup and tear down
Reviewed-by:
@@ -33,10 +33,11 @@
#include "gc/g1/g1FullGCMarkTask.hpp"
#include "gc/g1/g1FullGCPrepareTask.hpp"
#include "gc/g1/g1FullGCReferenceProcessorExecutor.hpp"
#include "gc/g1/g1FullGCScope.hpp"
#include "gc/g1/g1OopClosures.hpp"
+#include "gc/g1/g1Policy.hpp"
#include "gc/g1/g1StringDedup.hpp"
#include "gc/shared/gcTraceTime.inline.hpp"
#include "gc/shared/preservedMarks.hpp"
#include "gc/shared/referenceProcessor.hpp"
#include "gc/shared/weakProcessor.hpp"
@@ -60,24 +61,28 @@
#if COMPILER2_OR_JVMCI
DerivedPointerTable::update_pointers();
#endif
}
-G1FullCollector::G1FullCollector(G1FullGCScope* scope,
- ReferenceProcessor* reference_processor,
- G1CMBitMap* bitmap,
- uint workers) :
- _scope(scope),
- _num_workers(workers),
- _mark_bitmap(bitmap),
+G1CMBitMap* G1FullCollector::mark_bitmap() {
+ return heap()->concurrent_mark()->next_mark_bitmap();
+}
+
+ReferenceProcessor* G1FullCollector::reference_processor() {
+ return heap()->ref_processor_stw();
+}
+
+G1FullCollector::G1FullCollector(G1CollectedHeap* heap, bool explicit_gc, bool clear_soft_refs) :
+ _heap(heap),
+ _scope(explicit_gc, clear_soft_refs),
+ _num_workers(_heap->workers()->active_workers()),
_oop_queue_set(_num_workers),
_array_queue_set(_num_workers),
_preserved_marks_set(true),
- _reference_processor(reference_processor),
_serial_compaction_point(),
- _is_alive(_mark_bitmap),
- _is_alive_mutator(_reference_processor, &_is_alive) {
+ _is_alive(mark_bitmap()),
+ _is_alive_mutator(reference_processor(), &_is_alive) {
assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint");
_preserved_marks_set.init(_num_workers);
_markers = NEW_C_HEAP_ARRAY(G1FullGCMarker*, _num_workers, mtGC);
_compaction_points = NEW_C_HEAP_ARRAY(G1FullGCCompactionPoint*, _num_workers, mtGC);
@@ -97,12 +102,23 @@
FREE_C_HEAP_ARRAY(G1FullGCMarker*, _markers);
FREE_C_HEAP_ARRAY(G1FullGCCompactionPoint*, _compaction_points);
}
void G1FullCollector::prepare_collection() {
- _reference_processor->enable_discovery();
- _reference_processor->setup_policy(scope()->should_clear_soft_refs());
+ heap()->g1_policy()->record_full_collection_start();
+
+ heap()->print_heap_before_gc();
+ heap()->print_heap_regions();
+
+ heap()->abort_concurrent_cycle();
+ heap()->verify_before_full_collection(scope()->is_explicit_gc());
+
+ heap()->gc_prologue(true);
+ heap()->prepare_heap_for_full_collection();
+
+ reference_processor()->enable_discovery();
+ reference_processor()->setup_policy(scope()->should_clear_soft_refs());
// When collecting the permanent generation Method*s may be moving,
// so we either have to flush all bcp data or convert it into bci.
CodeCache::gc_prologue();
@@ -137,10 +153,19 @@
update_derived_pointers();
BiasedLocking::restore_marks();
CodeCache::gc_epilogue();
JvmtiExport::gc_epilogue();
+
+ heap()->prepare_heap_for_mutators();
+
+ heap()->g1_policy()->record_full_collection_end();
+ heap()->gc_epilogue(true);
+
+ heap()->verify_after_full_collection();
+
+ heap()->print_heap_after_full_collection(scope()->heap_transition());
}
void G1FullCollector::phase1_mark_live_objects() {
// Recursively traverse all live objects and mark them.
GCTraceTime(Info, gc, phases) info("Phase 1: Mark live objects", scope()->timer());
< prev index next >