233 // Adjust the pointers to reflect the new locations
234 GCTraceTime(Info, gc, phases) tm("Phase 3: Adjust pointers", gc_timer());
235
236 // Need cleared claim bits for the roots processing
237 ClassLoaderDataGraph::clear_claimed_marks();
238
239 CodeBlobToOopClosure adjust_code_closure(&GenMarkSweep::adjust_pointer_closure, CodeBlobToOopClosure::FixRelocations);
240 {
241 G1RootProcessor root_processor(g1h, 1);
242 root_processor.process_all_roots(&GenMarkSweep::adjust_pointer_closure,
243 &GenMarkSweep::adjust_cld_closure,
244 &adjust_code_closure);
245 }
246
247 assert(GenMarkSweep::ref_processor() == g1h->ref_processor_stw(), "Sanity");
248 g1h->ref_processor_stw()->weak_oops_do(&GenMarkSweep::adjust_pointer_closure);
249
250 // Now adjust pointers in remaining weak roots. (All of which should
251 // have been cleared if they pointed to non-surviving objects.)
252 JNIHandles::weak_oops_do(&GenMarkSweep::adjust_pointer_closure);
253
254 if (G1StringDedup::is_enabled()) {
255 G1StringDedup::oops_do(&GenMarkSweep::adjust_pointer_closure);
256 }
257
258 GenMarkSweep::adjust_marks();
259
260 G1AdjustPointersClosure blk;
261 g1h->heap_region_iterate(&blk);
262 }
263
264 class G1SpaceCompactClosure: public HeapRegionClosure {
265 public:
266 G1SpaceCompactClosure() {}
267
268 bool doHeapRegion(HeapRegion* hr) {
269 if (hr->is_humongous()) {
270 if (hr->is_starts_humongous()) {
271 oop obj = oop(hr->bottom());
272 if (obj->is_gc_marked()) {
|
233 // Adjust the pointers to reflect the new locations
234 GCTraceTime(Info, gc, phases) tm("Phase 3: Adjust pointers", gc_timer());
235
236 // Need cleared claim bits for the roots processing
237 ClassLoaderDataGraph::clear_claimed_marks();
238
239 CodeBlobToOopClosure adjust_code_closure(&GenMarkSweep::adjust_pointer_closure, CodeBlobToOopClosure::FixRelocations);
240 {
241 G1RootProcessor root_processor(g1h, 1);
242 root_processor.process_all_roots(&GenMarkSweep::adjust_pointer_closure,
243 &GenMarkSweep::adjust_cld_closure,
244 &adjust_code_closure);
245 }
246
247 assert(GenMarkSweep::ref_processor() == g1h->ref_processor_stw(), "Sanity");
248 g1h->ref_processor_stw()->weak_oops_do(&GenMarkSweep::adjust_pointer_closure);
249
250 // Now adjust pointers in remaining weak roots. (All of which should
251 // have been cleared if they pointed to non-surviving objects.)
252 JNIHandles::weak_oops_do(&GenMarkSweep::adjust_pointer_closure);
253 HeapMonitoring::do_weak_oops(&GenMarkSweep::adjust_pointer_closure);
254
255 if (G1StringDedup::is_enabled()) {
256 G1StringDedup::oops_do(&GenMarkSweep::adjust_pointer_closure);
257 }
258
259 GenMarkSweep::adjust_marks();
260
261 G1AdjustPointersClosure blk;
262 g1h->heap_region_iterate(&blk);
263 }
264
265 class G1SpaceCompactClosure: public HeapRegionClosure {
266 public:
267 G1SpaceCompactClosure() {}
268
269 bool doHeapRegion(HeapRegion* hr) {
270 if (hr->is_humongous()) {
271 if (hr->is_starts_humongous()) {
272 oop obj = oop(hr->bottom());
273 if (obj->is_gc_marked()) {
|