hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp
changeset 12378 ed44b9ecfa2f
parent 11636 3c07b54482a5
child 12379 2cf45b79ce3a
equal deleted inserted replaced
12365:ec2b9f11794a 12378:ed44b9ecfa2f
    27 #include "classfile/symbolTable.hpp"
    27 #include "classfile/symbolTable.hpp"
    28 #include "classfile/systemDictionary.hpp"
    28 #include "classfile/systemDictionary.hpp"
    29 #include "classfile/vmSymbols.hpp"
    29 #include "classfile/vmSymbols.hpp"
    30 #include "code/codeCache.hpp"
    30 #include "code/codeCache.hpp"
    31 #include "code/icBuffer.hpp"
    31 #include "code/icBuffer.hpp"
       
    32 #include "gc_implementation/g1/g1Log.hpp"
    32 #include "gc_implementation/g1/g1MarkSweep.hpp"
    33 #include "gc_implementation/g1/g1MarkSweep.hpp"
    33 #include "memory/gcLocker.hpp"
    34 #include "memory/gcLocker.hpp"
    34 #include "memory/genCollectedHeap.hpp"
    35 #include "memory/genCollectedHeap.hpp"
    35 #include "memory/modRefBarrierSet.hpp"
    36 #include "memory/modRefBarrierSet.hpp"
    36 #include "memory/referencePolicy.hpp"
    37 #include "memory/referencePolicy.hpp"
   124 }
   125 }
   125 
   126 
   126 void G1MarkSweep::mark_sweep_phase1(bool& marked_for_unloading,
   127 void G1MarkSweep::mark_sweep_phase1(bool& marked_for_unloading,
   127                                     bool clear_all_softrefs) {
   128                                     bool clear_all_softrefs) {
   128   // Recursively traverse all live objects and mark them
   129   // Recursively traverse all live objects and mark them
   129   TraceTime tm("phase 1", PrintGC && Verbose, true, gclog_or_tty);
   130   TraceTime tm("phase 1", G1Log::fine() && Verbose, true, gclog_or_tty);
   130   GenMarkSweep::trace(" 1");
   131   GenMarkSweep::trace(" 1");
   131 
   132 
   132   SharedHeap* sh = SharedHeap::heap();
   133   SharedHeap* sh = SharedHeap::heap();
   133 
   134 
   134   sh->process_strong_roots(true,  // activeate StrongRootsScope
   135   sh->process_strong_roots(true,  // activeate StrongRootsScope
   289   // tracking expects us to do so. See comment under phase4.
   290   // tracking expects us to do so. See comment under phase4.
   290 
   291 
   291   G1CollectedHeap* g1h = G1CollectedHeap::heap();
   292   G1CollectedHeap* g1h = G1CollectedHeap::heap();
   292   Generation* pg = g1h->perm_gen();
   293   Generation* pg = g1h->perm_gen();
   293 
   294 
   294   TraceTime tm("phase 2", PrintGC && Verbose, true, gclog_or_tty);
   295   TraceTime tm("phase 2", G1Log::fine() && Verbose, true, gclog_or_tty);
   295   GenMarkSweep::trace("2");
   296   GenMarkSweep::trace("2");
   296 
   297 
   297   FindFirstRegionClosure cl;
   298   FindFirstRegionClosure cl;
   298   g1h->heap_region_iterate(&cl);
   299   g1h->heap_region_iterate(&cl);
   299   HeapRegion *r = cl.result();
   300   HeapRegion *r = cl.result();
   333 void G1MarkSweep::mark_sweep_phase3() {
   334 void G1MarkSweep::mark_sweep_phase3() {
   334   G1CollectedHeap* g1h = G1CollectedHeap::heap();
   335   G1CollectedHeap* g1h = G1CollectedHeap::heap();
   335   Generation* pg = g1h->perm_gen();
   336   Generation* pg = g1h->perm_gen();
   336 
   337 
   337   // Adjust the pointers to reflect the new locations
   338   // Adjust the pointers to reflect the new locations
   338   TraceTime tm("phase 3", PrintGC && Verbose, true, gclog_or_tty);
   339   TraceTime tm("phase 3", G1Log::fine() && Verbose, true, gclog_or_tty);
   339   GenMarkSweep::trace("3");
   340   GenMarkSweep::trace("3");
   340 
   341 
   341   SharedHeap* sh = SharedHeap::heap();
   342   SharedHeap* sh = SharedHeap::heap();
   342 
   343 
   343   sh->process_strong_roots(true,  // activate StrongRootsScope
   344   sh->process_strong_roots(true,  // activate StrongRootsScope
   397   // here (perm_gen first rather than last), so we tell the validate code
   398   // here (perm_gen first rather than last), so we tell the validate code
   398   // to use a higher index (saved from phase2) when verifying perm_gen.
   399   // to use a higher index (saved from phase2) when verifying perm_gen.
   399   G1CollectedHeap* g1h = G1CollectedHeap::heap();
   400   G1CollectedHeap* g1h = G1CollectedHeap::heap();
   400   Generation* pg = g1h->perm_gen();
   401   Generation* pg = g1h->perm_gen();
   401 
   402 
   402   TraceTime tm("phase 4", PrintGC && Verbose, true, gclog_or_tty);
   403   TraceTime tm("phase 4", G1Log::fine() && Verbose, true, gclog_or_tty);
   403   GenMarkSweep::trace("4");
   404   GenMarkSweep::trace("4");
   404 
   405 
   405   pg->compact();
   406   pg->compact();
   406 
   407 
   407   G1SpaceCompactClosure blk;
   408   G1SpaceCompactClosure blk;