1.1 --- a/src/share/vm/gc_implementation/g1/g1MarkSweep.hpp Mon Sep 08 14:13:01 2014 +0000 1.2 +++ b/src/share/vm/gc_implementation/g1/g1MarkSweep.hpp Tue Sep 09 00:05:25 2014 +0200 1.3 @@ -43,7 +43,7 @@ 1.4 // compaction. 1.5 // 1.6 // Class unloading will only occur when a full gc is invoked. 1.7 - 1.8 +class G1PrepareCompactClosure; 1.9 1.10 class G1MarkSweep : AllStatic { 1.11 friend class VM_G1MarkSweep; 1.12 @@ -70,6 +70,30 @@ 1.13 static void mark_sweep_phase4(); 1.14 1.15 static void allocate_stacks(); 1.16 + static void prepare_compaction(); 1.17 + static void prepare_compaction_work(G1PrepareCompactClosure* blk); 1.18 +}; 1.19 + 1.20 +class G1PrepareCompactClosure : public HeapRegionClosure { 1.21 + protected: 1.22 + G1CollectedHeap* _g1h; 1.23 + ModRefBarrierSet* _mrbs; 1.24 + CompactPoint _cp; 1.25 + HeapRegionSetCount _humongous_regions_removed; 1.26 + 1.27 + virtual void prepare_for_compaction(HeapRegion* hr, HeapWord* end); 1.28 + void prepare_for_compaction_work(CompactPoint* cp, HeapRegion* hr, HeapWord* end); 1.29 + void free_humongous_region(HeapRegion* hr); 1.30 + bool is_cp_initialized() const { return _cp.space != NULL; } 1.31 + 1.32 + public: 1.33 + G1PrepareCompactClosure() : 1.34 + _g1h(G1CollectedHeap::heap()), 1.35 + _mrbs(_g1h->g1_barrier_set()), 1.36 + _humongous_regions_removed() { } 1.37 + 1.38 + void update_sets(); 1.39 + bool doHeapRegion(HeapRegion* hr); 1.40 }; 1.41 1.42 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1MARKSWEEP_HPP