comparison src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp @ 9072:8617e38bb4cb

8008508: CMS does not correctly reduce heap size after a Full GC Reviewed-by: johnc, ysr
author jmasa
date Mon, 11 Feb 2013 10:31:56 -0800
parents f64ffbf81af5
children 7b835924c31c
comparison
equal deleted inserted replaced
9071:68fe50d4f1d5 9072:8617e38bb4cb
58 class ConcurrentMarkSweepThread; 58 class ConcurrentMarkSweepThread;
59 class CompactibleFreeListSpace; 59 class CompactibleFreeListSpace;
60 class FreeChunk; 60 class FreeChunk;
61 class PromotionInfo; 61 class PromotionInfo;
62 class ScanMarkedObjectsAgainCarefullyClosure; 62 class ScanMarkedObjectsAgainCarefullyClosure;
63 class TenuredGeneration;
63 64
64 // A generic CMS bit map. It's the basis for both the CMS marking bit map 65 // A generic CMS bit map. It's the basis for both the CMS marking bit map
65 // as well as for the mod union table (in each case only a subset of the 66 // as well as for the mod union table (in each case only a subset of the
66 // methods are used). This is essentially a wrapper around the BitMap class, 67 // methods are used). This is essentially a wrapper around the BitMap class,
67 // with one bit per (1<<_shifter) HeapWords. (i.e. for the marking bit map, 68 // with one bit per (1<<_shifter) HeapWords. (i.e. for the marking bit map,
808 809
809 // An auxilliary method used to record the ends of 810 // An auxilliary method used to record the ends of
810 // used regions of each generation to limit the extent of sweep 811 // used regions of each generation to limit the extent of sweep
811 void save_sweep_limits(); 812 void save_sweep_limits();
812 813
813 // Resize the generations included in the collector.
814 void compute_new_size();
815
816 // A work method used by foreground collection to determine 814 // A work method used by foreground collection to determine
817 // what type of collection (compacting or not, continuing or fresh) 815 // what type of collection (compacting or not, continuing or fresh)
818 // it should do. 816 // it should do.
819 void decide_foreground_collection_type(bool clear_all_soft_refs, 817 void decide_foreground_collection_type(bool clear_all_soft_refs,
820 bool* should_compact, bool* should_start_over); 818 bool* should_compact, bool* should_start_over);
906 size_t word_size); 904 size_t word_size);
907 905
908 void getFreelistLocks() const; 906 void getFreelistLocks() const;
909 void releaseFreelistLocks() const; 907 void releaseFreelistLocks() const;
910 bool haveFreelistLocks() const; 908 bool haveFreelistLocks() const;
909
910 // Adjust size of underlying generation
911 void compute_new_size();
911 912
912 // GC prologue and epilogue 913 // GC prologue and epilogue
913 void gc_prologue(bool full); 914 void gc_prologue(bool full);
914 void gc_epilogue(bool full); 915 void gc_epilogue(bool full);
915 916
1080 // will collect this generation (at least). 1081 // will collect this generation (at least).
1081 double _initiating_occupancy; 1082 double _initiating_occupancy;
1082 1083
1083 protected: 1084 protected:
1084 // Shrink generation by specified size (returns false if unable to shrink) 1085 // Shrink generation by specified size (returns false if unable to shrink)
1085 virtual void shrink_by(size_t bytes); 1086 void shrink_free_list_by(size_t bytes);
1086 1087
1087 // Update statistics for GC 1088 // Update statistics for GC
1088 virtual void update_gc_stats(int level, bool full); 1089 virtual void update_gc_stats(int level, bool full);
1089 1090
1090 // Maximum available space in the generation (including uncommitted) 1091 // Maximum available space in the generation (including uncommitted)
1231 // Allocation failure 1232 // Allocation failure
1232 void expand(size_t bytes, size_t expand_bytes, 1233 void expand(size_t bytes, size_t expand_bytes,
1233 CMSExpansionCause::Cause cause); 1234 CMSExpansionCause::Cause cause);
1234 virtual bool expand(size_t bytes, size_t expand_bytes); 1235 virtual bool expand(size_t bytes, size_t expand_bytes);
1235 void shrink(size_t bytes); 1236 void shrink(size_t bytes);
1237 void shrink_by(size_t bytes);
1236 HeapWord* expand_and_par_lab_allocate(CMSParGCThreadState* ps, size_t word_sz); 1238 HeapWord* expand_and_par_lab_allocate(CMSParGCThreadState* ps, size_t word_sz);
1237 bool expand_and_ensure_spooling_space(PromotionInfo* promo); 1239 bool expand_and_ensure_spooling_space(PromotionInfo* promo);
1238 1240
1239 // Iteration support and related enquiries 1241 // Iteration support and related enquiries
1240 void save_marks(); 1242 void save_marks();
1291 void print() const; 1293 void print() const;
1292 void printOccupancy(const char* s); 1294 void printOccupancy(const char* s);
1293 bool must_be_youngest() const { return false; } 1295 bool must_be_youngest() const { return false; }
1294 bool must_be_oldest() const { return true; } 1296 bool must_be_oldest() const { return true; }
1295 1297
1296 void compute_new_size(); 1298 // Resize the generation after a compacting GC. The
1299 // generation can be treated as a contiguous space
1300 // after the compaction.
1301 virtual void compute_new_size();
1302 // Resize the generation after a non-compacting
1303 // collection.
1304 void compute_new_size_free_list();
1297 1305
1298 CollectionTypes debug_collection_type() { return _debug_collection_type; } 1306 CollectionTypes debug_collection_type() { return _debug_collection_type; }
1299 void rotate_debug_collection_type(); 1307 void rotate_debug_collection_type();
1300 }; 1308 };
1301 1309
1313 CMSGCAdaptivePolicyCounters* gc_adaptive_policy_counters(); 1321 CMSGCAdaptivePolicyCounters* gc_adaptive_policy_counters();
1314 1322
1315 virtual void shrink_by(size_t bytes); 1323 virtual void shrink_by(size_t bytes);
1316 1324
1317 public: 1325 public:
1318 virtual void compute_new_size();
1319 ASConcurrentMarkSweepGeneration(ReservedSpace rs, size_t initial_byte_size, 1326 ASConcurrentMarkSweepGeneration(ReservedSpace rs, size_t initial_byte_size,
1320 int level, CardTableRS* ct, 1327 int level, CardTableRS* ct,
1321 bool use_adaptive_freelists, 1328 bool use_adaptive_freelists,
1322 FreeBlockDictionary<FreeChunk>::DictionaryChoice 1329 FreeBlockDictionary<FreeChunk>::DictionaryChoice
1323 dictionaryChoice) : 1330 dictionaryChoice) :