--- old/src/share/vm/jvmci/jvmci_globals.cpp 2016-02-16 03:54:14.500213515 -0800 +++ new/src/share/vm/jvmci/jvmci_globals.cpp 2016-02-16 03:54:14.377202216 -0800 @@ -24,6 +24,8 @@ #include "precompiled.hpp" #include "jvmci/jvmci_globals.hpp" +#include "utilities/defaultStream.hpp" +#include "runtime/globals_extension.hpp" JVMCI_FLAGS(MATERIALIZE_DEVELOPER_FLAG, \ MATERIALIZE_PD_DEVELOPER_FLAG, \ @@ -34,3 +36,101 @@ MATERIALIZE_NOTPRODUCT_FLAG, IGNORE_RANGE, \ IGNORE_CONSTRAINT) + + + +// Check if any jvmci global defaults changed. +bool is_any_jvmci_arg_values_changed() { + +int check_count = 0, fail_count = 0; + + if (!FLAG_IS_DEFAULT(EnableJVMCI)) { + check_count++; + } + +#define EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(FLAG) \ + if (!FLAG_IS_DEFAULT(FLAG)) { \ + fail_count++; \ + if (fail_count > check_count) \ + return true; \ + } + +#ifndef PRODUCT +#define JVMCI_DEVELOP_FLAG_VALUE_CHANGED_CHECKCODE(type, name, value, doc) EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name) +#define JVMCI_PD_DEVELOP_FLAG_VALUE_CHANGED_CHECKCODE(type, name, doc) EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name) +#define JVMCI_NOTPRODUCT_FLAG_VALUE_CHANGED_CHECKCODE(type, name, value, doc) EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name) +#else +#define JVMCI_DEVELOP_FLAG_VALUE_CHANGED_CHECKCODE(type, name, value, doc) +#define JVMCI_PD_DEVELOP_FLAG_VALUE_CHANGED_CHECKCODE(type, name, doc) +#define JVMCI_NOTPRODUCT_FLAG_VALUE_CHANGED_CHECKCODE(type, name, value, doc) +#endif +#define JVMCI_DIAGNOSTIC_FLAG_VALUE_CHANGED_CHECKCODE(type, name, value, doc) EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name) +#define JVMCI_PD_PRODUCT_FLAG_VALUE_CHANGED_CHECKCODE(type, name, doc) EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name) +#define JVMCI_PRODUCT_FLAG_VALUE_CHANGED_CHECKCODE(type, name, value, doc) EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name) +#define JVMCI_EXPERIMENTAL_FLAG_VALUE_CHANGED_CHECKCODE(type, name, value, doc) EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name) + JVMCI_FLAGS(JVMCI_DEVELOP_FLAG_VALUE_CHANGED_CHECKCODE, \ + JVMCI_PD_DEVELOP_FLAG_VALUE_CHANGED_CHECKCODE, \ + JVMCI_PRODUCT_FLAG_VALUE_CHANGED_CHECKCODE, \ + JVMCI_PD_PRODUCT_FLAG_VALUE_CHANGED_CHECKCODE, \ + JVMCI_DIAGNOSTIC_FLAG_VALUE_CHANGED_CHECKCODE, \ + JVMCI_EXPERIMENTAL_FLAG_VALUE_CHANGED_CHECKCODE, \ + JVMCI_NOTPRODUCT_FLAG_VALUE_CHANGED_CHECKCODE, \ + IGNORE_RANGE, \ + IGNORE_CONSTRAINT) +#undef EMIT_FLAG_VALUE_CHANGED_CHECK_CODE +#undef JVMCI_DEVELOP_FLAG_VALUE_CHANGED_CHECKCODE +#undef JVMCI_PD_DEVELOP_FLAG_VALUE_CHANGED_CHECKCODE +#undef JVMCI_NOTPRODUCT_FLAG_VALUE_CHANGED_CHECKCODE +#undef JVMCI_DIAGNOSTIC_FLAG_VALUE_CHANGED_CHECKCODE +#undef JVMCI_PD_PRODUCT_FLAG_VALUE_CHANGED_CHECKCODE +#undef JVMCI_PRODUCT_FLAG_VALUE_CHANGED_CHECKCODE +#undef JVMCI_EXPERIMENTAL_FLAG_VALUE_CHANGED_CHECKCODE + +return false; +} + +// Print jvmci args inconsistency error message. +void print_jvmci_arg_inconsistency_error_message() { + const char* error_msg = "Improperly specified VM option '%s'\n"; + + jio_fprintf(defaultStream::error_stream(), "EnableJVMCI must be enabled\n"); + +#define EMIT_CHECK_PRINT_ERROR_MSG(FLAG) \ + if (!FLAG_IS_DEFAULT(FLAG)) { \ + if (strcmp(#FLAG, "EnableJVMCI")) \ + jio_fprintf(defaultStream::error_stream(), error_msg, #FLAG); \ + } +#ifndef PRODUCT +#define JVMCI_DEVELOP_FLAG_CHECK_PRINT_ERROR_MSG(type, name, value, doc) EMIT_CHECK_PRINT_ERROR_MSG(name) +#define JVMCI_PD_DEVELOP_FLAG_CHECK_PRINT_ERROR_MSG(type, name, doc) EMIT_CHECK_PRINT_ERROR_MSG(name) +#define JVMCI_NOTPRODUCT_FLAG_CHECK_PRINT_ERROR_MSG(type, name, value, doc) EMIT_CHECK_PRINT_ERROR_MSG(name) +#else +#define JVMCI_DEVELOP_FLAG_CHECK_PRINT_ERROR_MSG(type, name, value, doc) +#define JVMCI_PD_DEVELOP_FLAG_CHECK_PRINT_ERROR_MSG(type, name, doc) +#define JVMCI_NOTPRODUCT_FLAG_CHECK_PRINT_ERROR_MSG(type, name, value, doc) +#endif + +#define JVMCI_PD_PRODUCT_FLAG_CHECK_PRINT_ERROR_MSG(type, name, doc) EMIT_CHECK_PRINT_ERROR_MSG(name) +#define JVMCI_PRODUCT_FLAG_CHECK_PRINT_ERROR_MSG(type, name, value, doc) EMIT_CHECK_PRINT_ERROR_MSG(name) +#define JVMCI_DIAGNOSTIC_FLAG_CHECK_PRINT_ERROR_MSG(type, name, value, doc) EMIT_CHECK_PRINT_ERROR_MSG(name) +#define JVMCI_EXPERIMENTAL_FLAG_CHECK_PRINT_ERROR_MSG(type, name, value, doc) EMIT_CHECK_PRINT_ERROR_MSG(name) + JVMCI_FLAGS(JVMCI_DEVELOP_FLAG_CHECK_PRINT_ERROR_MSG, \ + JVMCI_PD_DEVELOP_FLAG_CHECK_PRINT_ERROR_MSG, \ + JVMCI_PRODUCT_FLAG_CHECK_PRINT_ERROR_MSG, \ + JVMCI_PD_PRODUCT_FLAG_CHECK_PRINT_ERROR_MSG, \ + JVMCI_DIAGNOSTIC_FLAG_CHECK_PRINT_ERROR_MSG, \ + JVMCI_EXPERIMENTAL_FLAG_CHECK_PRINT_ERROR_MSG, \ + JVMCI_NOTPRODUCT_FLAG_CHECK_PRINT_ERROR_MSG, \ + IGNORE_RANGE, \ + IGNORE_CONSTRAINT) + +#undef EMIT_CHECK_PRINT_ERROR_MSG +#undef JVMCI_DEVELOP_FLAG_CHECK_PRINT_ERROR_MSG +#undef JVMCI_PD_DEVELOP_FLAG_CHECK_PRINT_ERROR_MSG +#undef JVMCI_NOTPRODUCT_FLAG_CHECK_PRINT_ERROR_MSG +#undef JVMCI_PD_PRODUCT_FLAG_CHECK_PRINT_ERROR_MSG +#undef JVMCI_PRODUCT_FLAG_CHECK_PRINT_ERROR_MSG +#undef JVMCI_DIAGNOSTIC_FLAG_CHECK_PRINT_ERROR_MSG +#undef JVMCI_EXPERIMENTAL_FLAG_CHECK_PRINT_ERROR_MSG + +} --- old/src/share/vm/jvmci/jvmci_globals.hpp 2016-02-16 03:54:15.143272580 -0800 +++ new/src/share/vm/jvmci/jvmci_globals.hpp 2016-02-16 03:54:14.991258618 -0800 @@ -39,29 +39,23 @@ \ experimental(bool, UseJVMCICompiler, false, \ "Use JVMCI as the default compiler") \ - constraint(EnableJVMCIMustBeEnabledConstraintFunc,AtParse) \ \ experimental(bool, BootstrapJVMCI, false, \ "Bootstrap JVMCI before running Java main method") \ - constraint(EnableJVMCIMustBeEnabledConstraintFunc,AtParse) \ \ experimental(bool, PrintBootstrap, true, \ "Print JVMCI bootstrap progress and summary") \ - constraint(EnableJVMCIMustBeEnabledConstraintFunc,AtParse) \ \ experimental(intx, JVMCIThreads, 1, \ "Force number of JVMCI compiler threads to use") \ range(1, max_jint) \ - constraint(EnableJVMCIMustBeEnabledConstraintFunc,AtParse) \ \ experimental(intx, JVMCIHostThreads, 1, \ "Force number of compiler threads for JVMCI host compiler") \ range(1, max_jint) \ - constraint(EnableJVMCIMustBeEnabledConstraintFunc,AtParse) \ \ experimental(bool, CodeInstallSafepointChecks, true, \ "Perform explicit safepoint checks while installing code") \ - constraint(EnableJVMCIMustBeEnabledConstraintFunc,AtParse) \ \ NOT_COMPILER2(product(intx, MaxVectorSize, 64, \ "Max vector size in bytes, " \ @@ -74,28 +68,22 @@ "Trace level for JVMCI: " \ "1 means emit a message for each CompilerToVM call," \ "levels greater than 1 provide progressively greater detail") \ - constraint(EnableJVMCIMustBeEnabledConstraintFunc,AtParse) \ \ experimental(intx, JVMCICounterSize, 0, \ "Reserved size for benchmark counters") \ range(0, max_jint) \ - constraint(EnableJVMCIMustBeEnabledConstraintFunc,AtParse) \ \ experimental(bool, JVMCICountersExcludeCompiler, true, \ "Exclude JVMCI compiler threads from benchmark counters") \ - constraint(EnableJVMCIMustBeEnabledConstraintFunc,AtParse) \ \ develop(bool, JVMCIUseFastLocking, true, \ "Use fast inlined locking code") \ - constraint(EnableJVMCIMustBeEnabledConstraintFunc,AtParse) \ \ experimental(intx, JVMCINMethodSizeLimit, (80*K)*wordSize, \ "Maximum size of a compiled method.") \ - constraint(EnableJVMCIMustBeEnabledConstraintFunc,AtParse) \ \ develop(bool, TraceUncollectedSpeculations, false, \ - "Print message when a failed speculation was not collected") \ - constraint(EnableJVMCIMustBeEnabledConstraintFunc,AtParse) \ + "Print message when a failed speculation was not collected") // Read default values for JVMCI globals @@ -109,5 +97,8 @@ DECLARE_NOTPRODUCT_FLAG, \ IGNORE_RANGE, \ IGNORE_CONSTRAINT) - +// Check if any jvmci global defaults changed. +bool is_any_jvmci_arg_values_changed(); +// Print jvmci args inconsistency error message. +void print_jvmci_arg_inconsistency_error_message(); #endif // SHARE_VM_JVMCI_JVMCIGLOBALS_HPP --- old/src/share/vm/runtime/arguments.cpp 2016-02-16 03:54:15.814334218 -0800 +++ new/src/share/vm/runtime/arguments.cpp 2016-02-16 03:54:15.679321817 -0800 @@ -2312,6 +2312,20 @@ //=========================================================================================================== // Parsing of main arguments +#if INCLUDE_JVMCI + +// Check consistency of jvmci vm argument settings. +bool Arguments::check_jvmci_args_consistency() { + + + if (!EnableJVMCI && is_any_jvmci_arg_values_changed()) { + print_jvmci_arg_inconsistency_error_message(); + return false; + } + return true; +} +#endif //INCLUDE_JVMCI + // Check consistency of GC selection bool Arguments::check_gc_consistency() { // Ensure that the user has not selected conflicting sets @@ -2408,6 +2422,9 @@ #endif } #if INCLUDE_JVMCI + + status = status && check_jvmci_args_consistency(); + if (EnableJVMCI) { if (!ScavengeRootsInCode) { warning("forcing ScavengeRootsInCode non-zero because JVMCI is enabled"); --- old/src/share/vm/runtime/arguments.hpp 2016-02-16 03:54:16.581404674 -0800 +++ new/src/share/vm/runtime/arguments.hpp 2016-02-16 03:54:16.450392640 -0800 @@ -506,6 +506,11 @@ static inline bool gc_selected(); // whether a gc has been selected static void select_gc_ergonomically(); +#if INCLUDE_JVMCI + // Check consistency of jvmci vm argument settings. + static bool check_jvmci_args_consistency(); +#endif + // Check for consistency in the selection of the garbage collector. static bool check_gc_consistency(); // Check user-selected gc // Check consistency or otherwise of VM argument settings --- old/src/share/vm/runtime/commandLineFlagConstraintList.cpp 2016-02-16 03:54:17.302470905 -0800 +++ new/src/share/vm/runtime/commandLineFlagConstraintList.cpp 2016-02-16 03:54:17.154457309 -0800 @@ -33,9 +33,6 @@ #include "runtime/commandLineFlagConstraintsRuntime.hpp" #include "runtime/os.hpp" #include "utilities/macros.hpp" -#if INCLUDE_JVMCI -#include "jvmci/commandLineFlagConstraintsJVMCI.hpp" -#endif class CommandLineFlagConstraint_bool : public CommandLineFlagConstraint { CommandLineFlagConstraintFunc_bool _constraint; @@ -254,17 +251,6 @@ IGNORE_RANGE, EMIT_CONSTRAINT_CHECK)); -#if INCLUDE_JVMCI - emit_constraint_no(NULL JVMCI_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG, - EMIT_CONSTRAINT_PD_DEVELOPER_FLAG, - EMIT_CONSTRAINT_PRODUCT_FLAG, - EMIT_CONSTRAINT_PD_PRODUCT_FLAG, - EMIT_CONSTRAINT_DIAGNOSTIC_FLAG, - EMIT_CONSTRAINT_EXPERIMENTAL_FLAG, - EMIT_CONSTRAINT_NOTPRODUCT_FLAG, - IGNORE_RANGE, - EMIT_CONSTRAINT_CHECK)); -#endif // INCLUDE_JVMCI #ifdef COMPILER1 emit_constraint_no(NULL C1_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG, --- old/src/share/vm/jvmci/commandLineFlagConstraintsJVMCI.cpp 2016-02-16 03:54:17.983533461 -0800 +++ /dev/null 2015-11-20 00:52:42.632000000 -0800 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2015, 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 "jvmci/commandLineFlagConstraintsJVMCI.hpp" -#include "runtime/arguments.hpp" -#include "runtime/globals.hpp" -#include "utilities/defaultStream.hpp" - -Flag::Error EnableJVMCIMustBeEnabledConstraintFunc(bool value, bool verbose) { - if (!EnableJVMCI) { - if (verbose == true) { - jio_fprintf(defaultStream::error_stream(), "EnableJVMCI must be enabled\n"); - } - return Flag::VIOLATES_CONSTRAINT; - } else { - return Flag::SUCCESS; - } -} - -Flag::Error EnableJVMCIMustBeEnabledConstraintFunc(intx value, bool verbose) { - if (!EnableJVMCI) { - if (verbose == true) { - jio_fprintf(defaultStream::error_stream(), "EnableJVMCI must be enabled\n"); - } - return Flag::VIOLATES_CONSTRAINT; - } else { - return Flag::SUCCESS; - } -} --- old/src/share/vm/jvmci/commandLineFlagConstraintsJVMCI.hpp 2016-02-16 03:54:18.376569561 -0800 +++ /dev/null 2015-11-20 00:52:42.632000000 -0800 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2015, 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. - * - */ - -#ifndef SHARE_VM_JVMCI_COMMANDLINEFLAGCONSTRAINTSJVMCI_HPP -#define SHARE_VM_JVMCI_COMMANDLINEFLAGCONSTRAINTSJVMCI_HPP - -#include "runtime/globals.hpp" -#include "utilities/globalDefinitions.hpp" - -/* - * Here we have JVMCI arguments constraints functions, which are called automatically - * whenever flag's value changes. If the constraint fails the function should return - * an appropriate error value. - */ - -Flag::Error EnableJVMCIMustBeEnabledConstraintFunc(bool value, bool verbose); -Flag::Error EnableJVMCIMustBeEnabledConstraintFunc(intx value, bool verbose); - -#endif /* SHARE_VM_JVMCI_COMMANDLINEFLAGCONSTRAINTSJVMCI_HPP */