1 /* 2 * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "jvmci/jvmci_globals.hpp" 27 #include "utilities/defaultStream.hpp" 28 #include "runtime/globals_extension.hpp" 29 30 JVMCI_FLAGS(MATERIALIZE_DEVELOPER_FLAG, \ 31 MATERIALIZE_PD_DEVELOPER_FLAG, \ 32 MATERIALIZE_PRODUCT_FLAG, \ 33 MATERIALIZE_PD_PRODUCT_FLAG, \ 34 MATERIALIZE_DIAGNOSTIC_FLAG, \ 35 MATERIALIZE_PD_DIAGNOSTIC_FLAG, \ 36 MATERIALIZE_EXPERIMENTAL_FLAG, \ 37 MATERIALIZE_NOTPRODUCT_FLAG, 38 IGNORE_RANGE, \ 39 IGNORE_CONSTRAINT, \ 40 IGNORE_WRITEABLE) 41 42 // Return true if jvmci flags are consistent. 43 bool JVMCIGlobals::check_jvmci_flags_are_consistent() { 44 45 #ifndef PRODUCT 46 #define APPLY_JVMCI_FLAGS(params3, params4) \ 47 JVMCI_FLAGS(params4, params3, params4, params3, params4, params3, params4, params4, IGNORE_RANGE, IGNORE_CONSTRAINT, IGNORE_WRITEABLE) 48 #define JVMCI_DECLARE_CHECK4(type, name, value, doc) bool name##checked = false; 49 #define JVMCI_DECLARE_CHECK3(type, name, doc) bool name##checked = false; 50 #define JVMCI_FLAG_CHECKED(name) name##checked = true; 51 APPLY_JVMCI_FLAGS(JVMCI_DECLARE_CHECK3, JVMCI_DECLARE_CHECK4) 52 #else 53 #define JVMCI_FLAG_CHECKED(name) 54 #endif 55 56 // Checks that a given flag is not set if a given guard flag is false. 57 #define CHECK_NOT_SET(FLAG, GUARD) \ 58 JVMCI_FLAG_CHECKED(FLAG) \ 59 if (!GUARD && !FLAG_IS_DEFAULT(FLAG)) { \ 60 jio_fprintf(defaultStream::error_stream(), \ 61 "Improperly specified VM option '%s': '%s' must be enabled\n", #FLAG, #GUARD); \ 62 return false; \ 63 } 64 65 JVMCI_FLAG_CHECKED(UseJVMCICompiler) 66 JVMCI_FLAG_CHECKED(EnableJVMCI) 67 68 CHECK_NOT_SET(BootstrapJVMCI, UseJVMCICompiler) 69 CHECK_NOT_SET(PrintBootstrap, UseJVMCICompiler) 70 CHECK_NOT_SET(JVMCIThreads, UseJVMCICompiler) 71 CHECK_NOT_SET(JVMCIHostThreads, UseJVMCICompiler) 72 73 if (UseJVMCICompiler) { 74 if (!FLAG_IS_DEFAULT(EnableJVMCI) && !EnableJVMCI) { 75 jio_fprintf(defaultStream::error_stream(), 76 "Improperly specified VM option UseJVMCICompiler: EnableJVMCI cannot be disabled\n"); 77 return false; 78 } 79 FLAG_SET_DEFAULT(EnableJVMCI, true); 80 } 81 82 CHECK_NOT_SET(JVMCITraceLevel, EnableJVMCI) 83 CHECK_NOT_SET(JVMCICounterSize, EnableJVMCI) 84 CHECK_NOT_SET(JVMCICountersExcludeCompiler, EnableJVMCI) 85 CHECK_NOT_SET(JVMCIUseFastLocking, EnableJVMCI) 86 CHECK_NOT_SET(JVMCINMethodSizeLimit, EnableJVMCI) 87 CHECK_NOT_SET(MethodProfileWidth, EnableJVMCI) 88 CHECK_NOT_SET(JVMCIPrintProperties, EnableJVMCI) 89 CHECK_NOT_SET(TraceUncollectedSpeculations, EnableJVMCI) 90 91 #ifndef PRODUCT 92 #define JVMCI_CHECK4(type, name, value, doc) assert(name##checked, #name " flag not checked"); 93 #define JVMCI_CHECK3(type, name, doc) assert(name##checked, #name " flag not checked"); 94 // Ensures that all JVMCI flags are checked by this method. 95 APPLY_JVMCI_FLAGS(JVMCI_CHECK3, JVMCI_CHECK4) 96 #undef APPLY_JVMCI_FLAGS 97 #undef JVMCI_DECLARE_CHECK3 98 #undef JVMCI_DECLARE_CHECK4 99 #undef JVMCI_CHECK3 100 #undef JVMCI_CHECK4 101 #undef JVMCI_FLAG_CHECKED 102 #endif 103 #undef CHECK_NOT_SET 104 return true; 105 }