From 9d2ac71c0d5cf8f31645f44c2c2c8c53b07d1c53 Mon Sep 17 00:00:00 2001 From: jmasa Date: Tue, 25 Jun 2013 15:17:11 -0700 Subject: [PATCH] 8014851: UseAdaptiveGCBoundary is broken Reviewed-by: tschatzl, brutisso --- .../parallelScavenge/asPSOldGen.cpp | 11 ++++ .../parallelScavenge/asPSOldGen.hpp | 2 + .../parallelScavenge/psOldGen.hpp | 2 +- .../parallelScavenge/AdaptiveGCBoundary.java | 61 +++++++++++++++++++ 4 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 test/gc/parallelScavenge/AdaptiveGCBoundary.java diff --git a/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.cpp b/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.cpp index 0c12e98be..39f5835ff 100644 --- a/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.cpp +++ b/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.cpp @@ -70,6 +70,17 @@ ASPSOldGen::ASPSOldGen(PSVirtualSpace* vs, _virtual_space = vs; } +void ASPSOldGen::initialize_work(const char* perf_data_name, int level) { + + PSOldGen::initialize_work(perf_data_name, level); + + // The old gen can grow to gen_size_limit(). _reserve reflects only + // the current maximum that can be committed. + assert(_reserved.byte_size() <= gen_size_limit(), "Consistency check"); + + initialize_performance_counters(perf_data_name, level); +} + void ASPSOldGen::reset_after_change() { _reserved = MemRegion((HeapWord*)virtual_space()->low_boundary(), (HeapWord*)virtual_space()->high_boundary()); diff --git a/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.hpp b/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.hpp index 3de4f9793..eaa1f2b55 100644 --- a/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.hpp +++ b/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.hpp @@ -50,6 +50,8 @@ class ASPSOldGen : public PSOldGen { size_t max_gen_size() { return _reserved.byte_size(); } void set_gen_size_limit(size_t v) { _gen_size_limit = v; } + virtual void initialize_work(const char* perf_data_name, int level); + // After a shrink or expand reset the generation void reset_after_change(); diff --git a/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp b/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp index ed784f30d..cf8f574dd 100644 --- a/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp +++ b/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp @@ -110,7 +110,7 @@ class PSOldGen : public CHeapObj { virtual void initialize(ReservedSpace rs, size_t alignment, const char* perf_data_name, int level); void initialize_virtual_space(ReservedSpace rs, size_t alignment); - void initialize_work(const char* perf_data_name, int level); + virtual void initialize_work(const char* perf_data_name, int level); virtual void initialize_performance_counters(const char* perf_data_name, int level); MemRegion reserved() const { return _reserved; } diff --git a/test/gc/parallelScavenge/AdaptiveGCBoundary.java b/test/gc/parallelScavenge/AdaptiveGCBoundary.java new file mode 100644 index 000000000..571255996 --- /dev/null +++ b/test/gc/parallelScavenge/AdaptiveGCBoundary.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test AdaptiveGCBoundary + * @summary UseAdaptiveGCBoundary is broken + * @bug 8014546 + * @key gc + * @key regression + * @library /testlibrary + * @run main/othervm AdaptiveGCBoundary + * @author jon.masamitsu@oracle.com + */ + +import com.oracle.java.testlibrary.*; + +public class AdaptiveGCBoundary { + public static void main(String args[]) throws Exception { + + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-showversion", + "-XX:+UseParallelGC", + "-XX:+UseAdaptiveGCBoundary", + "-XX:+PrintCommandLineFlags", + SystemGCCaller.class.getName() + ); + + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + + output.shouldContain("+UseAdaptiveGCBoundary"); + + output.shouldNotContain("error"); + + output.shouldHaveExitValue(0); + } + static class SystemGCCaller { + public static void main(String [] args) { + System.gc(); + } + } +} -- GitLab