< prev index next >

src/share/vm/gc/serial/genMarkSweep.cpp

Print this page
rev 8393 : 8077842: Remove the level parameter passed around in GenCollectedHeap
Reviewed-by:

*** 34,43 **** --- 34,44 ---- #include "gc/shared/gcHeapSummary.hpp" #include "gc/shared/gcTimer.hpp" #include "gc/shared/gcTrace.hpp" #include "gc/shared/gcTraceTime.hpp" #include "gc/shared/genCollectedHeap.hpp" + #include "gc/shared/generation.hpp" #include "gc/shared/genOopClosures.inline.hpp" #include "gc/shared/modRefBarrierSet.hpp" #include "gc/shared/referencePolicy.hpp" #include "gc/shared/space.hpp" #include "oops/instanceRefKlass.hpp"
*** 50,61 **** #include "runtime/vmThread.hpp" #include "utilities/copy.hpp" #include "utilities/events.hpp" #include "utilities/stack.inline.hpp" ! void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp, bool clear_all_softrefs) { ! guarantee(level == 1, "We always collect both old and young."); assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint"); GenCollectedHeap* gch = GenCollectedHeap::heap(); #ifdef ASSERT if (gch->collector_policy()->should_clear_all_soft_refs()) { --- 51,61 ---- #include "runtime/vmThread.hpp" #include "utilities/copy.hpp" #include "utilities/events.hpp" #include "utilities/stack.inline.hpp" ! void GenMarkSweep::invoke_at_safepoint(ReferenceProcessor* rp, bool clear_all_softrefs) { assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint"); GenCollectedHeap* gch = GenCollectedHeap::heap(); #ifdef ASSERT if (gch->collector_policy()->should_clear_all_soft_refs()) {
*** 84,106 **** size_t gch_prev_used = gch->used(); // Capture used regions for each generation that will be // subject to collection, so that card table adjustments can // be made intelligently (see clear / invalidate further below). ! gch->save_used_regions(level); allocate_stacks(); ! mark_sweep_phase1(level, clear_all_softrefs); mark_sweep_phase2(); // Don't add any more derived pointers during phase3 COMPILER2_PRESENT(assert(DerivedPointerTable::is_active(), "Sanity")); COMPILER2_PRESENT(DerivedPointerTable::set_active(false)); ! mark_sweep_phase3(level); mark_sweep_phase4(); restore_marks(); --- 84,106 ---- size_t gch_prev_used = gch->used(); // Capture used regions for each generation that will be // subject to collection, so that card table adjustments can // be made intelligently (see clear / invalidate further below). ! gch->save_used_regions(); allocate_stacks(); ! mark_sweep_phase1(clear_all_softrefs); mark_sweep_phase2(); // Don't add any more derived pointers during phase3 COMPILER2_PRESENT(assert(DerivedPointerTable::is_active(), "Sanity")); COMPILER2_PRESENT(DerivedPointerTable::set_active(false)); ! mark_sweep_phase3(); mark_sweep_phase4(); restore_marks();
*** 181,208 **** _preserved_oop_stack.clear(true); _marking_stack.clear(); _objarray_stack.clear(true); } ! void GenMarkSweep::mark_sweep_phase1(int level, ! bool clear_all_softrefs) { // Recursively traverse all live objects and mark them GCTraceTime tm("phase 1", PrintGC && Verbose, true, _gc_timer, _gc_tracer->gc_id()); GenCollectedHeap* gch = GenCollectedHeap::heap(); // Because follow_root_closure is created statically, cannot // use OopsInGenClosure constructor which takes a generation, // as the Universe has not been created when the static constructors // are run. - assert(level == 1, "We don't use mark-sweep on young generations"); follow_root_closure.set_orig_generation(gch->old_gen()); // Need new claim bits before marking starts. ClassLoaderDataGraph::clear_claimed_marks(); ! gch->gen_process_roots(level, false, // Younger gens are not roots. true, // activate StrongRootsScope GenCollectedHeap::SO_None, GenCollectedHeap::StrongRootsOnly, &follow_root_closure, --- 181,206 ---- _preserved_oop_stack.clear(true); _marking_stack.clear(); _objarray_stack.clear(true); } ! void GenMarkSweep::mark_sweep_phase1(bool clear_all_softrefs) { // Recursively traverse all live objects and mark them GCTraceTime tm("phase 1", PrintGC && Verbose, true, _gc_timer, _gc_tracer->gc_id()); GenCollectedHeap* gch = GenCollectedHeap::heap(); // Because follow_root_closure is created statically, cannot // use OopsInGenClosure constructor which takes a generation, // as the Universe has not been created when the static constructors // are run. follow_root_closure.set_orig_generation(gch->old_gen()); // Need new claim bits before marking starts. ClassLoaderDataGraph::clear_claimed_marks(); ! gch->gen_process_roots(Generation::Old, false, // Younger gens are not roots. true, // activate StrongRootsScope GenCollectedHeap::SO_None, GenCollectedHeap::StrongRootsOnly, &follow_root_closure,
*** 266,276 **** void do_generation(Generation* gen) { gen->adjust_pointers(); } }; ! void GenMarkSweep::mark_sweep_phase3(int level) { GenCollectedHeap* gch = GenCollectedHeap::heap(); // Adjust the pointers to reflect the new locations GCTraceTime tm("phase 3", PrintGC && Verbose, true, _gc_timer, _gc_tracer->gc_id()); --- 264,274 ---- void do_generation(Generation* gen) { gen->adjust_pointers(); } }; ! void GenMarkSweep::mark_sweep_phase3() { GenCollectedHeap* gch = GenCollectedHeap::heap(); // Adjust the pointers to reflect the new locations GCTraceTime tm("phase 3", PrintGC && Verbose, true, _gc_timer, _gc_tracer->gc_id());
*** 279,292 **** // Because the closure below is created statically, we cannot // use OopsInGenClosure constructor which takes a generation, // as the Universe has not been created when the static constructors // are run. - assert(level == 1, "We don't use mark-sweep on young generations."); adjust_pointer_closure.set_orig_generation(gch->old_gen()); ! gch->gen_process_roots(level, false, // Younger gens are not roots. true, // activate StrongRootsScope GenCollectedHeap::SO_AllCodeCache, GenCollectedHeap::StrongAndWeakRoots, &adjust_pointer_closure, --- 277,289 ---- // Because the closure below is created statically, we cannot // use OopsInGenClosure constructor which takes a generation, // as the Universe has not been created when the static constructors // are run. adjust_pointer_closure.set_orig_generation(gch->old_gen()); ! gch->gen_process_roots(Generation::Old, false, // Younger gens are not roots. true, // activate StrongRootsScope GenCollectedHeap::SO_AllCodeCache, GenCollectedHeap::StrongAndWeakRoots, &adjust_pointer_closure,
< prev index next >