< prev index next >

src/hotspot/share/gc/g1/g1FullCollector.cpp

Print this page

  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #include "precompiled.hpp"
 26 #include "classfile/systemDictionary.hpp"
 27 #include "code/codeCache.hpp"
 28 #include "compiler/oopMap.hpp"

 29 #include "gc/g1/g1CollectedHeap.hpp"
 30 #include "gc/g1/g1FullCollector.inline.hpp"
 31 #include "gc/g1/g1FullGCAdjustTask.hpp"
 32 #include "gc/g1/g1FullGCCompactTask.hpp"
 33 #include "gc/g1/g1FullGCMarker.inline.hpp"
 34 #include "gc/g1/g1FullGCMarkTask.hpp"
 35 #include "gc/g1/g1FullGCPrepareTask.hpp"
 36 #include "gc/g1/g1FullGCScope.hpp"
 37 #include "gc/g1/g1OopClosures.hpp"
 38 #include "gc/g1/g1Policy.hpp"
 39 #include "gc/g1/g1RegionMarkStatsCache.inline.hpp"
 40 #include "gc/shared/gcTraceTime.inline.hpp"
 41 #include "gc/shared/preservedMarks.hpp"
 42 #include "gc/shared/referenceProcessor.hpp"
 43 #include "gc/shared/verifyOption.hpp"
 44 #include "gc/shared/weakProcessor.inline.hpp"
 45 #include "gc/shared/workerPolicy.hpp"
 46 #include "logging/log.hpp"
 47 #include "runtime/handles.inline.hpp"
 48 #include "utilities/debug.hpp"

170 void G1FullCollector::prepare_collection() {
171   _heap->policy()->record_full_collection_start();
172 
173   _heap->abort_concurrent_cycle();
174   _heap->verify_before_full_collection(scope()->is_explicit_gc());
175 
176   _heap->gc_prologue(true);
177   _heap->retire_tlabs();
178   _heap->prepare_heap_for_full_collection();
179 
180   PrepareRegionsClosure cl(this);
181   _heap->heap_region_iterate(&cl);
182 
183   reference_processor()->start_discovery(scope()->should_clear_soft_refs());
184 
185   // Clear and activate derived pointer collection.
186   clear_and_activate_derived_pointers();
187 }
188 
189 void G1FullCollector::collect() {


190   phase1_mark_live_objects();
191   verify_after_marking();
192 
193   // Don't add any more derived pointers during later phases
194   deactivate_derived_pointers();
195 
196   phase2_prepare_compaction();
197 
198   phase3_adjust_pointers();
199 
200   phase4_do_compaction();


201 }
202 
203 void G1FullCollector::complete_collection() {
204   // Restore all marks.
205   restore_marks();
206 
207   // When the pointers have been adjusted and moved, we can
208   // update the derived pointer table.
209   update_derived_pointers();
210 
211   _heap->concurrent_mark()->swap_mark_bitmaps();
212   // Prepare the bitmap for the next (potentially concurrent) marking.
213   _heap->concurrent_mark()->clear_next_bitmap(_heap->workers());
214 
215   _heap->prepare_heap_for_mutators();
216 
217   _heap->resize_all_tlabs();
218 
219   _heap->policy()->record_full_collection_end();
220   _heap->gc_epilogue(true);

  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #include "precompiled.hpp"
 26 #include "classfile/systemDictionary.hpp"
 27 #include "code/codeCache.hpp"
 28 #include "compiler/oopMap.hpp"
 29 #include "gc/g1/g1BarrierSet.hpp"
 30 #include "gc/g1/g1CollectedHeap.hpp"
 31 #include "gc/g1/g1FullCollector.inline.hpp"
 32 #include "gc/g1/g1FullGCAdjustTask.hpp"
 33 #include "gc/g1/g1FullGCCompactTask.hpp"
 34 #include "gc/g1/g1FullGCMarker.inline.hpp"
 35 #include "gc/g1/g1FullGCMarkTask.hpp"
 36 #include "gc/g1/g1FullGCPrepareTask.hpp"
 37 #include "gc/g1/g1FullGCScope.hpp"
 38 #include "gc/g1/g1OopClosures.hpp"
 39 #include "gc/g1/g1Policy.hpp"
 40 #include "gc/g1/g1RegionMarkStatsCache.inline.hpp"
 41 #include "gc/shared/gcTraceTime.inline.hpp"
 42 #include "gc/shared/preservedMarks.hpp"
 43 #include "gc/shared/referenceProcessor.hpp"
 44 #include "gc/shared/verifyOption.hpp"
 45 #include "gc/shared/weakProcessor.inline.hpp"
 46 #include "gc/shared/workerPolicy.hpp"
 47 #include "logging/log.hpp"
 48 #include "runtime/handles.inline.hpp"
 49 #include "utilities/debug.hpp"

171 void G1FullCollector::prepare_collection() {
172   _heap->policy()->record_full_collection_start();
173 
174   _heap->abort_concurrent_cycle();
175   _heap->verify_before_full_collection(scope()->is_explicit_gc());
176 
177   _heap->gc_prologue(true);
178   _heap->retire_tlabs();
179   _heap->prepare_heap_for_full_collection();
180 
181   PrepareRegionsClosure cl(this);
182   _heap->heap_region_iterate(&cl);
183 
184   reference_processor()->start_discovery(scope()->should_clear_soft_refs());
185 
186   // Clear and activate derived pointer collection.
187   clear_and_activate_derived_pointers();
188 }
189 
190 void G1FullCollector::collect() {
191   CodeCache::increment_marking_cycle();
192 
193   phase1_mark_live_objects();
194   verify_after_marking();
195 
196   // Don't add any more derived pointers during later phases
197   deactivate_derived_pointers();
198 
199   phase2_prepare_compaction();
200 
201   phase3_adjust_pointers();
202 
203   phase4_do_compaction();
204 
205   CodeCache::increment_marking_cycle();
206 }
207 
208 void G1FullCollector::complete_collection() {
209   // Restore all marks.
210   restore_marks();
211 
212   // When the pointers have been adjusted and moved, we can
213   // update the derived pointer table.
214   update_derived_pointers();
215 
216   _heap->concurrent_mark()->swap_mark_bitmaps();
217   // Prepare the bitmap for the next (potentially concurrent) marking.
218   _heap->concurrent_mark()->clear_next_bitmap(_heap->workers());
219 
220   _heap->prepare_heap_for_mutators();
221 
222   _heap->resize_all_tlabs();
223 
224   _heap->policy()->record_full_collection_end();
225   _heap->gc_epilogue(true);
< prev index next >