comparison src/share/vm/memory/genMarkSweep.cpp @ 12030:330dfb0476f4

8022800: Use specific generations rather than generation iteration Reviewed-by: jmasa, ehelin
author brutisso
date Wed, 14 Aug 2013 09:02:32 +0200
parents f2110083203d
children bd902affe102
comparison
equal deleted inserted replaced
12009:39127bb12d32 12030:330dfb0476f4
50 #include "runtime/thread.inline.hpp" 50 #include "runtime/thread.inline.hpp"
51 #include "runtime/vmThread.hpp" 51 #include "runtime/vmThread.hpp"
52 #include "utilities/copy.hpp" 52 #include "utilities/copy.hpp"
53 #include "utilities/events.hpp" 53 #include "utilities/events.hpp"
54 54
55 void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp, 55 void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp, bool clear_all_softrefs) {
56 bool clear_all_softrefs) { 56 guarantee(level == 1, "We always collect both old and young.");
57 assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint"); 57 assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint");
58 58
59 GenCollectedHeap* gch = GenCollectedHeap::heap(); 59 GenCollectedHeap* gch = GenCollectedHeap::heap();
60 #ifdef ASSERT 60 #ifdef ASSERT
61 if (gch->collector_policy()->should_clear_all_soft_refs()) { 61 if (gch->collector_policy()->should_clear_all_soft_refs()) {
81 // Increment the invocation count 81 // Increment the invocation count
82 _total_invocations++; 82 _total_invocations++;
83 83
84 // Capture heap size before collection for printing. 84 // Capture heap size before collection for printing.
85 size_t gch_prev_used = gch->used(); 85 size_t gch_prev_used = gch->used();
86
87 // Some of the card table updates below assume that the perm gen is
88 // also being collected.
89 assert(level == gch->n_gens() - 1,
90 "All generations are being collected, ergo perm gen too.");
91 86
92 // Capture used regions for each generation that will be 87 // Capture used regions for each generation that will be
93 // subject to collection, so that card table adjustments can 88 // subject to collection, so that card table adjustments can
94 // be made intelligently (see clear / invalidate further below). 89 // be made intelligently (see clear / invalidate further below).
95 gch->save_used_regions(level); 90 gch->save_used_regions(level);
132 Generation* g = gch->get_gen(level); 127 Generation* g = gch->get_gen(level);
133 rs->clear_into_younger(g); 128 rs->clear_into_younger(g);
134 } else { 129 } else {
135 // Invalidate the cards corresponding to the currently used 130 // Invalidate the cards corresponding to the currently used
136 // region and clear those corresponding to the evacuated region 131 // region and clear those corresponding to the evacuated region
137 // of all generations just collected (i.e. level and younger). 132 // of all generations just collected.
138 rs->invalidate_or_clear(gch->get_gen(level), 133 rs->invalidate_or_clear(gch->get_gen(1));
139 true /* younger */); 134 rs->invalidate_or_clear(gch->get_gen(0));
140 } 135 }
141 136
142 Threads::gc_epilogue(); 137 Threads::gc_epilogue();
143 CodeCache::gc_epilogue(); 138 CodeCache::gc_epilogue();
144 JvmtiExport::gc_epilogue(); 139 JvmtiExport::gc_epilogue();