Print this page
G1: Use SoftMaxHeapSize to guide GC heuristics

Split Close
Expand all
Collapse all
          --- old/src/hotspot/share/gc/g1/g1CollectedHeap.hpp
          +++ new/src/hotspot/share/gc/g1/g1CollectedHeap.hpp
↓ open down ↓ 773 lines elided ↑ open up ↑
 774  774  private:
 775  775    // Evacuate the next set of optional regions.
 776  776    void evacuate_next_optional_regions(G1ParScanThreadStateSet* per_thread_states);
 777  777  
 778  778  public:
 779  779    void pre_evacuate_collection_set(G1EvacuationInfo& evacuation_info, G1ParScanThreadStateSet* pss);
 780  780    void post_evacuate_collection_set(G1EvacuationInfo& evacuation_info,
 781  781                                      G1RedirtyCardsQueueSet* rdcqs,
 782  782                                      G1ParScanThreadStateSet* pss);
 783  783  
 784      -  void expand_heap_after_young_collection();
      784 +  void resize_heap_after_young_collection();
      785 +  bool expand_heap_after_young_collection();
      786 +  void shrink_heap_after_young_collection();
      787 +  void expand_heap_after_concurrent_mark();
      788 +
 785  789    // Update object copying statistics.
 786  790    void record_obj_copy_mem_stats();
 787  791  
 788  792    // The hot card cache for remembered set insertion optimization.
 789  793    G1HotCardCache* _hot_card_cache;
 790  794  
 791  795    // The g1 remembered set of the heap.
 792  796    G1RemSet* _rem_set;
 793  797  
 794  798    // After a collection pause, convert the regions in the collection set into free
↓ open down ↓ 276 lines elided ↑ open up ↑
1071 1075    bool is_on_master_free_list(HeapRegion* hr) {
1072 1076      return _hrm->is_free(hr);
1073 1077    }
1074 1078  #endif // ASSERT
1075 1079  
1076 1080    inline void old_set_add(HeapRegion* hr);
1077 1081    inline void old_set_remove(HeapRegion* hr);
1078 1082  
1079 1083    inline void archive_set_add(HeapRegion* hr);
1080 1084  
1081      -  size_t non_young_capacity_bytes() {
     1085 +  size_t non_young_capacity_bytes() const {
1082 1086      return (old_regions_count() + _archive_set.length() + humongous_regions_count()) * HeapRegion::GrainBytes;
1083 1087    }
1084 1088  
1085 1089    // Determine whether the given region is one that we are using as an
1086 1090    // old GC alloc region.
1087 1091    bool is_old_gc_alloc_region(HeapRegion* hr);
1088 1092  
1089 1093    // Perform a collection of the heap; intended for use in implementing
1090 1094    // "System.gc".  This probably implies as full a collection as the
1091 1095    // "CollectedHeap" supports.
↓ open down ↓ 180 lines elided ↑ open up ↑
1272 1276  
1273 1277    // Returns the number of regions the humongous object of the given word size
1274 1278    // requires.
1275 1279    static size_t humongous_obj_size_in_regions(size_t word_size);
1276 1280  
1277 1281    // Print the maximum heap capacity.
1278 1282    virtual size_t max_capacity() const;
1279 1283  
1280 1284    // Return the size of reserved memory. Returns different value than max_capacity() when AllocateOldGenAt is used.
1281 1285    virtual size_t max_reserved_capacity() const;
     1286 +
     1287 +  // Print the soft maximum heap capacity.
     1288 +  size_t soft_max_capacity() const;
1282 1289  
1283 1290    virtual jlong millis_since_last_gc();
1284 1291  
1285 1292  
1286 1293    // Convenience function to be used in situations where the heap type can be
1287 1294    // asserted to be this type.
1288 1295    static G1CollectedHeap* heap();
1289 1296  
1290 1297    void set_region_short_lived_locked(HeapRegion* hr);
1291 1298    // add appropriate methods for any other surv rate groups
↓ open down ↓ 213 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX