--- old/src/hotspot/share/gc/g1/g1FullCollector.cpp 2017-11-15 17:15:24.888656286 +0100 +++ new/src/hotspot/share/gc/g1/g1FullCollector.cpp 2017-11-15 17:15:24.624645851 +0100 @@ -35,6 +35,7 @@ #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" @@ -62,20 +63,24 @@ #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); @@ -99,8 +104,19 @@ } 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. @@ -139,6 +155,15 @@ 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() {