src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp

changeset 3982
aaf61e68b255
parent 3957
a2f7274eb6ef
child 3997
f99a36499b8c
     1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Aug 03 13:24:02 2012 -0700
     1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Mon Aug 06 12:20:14 2012 -0700
     1.3 @@ -1891,6 +1891,8 @@
     1.4    _young_list(new YoungList(this)),
     1.5    _gc_time_stamp(0),
     1.6    _retained_old_gc_alloc_region(NULL),
     1.7 +  _survivor_plab_stats(YoungPLABSize, PLABWeight),
     1.8 +  _old_plab_stats(OldPLABSize, PLABWeight),
     1.9    _expand_heap_after_alloc_failure(true),
    1.10    _surviving_young_words(NULL),
    1.11    _old_marking_cycles_started(0),
    1.12 @@ -4099,17 +4101,22 @@
    1.13    size_t gclab_word_size;
    1.14    switch (purpose) {
    1.15      case GCAllocForSurvived:
    1.16 -      gclab_word_size = YoungPLABSize;
    1.17 +      gclab_word_size = _survivor_plab_stats.desired_plab_sz();
    1.18        break;
    1.19      case GCAllocForTenured:
    1.20 -      gclab_word_size = OldPLABSize;
    1.21 +      gclab_word_size = _old_plab_stats.desired_plab_sz();
    1.22        break;
    1.23      default:
    1.24        assert(false, "unknown GCAllocPurpose");
    1.25 -      gclab_word_size = OldPLABSize;
    1.26 +      gclab_word_size = _old_plab_stats.desired_plab_sz();
    1.27        break;
    1.28    }
    1.29 -  return gclab_word_size;
    1.30 +
    1.31 +  // Prevent humongous PLAB sizes for two reasons:
    1.32 +  // * PLABs are allocated using a similar paths as oops, but should
    1.33 +  //   never be in a humongous region
    1.34 +  // * Allowing humongous PLABs needlessly churns the region free lists
    1.35 +  return MIN2(_humongous_object_threshold_in_words, gclab_word_size);
    1.36  }
    1.37  
    1.38  void G1CollectedHeap::init_mutator_alloc_region() {
    1.39 @@ -4165,6 +4172,11 @@
    1.40    // want either way so no reason to check explicitly for either
    1.41    // condition.
    1.42    _retained_old_gc_alloc_region = _old_gc_alloc_region.release();
    1.43 +
    1.44 +  if (ResizePLAB) {
    1.45 +    _survivor_plab_stats.adjust_desired_plab_sz();
    1.46 +    _old_plab_stats.adjust_desired_plab_sz();
    1.47 +  }
    1.48  }
    1.49  
    1.50  void G1CollectedHeap::abandon_gc_alloc_regions() {

mercurial