comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @ 17736:58fc1b1523dc

8034079: G1: Refactor the HeapRegionSet hierarchy Reviewed-by: tschatzl, pliden
author brutisso
date Fri, 14 Mar 2014 10:15:46 +0100
parents cfd4aac53239
children 191174b49bec
comparison
equal deleted inserted replaced
17735:8f28240318a2 17736:58fc1b1523dc
32 #include "gc_implementation/g1/g1MonitoringSupport.hpp" 32 #include "gc_implementation/g1/g1MonitoringSupport.hpp"
33 #include "gc_implementation/g1/g1RemSet.hpp" 33 #include "gc_implementation/g1/g1RemSet.hpp"
34 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" 34 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
35 #include "gc_implementation/g1/g1YCTypes.hpp" 35 #include "gc_implementation/g1/g1YCTypes.hpp"
36 #include "gc_implementation/g1/heapRegionSeq.hpp" 36 #include "gc_implementation/g1/heapRegionSeq.hpp"
37 #include "gc_implementation/g1/heapRegionSets.hpp" 37 #include "gc_implementation/g1/heapRegionSet.hpp"
38 #include "gc_implementation/shared/hSpaceCounters.hpp" 38 #include "gc_implementation/shared/hSpaceCounters.hpp"
39 #include "gc_implementation/shared/parGCAllocBuffer.hpp" 39 #include "gc_implementation/shared/parGCAllocBuffer.hpp"
40 #include "memory/barrierSet.hpp" 40 #include "memory/barrierSet.hpp"
41 #include "memory/memRegion.hpp" 41 #include "memory/memRegion.hpp"
42 #include "memory/sharedHeap.hpp" 42 #include "memory/sharedHeap.hpp"
241 241
242 // The part of _g1_storage that is currently committed. 242 // The part of _g1_storage that is currently committed.
243 MemRegion _g1_committed; 243 MemRegion _g1_committed;
244 244
245 // The master free list. It will satisfy all new region allocations. 245 // The master free list. It will satisfy all new region allocations.
246 MasterFreeRegionList _free_list; 246 FreeRegionList _free_list;
247 247
248 // The secondary free list which contains regions that have been 248 // The secondary free list which contains regions that have been
249 // freed up during the cleanup process. This will be appended to the 249 // freed up during the cleanup process. This will be appended to the
250 // master free list when appropriate. 250 // master free list when appropriate.
251 SecondaryFreeRegionList _secondary_free_list; 251 FreeRegionList _secondary_free_list;
252 252
253 // It keeps track of the old regions. 253 // It keeps track of the old regions.
254 MasterOldRegionSet _old_set; 254 HeapRegionSet _old_set;
255 255
256 // It keeps track of the humongous regions. 256 // It keeps track of the humongous regions.
257 MasterHumongousRegionSet _humongous_set; 257 HeapRegionSet _humongous_set;
258 258
259 // The number of regions we could create by expansion. 259 // The number of regions we could create by expansion.
260 uint _expansion_regions; 260 uint _expansion_regions;
261 261
262 // The block offset table for the G1 heap. 262 // The block offset table for the G1 heap.
755 755
756 G1YCType yc_type(); 756 G1YCType yc_type();
757 757
758 G1HRPrinter* hr_printer() { return &_hr_printer; } 758 G1HRPrinter* hr_printer() { return &_hr_printer; }
759 759
760 // Frees a non-humongous region by initializing its contents and
761 // adding it to the free list that's passed as a parameter (this is
762 // usually a local list which will be appended to the master free
763 // list later). The used bytes of freed regions are accumulated in
764 // pre_used. If par is true, the region's RSet will not be freed
765 // up. The assumption is that this will be done later.
766 void free_region(HeapRegion* hr,
767 FreeRegionList* free_list,
768 bool par);
769
770 // Frees a humongous region by collapsing it into individual regions
771 // and calling free_region() for each of them. The freed regions
772 // will be added to the free list that's passed as a parameter (this
773 // is usually a local list which will be appended to the master free
774 // list later). The used bytes of freed regions are accumulated in
775 // pre_used. If par is true, the region's RSet will not be freed
776 // up. The assumption is that this will be done later.
777 void free_humongous_region(HeapRegion* hr,
778 FreeRegionList* free_list,
779 bool par);
760 protected: 780 protected:
761 781
762 // Shrink the garbage-first heap by at most the given size (in bytes!). 782 // Shrink the garbage-first heap by at most the given size (in bytes!).
763 // (Rounds down to a HeapRegion boundary.) 783 // (Rounds down to a HeapRegion boundary.)
764 virtual void shrink(size_t expand_bytes); 784 virtual void shrink(size_t expand_bytes);
837 857
838 // Apply "blk" to all the weak roots of the system. These include 858 // Apply "blk" to all the weak roots of the system. These include
839 // JNI weak roots, the code cache, system dictionary, symbol table, 859 // JNI weak roots, the code cache, system dictionary, symbol table,
840 // string table, and referents of reachable weak refs. 860 // string table, and referents of reachable weak refs.
841 void g1_process_weak_roots(OopClosure* root_closure); 861 void g1_process_weak_roots(OopClosure* root_closure);
842
843 // Frees a non-humongous region by initializing its contents and
844 // adding it to the free list that's passed as a parameter (this is
845 // usually a local list which will be appended to the master free
846 // list later). The used bytes of freed regions are accumulated in
847 // pre_used. If par is true, the region's RSet will not be freed
848 // up. The assumption is that this will be done later.
849 void free_region(HeapRegion* hr,
850 size_t* pre_used,
851 FreeRegionList* free_list,
852 bool par);
853
854 // Frees a humongous region by collapsing it into individual regions
855 // and calling free_region() for each of them. The freed regions
856 // will be added to the free list that's passed as a parameter (this
857 // is usually a local list which will be appended to the master free
858 // list later). The used bytes of freed regions are accumulated in
859 // pre_used. If par is true, the region's RSet will not be freed
860 // up. The assumption is that this will be done later.
861 void free_humongous_region(HeapRegion* hr,
862 size_t* pre_used,
863 FreeRegionList* free_list,
864 HumongousRegionSet* humongous_proxy_set,
865 bool par);
866 862
867 // Notifies all the necessary spaces that the committed space has 863 // Notifies all the necessary spaces that the committed space has
868 // been updated (either expanded or shrunk). It should be called 864 // been updated (either expanded or shrunk). It should be called
869 // after _g1_storage is updated. 865 // after _g1_storage is updated.
870 void update_committed_space(HeapWord* old_end, HeapWord* new_end); 866 void update_committed_space(HeapWord* old_end, HeapWord* new_end);
1240 1236
1241 #ifdef ASSERT 1237 #ifdef ASSERT
1242 bool is_on_master_free_list(HeapRegion* hr) { 1238 bool is_on_master_free_list(HeapRegion* hr) {
1243 return hr->containing_set() == &_free_list; 1239 return hr->containing_set() == &_free_list;
1244 } 1240 }
1245
1246 bool is_in_humongous_set(HeapRegion* hr) {
1247 return hr->containing_set() == &_humongous_set;
1248 }
1249 #endif // ASSERT 1241 #endif // ASSERT
1250 1242
1251 // Wrapper for the region list operations that can be called from 1243 // Wrapper for the region list operations that can be called from
1252 // methods outside this class. 1244 // methods outside this class.
1253 1245
1296 void collect_locked(GCCause::Cause cause); 1288 void collect_locked(GCCause::Cause cause);
1297 1289
1298 // True iff an evacuation has failed in the most-recent collection. 1290 // True iff an evacuation has failed in the most-recent collection.
1299 bool evacuation_failed() { return _evacuation_failed; } 1291 bool evacuation_failed() { return _evacuation_failed; }
1300 1292
1301 // It will free a region if it has allocated objects in it that are 1293 void remove_from_old_sets(const HeapRegionSetCount& old_regions_removed, const HeapRegionSetCount& humongous_regions_removed);
1302 // all dead. It calls either free_region() or 1294 void prepend_to_freelist(FreeRegionList* list);
1303 // free_humongous_region() depending on the type of the region that 1295 void decrement_summary_bytes(size_t bytes);
1304 // is passed to it.
1305 void free_region_if_empty(HeapRegion* hr,
1306 size_t* pre_used,
1307 FreeRegionList* free_list,
1308 OldRegionSet* old_proxy_set,
1309 HumongousRegionSet* humongous_proxy_set,
1310 HRRSCleanupTask* hrrs_cleanup_task,
1311 bool par);
1312
1313 // It appends the free list to the master free list and updates the
1314 // master humongous list according to the contents of the proxy
1315 // list. It also adjusts the total used bytes according to pre_used
1316 // (if par is true, it will do so by taking the ParGCRareEvent_lock).
1317 void update_sets_after_freeing_regions(size_t pre_used,
1318 FreeRegionList* free_list,
1319 OldRegionSet* old_proxy_set,
1320 HumongousRegionSet* humongous_proxy_set,
1321 bool par);
1322 1296
1323 // Returns "TRUE" iff "p" points into the committed areas of the heap. 1297 // Returns "TRUE" iff "p" points into the committed areas of the heap.
1324 virtual bool is_in(const void* p) const; 1298 virtual bool is_in(const void* p) const;
1325 1299
1326 // Return "TRUE" iff the given object address is within the collection 1300 // Return "TRUE" iff the given object address is within the collection