121 _markers = NEW_C_HEAP_ARRAY(G1FullGCMarker*, _num_workers, mtGC);
122 _compaction_points = NEW_C_HEAP_ARRAY(G1FullGCCompactionPoint*, _num_workers, mtGC);
123 for (uint i = 0; i < _num_workers; i++) {
124 _markers[i] = new G1FullGCMarker(i, _preserved_marks_set.get(i), mark_bitmap());
125 _compaction_points[i] = new G1FullGCCompactionPoint();
126 _oop_queue_set.register_queue(i, marker(i)->oop_stack());
127 _array_queue_set.register_queue(i, marker(i)->objarray_stack());
128 }
129 }
130
131 G1FullCollector::~G1FullCollector() {
132 for (uint i = 0; i < _num_workers; i++) {
133 delete _markers[i];
134 delete _compaction_points[i];
135 }
136 FREE_C_HEAP_ARRAY(G1FullGCMarker*, _markers);
137 FREE_C_HEAP_ARRAY(G1FullGCCompactionPoint*, _compaction_points);
138 }
139
140 void G1FullCollector::prepare_collection() {
141 _heap->g1_policy()->record_full_collection_start();
142
143 _heap->print_heap_before_gc();
144 _heap->print_heap_regions();
145
146 _heap->abort_concurrent_cycle();
147 _heap->verify_before_full_collection(scope()->is_explicit_gc());
148
149 _heap->gc_prologue(true);
150 _heap->prepare_heap_for_full_collection();
151
152 reference_processor()->enable_discovery();
153 reference_processor()->setup_policy(scope()->should_clear_soft_refs());
154
155 // When collecting the permanent generation Method*s may be moving,
156 // so we either have to flush all bcp data or convert it into bci.
157 CodeCache::gc_prologue();
158
159 // We should save the marks of the currently locked biased monitors.
160 // The marking doesn't preserve the marks of biased objects.
161 BiasedLocking::preserve_marks();
175
176 phase3_adjust_pointers();
177
178 phase4_do_compaction();
179 }
180
181 void G1FullCollector::complete_collection() {
182 // Restore all marks.
183 restore_marks();
184
185 // When the pointers have been adjusted and moved, we can
186 // update the derived pointer table.
187 update_derived_pointers();
188
189 BiasedLocking::restore_marks();
190 CodeCache::gc_epilogue();
191 JvmtiExport::gc_epilogue();
192
193 _heap->prepare_heap_for_mutators();
194
195 _heap->g1_policy()->record_full_collection_end();
196 _heap->gc_epilogue(true);
197
198 _heap->verify_after_full_collection();
199
200 _heap->print_heap_after_full_collection(scope()->heap_transition());
201 }
202
203 void G1FullCollector::phase1_mark_live_objects() {
204 // Recursively traverse all live objects and mark them.
205 GCTraceTime(Info, gc, phases) info("Phase 1: Mark live objects", scope()->timer());
206
207 // Do the actual marking.
208 G1FullGCMarkTask marking_task(this);
209 run_task(&marking_task);
210
211 // Process references discovered during marking.
212 G1FullGCReferenceProcessingExecutor reference_processing(this);
213 reference_processing.execute(scope()->timer(), scope()->tracer());
214
215 // Weak oops cleanup.
|
121 _markers = NEW_C_HEAP_ARRAY(G1FullGCMarker*, _num_workers, mtGC);
122 _compaction_points = NEW_C_HEAP_ARRAY(G1FullGCCompactionPoint*, _num_workers, mtGC);
123 for (uint i = 0; i < _num_workers; i++) {
124 _markers[i] = new G1FullGCMarker(i, _preserved_marks_set.get(i), mark_bitmap());
125 _compaction_points[i] = new G1FullGCCompactionPoint();
126 _oop_queue_set.register_queue(i, marker(i)->oop_stack());
127 _array_queue_set.register_queue(i, marker(i)->objarray_stack());
128 }
129 }
130
131 G1FullCollector::~G1FullCollector() {
132 for (uint i = 0; i < _num_workers; i++) {
133 delete _markers[i];
134 delete _compaction_points[i];
135 }
136 FREE_C_HEAP_ARRAY(G1FullGCMarker*, _markers);
137 FREE_C_HEAP_ARRAY(G1FullGCCompactionPoint*, _compaction_points);
138 }
139
140 void G1FullCollector::prepare_collection() {
141 _heap->policy()->record_full_collection_start();
142
143 _heap->print_heap_before_gc();
144 _heap->print_heap_regions();
145
146 _heap->abort_concurrent_cycle();
147 _heap->verify_before_full_collection(scope()->is_explicit_gc());
148
149 _heap->gc_prologue(true);
150 _heap->prepare_heap_for_full_collection();
151
152 reference_processor()->enable_discovery();
153 reference_processor()->setup_policy(scope()->should_clear_soft_refs());
154
155 // When collecting the permanent generation Method*s may be moving,
156 // so we either have to flush all bcp data or convert it into bci.
157 CodeCache::gc_prologue();
158
159 // We should save the marks of the currently locked biased monitors.
160 // The marking doesn't preserve the marks of biased objects.
161 BiasedLocking::preserve_marks();
175
176 phase3_adjust_pointers();
177
178 phase4_do_compaction();
179 }
180
181 void G1FullCollector::complete_collection() {
182 // Restore all marks.
183 restore_marks();
184
185 // When the pointers have been adjusted and moved, we can
186 // update the derived pointer table.
187 update_derived_pointers();
188
189 BiasedLocking::restore_marks();
190 CodeCache::gc_epilogue();
191 JvmtiExport::gc_epilogue();
192
193 _heap->prepare_heap_for_mutators();
194
195 _heap->policy()->record_full_collection_end();
196 _heap->gc_epilogue(true);
197
198 _heap->verify_after_full_collection();
199
200 _heap->print_heap_after_full_collection(scope()->heap_transition());
201 }
202
203 void G1FullCollector::phase1_mark_live_objects() {
204 // Recursively traverse all live objects and mark them.
205 GCTraceTime(Info, gc, phases) info("Phase 1: Mark live objects", scope()->timer());
206
207 // Do the actual marking.
208 G1FullGCMarkTask marking_task(this);
209 run_task(&marking_task);
210
211 // Process references discovered during marking.
212 G1FullGCReferenceProcessingExecutor reference_processing(this);
213 reference_processing.execute(scope()->timer(), scope()->tracer());
214
215 // Weak oops cleanup.
|