Mercurial > hg > truffle
comparison src/share/vm/memory/genMarkSweep.cpp @ 20804:7848fc12602b
Merge with jdk8u40-b25
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Tue, 07 Apr 2015 14:58:49 +0200 |
parents | 4ca6dc0799b6 2c6ef90f030a |
children |
comparison
equal
deleted
inserted
replaced
20184:84105dcdb05b | 20804:7848fc12602b |
---|---|
67 assert(ref_processor() == NULL, "no stomping"); | 67 assert(ref_processor() == NULL, "no stomping"); |
68 assert(rp != NULL, "should be non-NULL"); | 68 assert(rp != NULL, "should be non-NULL"); |
69 _ref_processor = rp; | 69 _ref_processor = rp; |
70 rp->setup_policy(clear_all_softrefs); | 70 rp->setup_policy(clear_all_softrefs); |
71 | 71 |
72 GCTraceTime t1(GCCauseString("Full GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, NULL); | 72 GCTraceTime t1(GCCauseString("Full GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, NULL, _gc_tracer->gc_id()); |
73 | 73 |
74 gch->trace_heap_before_gc(_gc_tracer); | 74 gch->trace_heap_before_gc(_gc_tracer); |
75 | 75 |
76 // When collecting the permanent generation Method*s may be moving, | 76 // When collecting the permanent generation Method*s may be moving, |
77 // so we either have to flush all bcp data or convert it into bci. | 77 // so we either have to flush all bcp data or convert it into bci. |
191 } | 191 } |
192 | 192 |
193 void GenMarkSweep::mark_sweep_phase1(int level, | 193 void GenMarkSweep::mark_sweep_phase1(int level, |
194 bool clear_all_softrefs) { | 194 bool clear_all_softrefs) { |
195 // Recursively traverse all live objects and mark them | 195 // Recursively traverse all live objects and mark them |
196 GCTraceTime tm("phase 1", PrintGC && Verbose, true, _gc_timer); | 196 GCTraceTime tm("phase 1", PrintGC && Verbose, true, _gc_timer, _gc_tracer->gc_id()); |
197 trace(" 1"); | 197 trace(" 1"); |
198 | 198 |
199 GenCollectedHeap* gch = GenCollectedHeap::heap(); | 199 GenCollectedHeap* gch = GenCollectedHeap::heap(); |
200 | 200 |
201 // Because follow_root_closure is created statically, cannot | 201 // Because follow_root_closure is created statically, cannot |
205 follow_root_closure.set_orig_generation(gch->get_gen(level)); | 205 follow_root_closure.set_orig_generation(gch->get_gen(level)); |
206 | 206 |
207 // Need new claim bits before marking starts. | 207 // Need new claim bits before marking starts. |
208 ClassLoaderDataGraph::clear_claimed_marks(); | 208 ClassLoaderDataGraph::clear_claimed_marks(); |
209 | 209 |
210 gch->gen_process_strong_roots(level, | 210 gch->gen_process_roots(level, |
211 false, // Younger gens are not roots. | 211 false, // Younger gens are not roots. |
212 true, // activate StrongRootsScope | 212 true, // activate StrongRootsScope |
213 false, // not scavenging | 213 SharedHeap::SO_None, |
214 SharedHeap::SO_SystemClasses, | 214 GenCollectedHeap::StrongRootsOnly, |
215 &follow_root_closure, | 215 &follow_root_closure, |
216 true, // walk code active on stacks | 216 &follow_root_closure, |
217 &follow_root_closure, | 217 &follow_cld_closure); |
218 &follow_klass_closure); | |
219 | 218 |
220 // Process reference objects found during marking | 219 // Process reference objects found during marking |
221 { | 220 { |
222 ref_processor()->setup_policy(clear_all_softrefs); | 221 ref_processor()->setup_policy(clear_all_softrefs); |
223 const ReferenceProcessorStats& stats = | 222 const ReferenceProcessorStats& stats = |
224 ref_processor()->process_discovered_references( | 223 ref_processor()->process_discovered_references( |
225 &is_alive, &keep_alive, &follow_stack_closure, NULL, _gc_timer); | 224 &is_alive, &keep_alive, &follow_stack_closure, NULL, _gc_timer, _gc_tracer->gc_id()); |
226 gc_tracer()->report_gc_reference_stats(stats); | 225 gc_tracer()->report_gc_reference_stats(stats); |
227 } | 226 } |
228 | 227 |
229 // This is the point where the entire marking should have completed. | 228 // This is the point where the entire marking should have completed. |
230 assert(_marking_stack.is_empty(), "Marking should have completed"); | 229 assert(_marking_stack.is_empty(), "Marking should have completed"); |
262 // phase2, phase3 and phase4, but the ValidateMarkSweep live oops | 261 // phase2, phase3 and phase4, but the ValidateMarkSweep live oops |
263 // tracking expects us to do so. See comment under phase4. | 262 // tracking expects us to do so. See comment under phase4. |
264 | 263 |
265 GenCollectedHeap* gch = GenCollectedHeap::heap(); | 264 GenCollectedHeap* gch = GenCollectedHeap::heap(); |
266 | 265 |
267 GCTraceTime tm("phase 2", PrintGC && Verbose, true, _gc_timer); | 266 GCTraceTime tm("phase 2", PrintGC && Verbose, true, _gc_timer, _gc_tracer->gc_id()); |
268 trace("2"); | 267 trace("2"); |
269 | 268 |
270 gch->prepare_for_compaction(); | 269 gch->prepare_for_compaction(); |
271 } | 270 } |
272 | 271 |
279 | 278 |
280 void GenMarkSweep::mark_sweep_phase3(int level) { | 279 void GenMarkSweep::mark_sweep_phase3(int level) { |
281 GenCollectedHeap* gch = GenCollectedHeap::heap(); | 280 GenCollectedHeap* gch = GenCollectedHeap::heap(); |
282 | 281 |
283 // Adjust the pointers to reflect the new locations | 282 // Adjust the pointers to reflect the new locations |
284 GCTraceTime tm("phase 3", PrintGC && Verbose, true, _gc_timer); | 283 GCTraceTime tm("phase 3", PrintGC && Verbose, true, _gc_timer, _gc_tracer->gc_id()); |
285 trace("3"); | 284 trace("3"); |
286 | 285 |
287 // Need new claim bits for the pointer adjustment tracing. | 286 // Need new claim bits for the pointer adjustment tracing. |
288 ClassLoaderDataGraph::clear_claimed_marks(); | 287 ClassLoaderDataGraph::clear_claimed_marks(); |
289 | 288 |
291 // use OopsInGenClosure constructor which takes a generation, | 290 // use OopsInGenClosure constructor which takes a generation, |
292 // as the Universe has not been created when the static constructors | 291 // as the Universe has not been created when the static constructors |
293 // are run. | 292 // are run. |
294 adjust_pointer_closure.set_orig_generation(gch->get_gen(level)); | 293 adjust_pointer_closure.set_orig_generation(gch->get_gen(level)); |
295 | 294 |
296 gch->gen_process_strong_roots(level, | 295 gch->gen_process_roots(level, |
297 false, // Younger gens are not roots. | 296 false, // Younger gens are not roots. |
298 true, // activate StrongRootsScope | 297 true, // activate StrongRootsScope |
299 false, // not scavenging | 298 SharedHeap::SO_AllCodeCache, |
300 SharedHeap::SO_AllClasses, | 299 GenCollectedHeap::StrongAndWeakRoots, |
301 &adjust_pointer_closure, | 300 &adjust_pointer_closure, |
302 false, // do not walk code | 301 &adjust_pointer_closure, |
303 &adjust_pointer_closure, | 302 &adjust_cld_closure); |
304 &adjust_klass_closure); | 303 |
305 | 304 gch->gen_process_weak_roots(&adjust_pointer_closure); |
306 // Now adjust pointers in remaining weak roots. (All of which should | |
307 // have been cleared if they pointed to non-surviving objects.) | |
308 CodeBlobToOopClosure adjust_code_pointer_closure(&adjust_pointer_closure, | |
309 /*do_marking=*/ false); | |
310 gch->gen_process_weak_roots(&adjust_pointer_closure, | |
311 &adjust_code_pointer_closure); | |
312 | 305 |
313 adjust_marks(); | 306 adjust_marks(); |
314 GenAdjustPointersClosure blk; | 307 GenAdjustPointersClosure blk; |
315 gch->generation_iterate(&blk, true); | 308 gch->generation_iterate(&blk, true); |
316 } | 309 } |
334 // in the same order in phase2, phase3 and phase4. We don't quite do that | 327 // in the same order in phase2, phase3 and phase4. We don't quite do that |
335 // here (perm_gen first rather than last), so we tell the validate code | 328 // here (perm_gen first rather than last), so we tell the validate code |
336 // to use a higher index (saved from phase2) when verifying perm_gen. | 329 // to use a higher index (saved from phase2) when verifying perm_gen. |
337 GenCollectedHeap* gch = GenCollectedHeap::heap(); | 330 GenCollectedHeap* gch = GenCollectedHeap::heap(); |
338 | 331 |
339 GCTraceTime tm("phase 4", PrintGC && Verbose, true, _gc_timer); | 332 GCTraceTime tm("phase 4", PrintGC && Verbose, true, _gc_timer, _gc_tracer->gc_id()); |
340 trace("4"); | 333 trace("4"); |
341 | 334 |
342 GenCompactClosure blk; | 335 GenCompactClosure blk; |
343 gch->generation_iterate(&blk, true); | 336 gch->generation_iterate(&blk, true); |
344 } | 337 } |