< prev index next >
src/hotspot/share/gc/g1/g1FullCollector.cpp
Print this page
*** 62,88 ****
DerivedPointerTable::update_pointers();
#endif
}
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),
_serial_compaction_point(),
! _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);
--- 62,88 ----
DerivedPointerTable::update_pointers();
#endif
}
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),
_serial_compaction_point(),
! _is_alive(heap->concurrent_mark()->next_mark_bitmap()),
! _is_alive_mutator(heap->ref_processor_stw(), &_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);
*** 102,121 ****
FREE_C_HEAP_ARRAY(G1FullGCMarker*, _markers);
FREE_C_HEAP_ARRAY(G1FullGCCompactionPoint*, _compaction_points);
}
void G1FullCollector::prepare_collection() {
! 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,
--- 102,121 ----
FREE_C_HEAP_ARRAY(G1FullGCMarker*, _markers);
FREE_C_HEAP_ARRAY(G1FullGCCompactionPoint*, _compaction_points);
}
void G1FullCollector::prepare_collection() {
! _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,
*** 154,171 ****
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());
--- 154,171 ----
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());
*** 187,201 ****
// Class unloading and cleanup.
if (ClassUnloading) {
GCTraceTime(Debug, gc, phases) debug("Phase 1: Class Unloading and Cleanup", scope()->timer());
// Unload classes and purge the SystemDictionary.
bool purged_class = SystemDictionary::do_unloading(&_is_alive, scope()->timer());
! G1CollectedHeap::heap()->complete_cleaning(&_is_alive, purged_class);
} else {
GCTraceTime(Debug, gc, phases) debug("Phase 1: String and Symbol Tables Cleanup", scope()->timer());
// If no class unloading just clean out strings and symbols.
! G1CollectedHeap::heap()->partial_cleaning(&_is_alive, true, true, G1StringDedup::is_enabled());
}
scope()->tracer()->report_object_count_after_gc(&_is_alive);
}
--- 187,201 ----
// Class unloading and cleanup.
if (ClassUnloading) {
GCTraceTime(Debug, gc, phases) debug("Phase 1: Class Unloading and Cleanup", scope()->timer());
// Unload classes and purge the SystemDictionary.
bool purged_class = SystemDictionary::do_unloading(&_is_alive, scope()->timer());
! _heap->complete_cleaning(&_is_alive, purged_class);
} else {
GCTraceTime(Debug, gc, phases) debug("Phase 1: String and Symbol Tables Cleanup", scope()->timer());
// If no class unloading just clean out strings and symbols.
! _heap->partial_cleaning(&_is_alive, true, true, G1StringDedup::is_enabled());
}
scope()->tracer()->report_object_count_after_gc(&_is_alive);
}
*** 233,249 ****
task.serial_compaction();
}
}
void G1FullCollector::restore_marks() {
! SharedRestorePreservedMarksTaskExecutor task_executor(G1CollectedHeap::heap()->workers());
_preserved_marks_set.restore(&task_executor);
_preserved_marks_set.reclaim();
}
void G1FullCollector::run_task(AbstractGangTask* task) {
! G1CollectedHeap::heap()->workers()->run_task(task, _num_workers);
}
void G1FullCollector::verify_after_marking() {
if (!VerifyDuringGC) {
//Only do verification if VerifyDuringGC is set.
--- 233,249 ----
task.serial_compaction();
}
}
void G1FullCollector::restore_marks() {
! SharedRestorePreservedMarksTaskExecutor task_executor(_heap->workers());
_preserved_marks_set.restore(&task_executor);
_preserved_marks_set.reclaim();
}
void G1FullCollector::run_task(AbstractGangTask* task) {
! _heap->workers()->run_task(task, _num_workers);
}
void G1FullCollector::verify_after_marking() {
if (!VerifyDuringGC) {
//Only do verification if VerifyDuringGC is set.
*** 252,262 ****
HandleMark hm; // handle scope
#if COMPILER2_OR_JVMCI
DerivedPointerTableDeactivate dpt_deact;
#endif
! G1CollectedHeap::heap()->prepare_for_verify();
// Note: we can verify only the heap here. When an object is
// marked, the previous value of the mark word (including
// identity hash values, ages, etc) is preserved, and the mark
// word is set to markOop::marked_value - effectively removing
// any hash values from the mark word. These hash values are
--- 252,262 ----
HandleMark hm; // handle scope
#if COMPILER2_OR_JVMCI
DerivedPointerTableDeactivate dpt_deact;
#endif
! _heap->prepare_for_verify();
// Note: we can verify only the heap here. When an object is
// marked, the previous value of the mark word (including
// identity hash values, ages, etc) is preserved, and the mark
// word is set to markOop::marked_value - effectively removing
// any hash values from the mark word. These hash values are
*** 264,270 ****
// from the mark word can make verification of the dictionaries
// fail. At the end of the GC, the original mark word values
// (including hash values) are restored to the appropriate
// objects.
GCTraceTime(Info, gc, verify)("During GC (full)");
! G1CollectedHeap::heap()->verify(VerifyOption_G1UseFullMarking);
}
--- 264,270 ----
// from the mark word can make verification of the dictionaries
// fail. At the end of the GC, the original mark word values
// (including hash values) are restored to the appropriate
// objects.
GCTraceTime(Info, gc, verify)("During GC (full)");
! _heap->verify(VerifyOption_G1UseFullMarking);
}
< prev index next >