# HG changeset patch # User jmasa # Date 1473432654 25200 # Fri Sep 09 07:50:54 2016 -0700 # Node ID 7ffb3b9c2a1a8ff882d64a1ff2b0de7111e6a70d # Parent 53a14fe654147d4803187c59817a0ffd5846a951 8155948: Add message for CMS deprecation for some internal builds Reviewed-by: drwhite * * * Reviewed-by: kbarrett, dholmes diff --git a/src/share/vm/runtime/arguments.cpp b/src/share/vm/runtime/arguments.cpp --- a/src/share/vm/runtime/arguments.cpp +++ b/src/share/vm/runtime/arguments.cpp @@ -351,14 +351,6 @@ * Deprecated options should be tested in VMDeprecatedOptions.java. */ -// Obsolete or deprecated -XX flag. -typedef struct { - const char* name; - JDK_Version deprecated_in; // When the deprecation warning started (or "undefined"). - JDK_Version obsolete_in; // When the obsolete warning started (or "undefined"). - JDK_Version expired_in; // When the option expires (or "undefined"). -} SpecialFlag; - // The special_jvm_flags table declares options that are being deprecated and/or obsoleted. The // "deprecated_in" or "obsolete_in" fields may be set to "undefined", but not both. // When the JDK version reaches 'deprecated_in' limit, the JVM will process this flag on @@ -498,7 +490,14 @@ } } +extern bool lookup_special_flag_ext(const char *flag_name, SpecialFlag& flag); + static bool lookup_special_flag(const char *flag_name, SpecialFlag& flag) { + // Allow extensions to have priority + if (lookup_special_flag_ext(flag_name, flag)) { + return true; + } + for (size_t i = 0; special_jvm_flags[i].name != NULL; i++) { if ((strcmp(special_jvm_flags[i].name, flag_name) == 0)) { flag = special_jvm_flags[i]; @@ -1804,6 +1803,8 @@ if (os::is_server_class_machine()) { if (should_auto_select_low_pause_collector()) { FLAG_SET_ERGO_IF_DEFAULT(bool, UseConcMarkSweepGC, true); + FLAG_SET_ERGO_IF_DEFAULT(bool, UseParNewGC, true); + handle_extra_cms_flags("UseAutoGCSelectPolicy uses UseConcMarkSweepGC"); } else { FLAG_SET_ERGO_IF_DEFAULT(bool, UseG1GC, true); } @@ -2870,11 +2871,13 @@ if (FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, true) != Flag::SUCCESS) { return JNI_EINVAL; } + handle_extra_cms_flags("-Xconcgc uses UseConcMarkSweepGC"); // -Xnoconcgc } else if (match_option(option, "-Xnoconcgc")) { if (FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, false) != Flag::SUCCESS) { return JNI_EINVAL; } + handle_extra_cms_flags("-Xnoconcgc uses UseConcMarkSweepGC"); // -Xbatch } else if (match_option(option, "-Xbatch")) { if (FLAG_SET_CMDLINE(bool, BackgroundCompilation, false) != Flag::SUCCESS) { @@ -4161,6 +4164,16 @@ return true; } +void Arguments::handle_extra_cms_flags(const char* msg) { + SpecialFlag flag; + const char *flag_name = "UseConcMarkSweepGC"; + if (log_is_enabled(Warning, gc) && + lookup_special_flag(flag_name, flag)) { + handle_aliases_and_deprecation(flag_name, /* print warning */ true); + warning("%s", msg); + } +} + // Parse entry point called from JNI_CreateJavaVM jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) { diff --git a/src/share/vm/runtime/arguments.hpp b/src/share/vm/runtime/arguments.hpp --- a/src/share/vm/runtime/arguments.hpp +++ b/src/share/vm/runtime/arguments.hpp @@ -41,6 +41,14 @@ typedef jint (JNICALL *vfprintf_hook_t)(FILE *fp, const char *format, va_list args) ATTRIBUTE_PRINTF(2, 0); } +// Obsolete or deprecated -XX flag. +struct SpecialFlag { + const char* name; + JDK_Version deprecated_in; // When the deprecation warning started (or "undefined"). + JDK_Version obsolete_in; // When the obsolete warning started (or "undefined"). + JDK_Version expired_in; // When the option expires (or "undefined"). +}; + // PathString is used as: // - the underlying value for a SystemProperty // - the path portion of an --patch-module module/path pair @@ -519,6 +527,8 @@ static bool handle_deprecated_print_gc_flags(); + static void handle_extra_cms_flags(const char* msg); + static jint parse_vm_init_args(const JavaVMInitArgs *java_tool_options_args, const JavaVMInitArgs *java_options_args, const JavaVMInitArgs *cmd_line_args); diff --git a/src/share/vm/runtime/arguments_ext.cpp b/src/share/vm/runtime/arguments_ext.cpp new file mode 100644 --- /dev/null +++ b/src/share/vm/runtime/arguments_ext.cpp @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2016, 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. + * + */ + +#include "precompiled.hpp" +#include "runtime/arguments.hpp" + +bool lookup_special_flag_ext(const char *flag_name, SpecialFlag& flag) { + return false; +} diff --git a/test/gc/startup_warnings/TestCMS.java b/test/gc/startup_warnings/TestCMS.java --- a/test/gc/startup_warnings/TestCMS.java +++ b/test/gc/startup_warnings/TestCMS.java @@ -24,8 +24,8 @@ /* * @test TestCMS * @key gc -* @bug 8006398 -* @summary Test that CMS does not print a warning message +* @bug 8006398 8155948 +* @summary Test that CMS prints a warning message only for a commercial build * @library /test/lib * @modules java.base/jdk.internal.misc * java.management @@ -33,16 +33,28 @@ import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; - +import jdk.test.lib.BuildHelper; public class TestCMS { - public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseConcMarkSweepGC", "-version"); + public static void runTest(String[] args) throws Exception { + boolean isCommercial = BuildHelper.isCommercialBuild(); + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args); OutputAnalyzer output = new OutputAnalyzer(pb.start()); - output.shouldNotContain("deprecated"); + if (isCommercial) { + output.shouldContain("deprecated"); + } else { + output.shouldNotContain("deprecated"); + } output.shouldNotContain("error"); output.shouldHaveExitValue(0); } + + public static void main(String args[]) throws Exception { + runTest(new String[] {"-XX:+UseConcMarkSweepGC", "-version"}); + runTest(new String[] {"-Xconcgc", "-version"}); + runTest(new String[] {"-Xnoconcgc", "-version"}); + runTest(new String[] {"-XX:+UseAutoGCSelectPolicy", "-XX:MaxGCPauseMillis=100", "-XX:AutoGCSelectPauseMillis=200", "-version"}); + } } # HG changeset patch # User jmasa # Date 1473703616 25200 # Mon Sep 12 11:06:56 2016 -0700 # Node ID 3fe095fd9f35242dcb9da0a4fd8cbc957fd58067 # Parent 7ffb3b9c2a1a8ff882d64a1ff2b0de7111e6a70d [mq]: PrintWarnings