Tue, 25 Jun 2013 15:17:11 -0700
8014851: UseAdaptiveGCBoundary is broken
Reviewed-by: tschatzl, brutisso
1.1 --- a/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.cpp Tue Jun 25 09:58:26 2013 -0700 1.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.cpp Tue Jun 25 15:17:11 2013 -0700 1.3 @@ -70,6 +70,17 @@ 1.4 _virtual_space = vs; 1.5 } 1.6 1.7 +void ASPSOldGen::initialize_work(const char* perf_data_name, int level) { 1.8 + 1.9 + PSOldGen::initialize_work(perf_data_name, level); 1.10 + 1.11 + // The old gen can grow to gen_size_limit(). _reserve reflects only 1.12 + // the current maximum that can be committed. 1.13 + assert(_reserved.byte_size() <= gen_size_limit(), "Consistency check"); 1.14 + 1.15 + initialize_performance_counters(perf_data_name, level); 1.16 +} 1.17 + 1.18 void ASPSOldGen::reset_after_change() { 1.19 _reserved = MemRegion((HeapWord*)virtual_space()->low_boundary(), 1.20 (HeapWord*)virtual_space()->high_boundary());
2.1 --- a/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.hpp Tue Jun 25 09:58:26 2013 -0700 2.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.hpp Tue Jun 25 15:17:11 2013 -0700 2.3 @@ -50,6 +50,8 @@ 2.4 size_t max_gen_size() { return _reserved.byte_size(); } 2.5 void set_gen_size_limit(size_t v) { _gen_size_limit = v; } 2.6 2.7 + virtual void initialize_work(const char* perf_data_name, int level); 2.8 + 2.9 // After a shrink or expand reset the generation 2.10 void reset_after_change(); 2.11
3.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp Tue Jun 25 09:58:26 2013 -0700 3.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp Tue Jun 25 15:17:11 2013 -0700 3.3 @@ -110,7 +110,7 @@ 3.4 virtual void initialize(ReservedSpace rs, size_t alignment, 3.5 const char* perf_data_name, int level); 3.6 void initialize_virtual_space(ReservedSpace rs, size_t alignment); 3.7 - void initialize_work(const char* perf_data_name, int level); 3.8 + virtual void initialize_work(const char* perf_data_name, int level); 3.9 virtual void initialize_performance_counters(const char* perf_data_name, int level); 3.10 3.11 MemRegion reserved() const { return _reserved; }
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/test/gc/parallelScavenge/AdaptiveGCBoundary.java Tue Jun 25 15:17:11 2013 -0700 4.3 @@ -0,0 +1,61 @@ 4.4 +/* 4.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 4.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.7 + * 4.8 + * This code is free software; you can redistribute it and/or modify it 4.9 + * under the terms of the GNU General Public License version 2 only, as 4.10 + * published by the Free Software Foundation. 4.11 + * 4.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 4.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 4.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 4.15 + * version 2 for more details (a copy is included in the LICENSE file that 4.16 + * accompanied this code). 4.17 + * 4.18 + * You should have received a copy of the GNU General Public License version 4.19 + * 2 along with this work; if not, write to the Free Software Foundation, 4.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 4.21 + * 4.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 4.23 + * or visit www.oracle.com if you need additional information or have any 4.24 + * questions. 4.25 + */ 4.26 + 4.27 +/** 4.28 + * @test AdaptiveGCBoundary 4.29 + * @summary UseAdaptiveGCBoundary is broken 4.30 + * @bug 8014546 4.31 + * @key gc 4.32 + * @key regression 4.33 + * @library /testlibrary 4.34 + * @run main/othervm AdaptiveGCBoundary 4.35 + * @author jon.masamitsu@oracle.com 4.36 + */ 4.37 + 4.38 +import com.oracle.java.testlibrary.*; 4.39 + 4.40 +public class AdaptiveGCBoundary { 4.41 + public static void main(String args[]) throws Exception { 4.42 + 4.43 + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( 4.44 + "-showversion", 4.45 + "-XX:+UseParallelGC", 4.46 + "-XX:+UseAdaptiveGCBoundary", 4.47 + "-XX:+PrintCommandLineFlags", 4.48 + SystemGCCaller.class.getName() 4.49 + ); 4.50 + 4.51 + OutputAnalyzer output = new OutputAnalyzer(pb.start()); 4.52 + 4.53 + output.shouldContain("+UseAdaptiveGCBoundary"); 4.54 + 4.55 + output.shouldNotContain("error"); 4.56 + 4.57 + output.shouldHaveExitValue(0); 4.58 + } 4.59 + static class SystemGCCaller { 4.60 + public static void main(String [] args) { 4.61 + System.gc(); 4.62 + } 4.63 + } 4.64 +}