hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.hpp
changeset 26839 021bfc544c6f
parent 18025 b7bcf7497f93
child 28478 b3a2d4115e0d
equal deleted inserted replaced
26838:344fb68e970a 26839:021bfc544c6f
    41 // G1CollectedHeap using a four-phase pointer forwarding algorithm.  All
    41 // G1CollectedHeap using a four-phase pointer forwarding algorithm.  All
    42 // generations are assumed to support marking; those that can also support
    42 // generations are assumed to support marking; those that can also support
    43 // compaction.
    43 // compaction.
    44 //
    44 //
    45 // Class unloading will only occur when a full gc is invoked.
    45 // Class unloading will only occur when a full gc is invoked.
    46 
    46 class G1PrepareCompactClosure;
    47 
    47 
    48 class G1MarkSweep : AllStatic {
    48 class G1MarkSweep : AllStatic {
    49   friend class VM_G1MarkSweep;
    49   friend class VM_G1MarkSweep;
    50   friend class Scavenge;
    50   friend class Scavenge;
    51 
    51 
    68   static void mark_sweep_phase3();
    68   static void mark_sweep_phase3();
    69   // Move objects to new positions
    69   // Move objects to new positions
    70   static void mark_sweep_phase4();
    70   static void mark_sweep_phase4();
    71 
    71 
    72   static void allocate_stacks();
    72   static void allocate_stacks();
       
    73   static void prepare_compaction();
       
    74   static void prepare_compaction_work(G1PrepareCompactClosure* blk);
       
    75 };
       
    76 
       
    77 class G1PrepareCompactClosure : public HeapRegionClosure {
       
    78  protected:
       
    79   G1CollectedHeap* _g1h;
       
    80   ModRefBarrierSet* _mrbs;
       
    81   CompactPoint _cp;
       
    82   HeapRegionSetCount _humongous_regions_removed;
       
    83 
       
    84   virtual void prepare_for_compaction(HeapRegion* hr, HeapWord* end);
       
    85   void prepare_for_compaction_work(CompactPoint* cp, HeapRegion* hr, HeapWord* end);
       
    86   void free_humongous_region(HeapRegion* hr);
       
    87   bool is_cp_initialized() const { return _cp.space != NULL; }
       
    88 
       
    89  public:
       
    90   G1PrepareCompactClosure() :
       
    91     _g1h(G1CollectedHeap::heap()),
       
    92     _mrbs(_g1h->g1_barrier_set()),
       
    93     _humongous_regions_removed() { }
       
    94 
       
    95   void update_sets();
       
    96   bool doHeapRegion(HeapRegion* hr);
    73 };
    97 };
    74 
    98 
    75 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1MARKSWEEP_HPP
    99 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1MARKSWEEP_HPP