1 /* |
1 /* |
2 * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
252 } |
252 } |
253 |
253 |
254 void GenMarkSweep::mark_sweep_phase1(int level, |
254 void GenMarkSweep::mark_sweep_phase1(int level, |
255 bool clear_all_softrefs) { |
255 bool clear_all_softrefs) { |
256 // Recursively traverse all live objects and mark them |
256 // Recursively traverse all live objects and mark them |
257 EventMark m("1 mark object"); |
|
258 TraceTime tm("phase 1", PrintGC && Verbose, true, gclog_or_tty); |
257 TraceTime tm("phase 1", PrintGC && Verbose, true, gclog_or_tty); |
259 trace(" 1"); |
258 trace(" 1"); |
260 |
259 |
261 VALIDATE_MARK_SWEEP_ONLY(reset_live_oop_tracking(false)); |
260 VALIDATE_MARK_SWEEP_ONLY(reset_live_oop_tracking(false)); |
262 |
261 |
323 // tracking expects us to do so. See comment under phase4. |
322 // tracking expects us to do so. See comment under phase4. |
324 |
323 |
325 GenCollectedHeap* gch = GenCollectedHeap::heap(); |
324 GenCollectedHeap* gch = GenCollectedHeap::heap(); |
326 Generation* pg = gch->perm_gen(); |
325 Generation* pg = gch->perm_gen(); |
327 |
326 |
328 EventMark m("2 compute new addresses"); |
|
329 TraceTime tm("phase 2", PrintGC && Verbose, true, gclog_or_tty); |
327 TraceTime tm("phase 2", PrintGC && Verbose, true, gclog_or_tty); |
330 trace("2"); |
328 trace("2"); |
331 |
329 |
332 VALIDATE_MARK_SWEEP_ONLY(reset_live_oop_tracking(false)); |
330 VALIDATE_MARK_SWEEP_ONLY(reset_live_oop_tracking(false)); |
333 |
331 |
348 void GenMarkSweep::mark_sweep_phase3(int level) { |
346 void GenMarkSweep::mark_sweep_phase3(int level) { |
349 GenCollectedHeap* gch = GenCollectedHeap::heap(); |
347 GenCollectedHeap* gch = GenCollectedHeap::heap(); |
350 Generation* pg = gch->perm_gen(); |
348 Generation* pg = gch->perm_gen(); |
351 |
349 |
352 // Adjust the pointers to reflect the new locations |
350 // Adjust the pointers to reflect the new locations |
353 EventMark m("3 adjust pointers"); |
|
354 TraceTime tm("phase 3", PrintGC && Verbose, true, gclog_or_tty); |
351 TraceTime tm("phase 3", PrintGC && Verbose, true, gclog_or_tty); |
355 trace("3"); |
352 trace("3"); |
356 |
353 |
357 VALIDATE_MARK_SWEEP_ONLY(reset_live_oop_tracking(false)); |
354 VALIDATE_MARK_SWEEP_ONLY(reset_live_oop_tracking(false)); |
358 |
355 |
409 // here (perm_gen first rather than last), so we tell the validate code |
406 // here (perm_gen first rather than last), so we tell the validate code |
410 // to use a higher index (saved from phase2) when verifying perm_gen. |
407 // to use a higher index (saved from phase2) when verifying perm_gen. |
411 GenCollectedHeap* gch = GenCollectedHeap::heap(); |
408 GenCollectedHeap* gch = GenCollectedHeap::heap(); |
412 Generation* pg = gch->perm_gen(); |
409 Generation* pg = gch->perm_gen(); |
413 |
410 |
414 EventMark m("4 compact heap"); |
|
415 TraceTime tm("phase 4", PrintGC && Verbose, true, gclog_or_tty); |
411 TraceTime tm("phase 4", PrintGC && Verbose, true, gclog_or_tty); |
416 trace("4"); |
412 trace("4"); |
417 |
413 |
418 VALIDATE_MARK_SWEEP_ONLY(reset_live_oop_tracking(true)); |
414 VALIDATE_MARK_SWEEP_ONLY(reset_live_oop_tracking(true)); |
419 |
415 |