Sun, 02 Aug 2009 22:33:27 -0700
Merge
1.1 --- a/src/share/vm/runtime/arguments.cpp Sun Aug 02 19:10:31 2009 -0700 1.2 +++ b/src/share/vm/runtime/arguments.cpp Sun Aug 02 22:33:27 2009 -0700 1.3 @@ -1054,7 +1054,15 @@ 1.4 1.5 // Unless explicitly requested otherwise, size young gen 1.6 // for "short" pauses ~ 4M*ParallelGCThreads 1.7 - if (FLAG_IS_DEFAULT(MaxNewSize)) { // MaxNewSize not set at command-line 1.8 + 1.9 + // If either MaxNewSize or NewRatio is set on the command line, 1.10 + // assume the user is trying to set the size of the young gen. 1.11 + 1.12 + if (FLAG_IS_DEFAULT(MaxNewSize) && FLAG_IS_DEFAULT(NewRatio)) { 1.13 + 1.14 + // Set MaxNewSize to our calculated preferred_max_new_size unless 1.15 + // NewSize was set on the command line and it is larger than 1.16 + // preferred_max_new_size. 1.17 if (!FLAG_IS_DEFAULT(NewSize)) { // NewSize explicitly set at command-line 1.18 FLAG_SET_ERGO(uintx, MaxNewSize, MAX2(NewSize, preferred_max_new_size)); 1.19 } else { 1.20 @@ -1063,15 +1071,32 @@ 1.21 if(PrintGCDetails && Verbose) { 1.22 // Too early to use gclog_or_tty 1.23 tty->print_cr("Ergo set MaxNewSize: " SIZE_FORMAT, MaxNewSize); 1.24 - } 1.25 - } 1.26 - // Unless explicitly requested otherwise, prefer a large 1.27 - // Old to Young gen size so as to shift the collection load 1.28 - // to the old generation concurrent collector 1.29 - if (FLAG_IS_DEFAULT(NewRatio)) { 1.30 + } 1.31 + 1.32 + // Unless explicitly requested otherwise, prefer a large 1.33 + // Old to Young gen size so as to shift the collection load 1.34 + // to the old generation concurrent collector 1.35 + 1.36 + // If this is only guarded by FLAG_IS_DEFAULT(NewRatio) 1.37 + // then NewSize and OldSize may be calculated. That would 1.38 + // generally lead to some differences with ParNewGC for which 1.39 + // there was no obvious reason. Also limit to the case where 1.40 + // MaxNewSize has not been set. 1.41 + 1.42 FLAG_SET_ERGO(intx, NewRatio, MAX2(NewRatio, new_ratio)); 1.43 1.44 - size_t min_new = align_size_up(ScaleForWordSize(min_new_default), os::vm_page_size()); 1.45 + // Code along this path potentially sets NewSize and OldSize 1.46 + 1.47 + // Calculate the desired minimum size of the young gen but if 1.48 + // NewSize has been set on the command line, use it here since 1.49 + // it should be the final value. 1.50 + size_t min_new; 1.51 + if (FLAG_IS_DEFAULT(NewSize)) { 1.52 + min_new = align_size_up(ScaleForWordSize(min_new_default), 1.53 + os::vm_page_size()); 1.54 + } else { 1.55 + min_new = NewSize; 1.56 + } 1.57 size_t prev_initial_size = initial_heap_size(); 1.58 if (prev_initial_size != 0 && prev_initial_size < min_new+OldSize) { 1.59 set_initial_heap_size(min_new+OldSize); 1.60 @@ -1083,9 +1108,11 @@ 1.61 initial_heap_size()/M, prev_initial_size/M); 1.62 } 1.63 } 1.64 + 1.65 // MaxHeapSize is aligned down in collectorPolicy 1.66 - size_t max_heap = align_size_down(MaxHeapSize, 1.67 - CardTableRS::ct_max_alignment_constraint()); 1.68 + size_t max_heap = 1.69 + align_size_down(MaxHeapSize, 1.70 + CardTableRS::ct_max_alignment_constraint()); 1.71 1.72 if(PrintGCDetails && Verbose) { 1.73 // Too early to use gclog_or_tty 1.74 @@ -1150,8 +1177,9 @@ 1.75 // CMSParPromoteBlocksToClaim is a collector-specific flag, so 1.76 // we'll let it to take precedence. 1.77 jio_fprintf(defaultStream::error_stream(), 1.78 - "Both OldPLABSize and CMSParPromoteBlocksToClaim options are specified " 1.79 - "for the CMS collector. CMSParPromoteBlocksToClaim will take precedence.\n"); 1.80 + "Both OldPLABSize and CMSParPromoteBlocksToClaim" 1.81 + " options are specified for the CMS collector." 1.82 + " CMSParPromoteBlocksToClaim will take precedence.\n"); 1.83 } 1.84 } 1.85 }