author | redestad |
Sun, 11 Dec 2016 12:20:45 +0100 | |
changeset 42469 | d1c0a9123f87 |
parent 41687 | 6b97c4598667 |
child 46560 | 388aa8d67c80 |
permissions | -rw-r--r-- |
33160 | 1 |
/* |
38273
2634194d7555
8073500: Prevent certain commercial flags from being changed at runtime
gziemski
parents:
36313
diff
changeset
|
2 |
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. |
33160 | 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" |
|
36313
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
27 |
#include "utilities/defaultStream.hpp" |
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
28 |
#include "runtime/globals_extension.hpp" |
33160 | 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, \ |
|
39117 | 35 |
MATERIALIZE_PD_DIAGNOSTIC_FLAG, \ |
33160 | 36 |
MATERIALIZE_EXPERIMENTAL_FLAG, \ |
37 |
MATERIALIZE_NOTPRODUCT_FLAG, |
|
38 |
IGNORE_RANGE, \ |
|
38273
2634194d7555
8073500: Prevent certain commercial flags from being changed at runtime
gziemski
parents:
36313
diff
changeset
|
39 |
IGNORE_CONSTRAINT, \ |
2634194d7555
8073500: Prevent certain commercial flags from being changed at runtime
gziemski
parents:
36313
diff
changeset
|
40 |
IGNORE_WRITEABLE) |
36313
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
41 |
|
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
42 |
// Return true if jvmci flags are consistent. |
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
43 |
bool JVMCIGlobals::check_jvmci_flags_are_consistent() { |
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
44 |
|
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
45 |
#ifndef PRODUCT |
40081
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
46 |
#define APPLY_JVMCI_FLAGS(params3, params4) \ |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
47 |
JVMCI_FLAGS(params4, params3, params4, params3, params4, params3, params4, params4, IGNORE_RANGE, IGNORE_CONSTRAINT, IGNORE_WRITEABLE) |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
48 |
#define JVMCI_DECLARE_CHECK4(type, name, value, doc) bool name##checked = false; |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
49 |
#define JVMCI_DECLARE_CHECK3(type, name, doc) bool name##checked = false; |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
50 |
#define JVMCI_FLAG_CHECKED(name) name##checked = true; |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
51 |
APPLY_JVMCI_FLAGS(JVMCI_DECLARE_CHECK3, JVMCI_DECLARE_CHECK4) |
36313
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
52 |
#else |
40081
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
53 |
#define JVMCI_FLAG_CHECKED(name) |
36313
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
54 |
#endif |
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
55 |
|
40081
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
56 |
// Checks that a given flag is not set if a given guard flag is false. |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
57 |
#define CHECK_NOT_SET(FLAG, GUARD) \ |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
58 |
JVMCI_FLAG_CHECKED(FLAG) \ |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
59 |
if (!GUARD && !FLAG_IS_DEFAULT(FLAG)) { \ |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
60 |
jio_fprintf(defaultStream::error_stream(), \ |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
61 |
"Improperly specified VM option '%s': '%s' must be enabled\n", #FLAG, #GUARD); \ |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
62 |
return false; \ |
36313
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
63 |
} |
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
64 |
|
40081
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
65 |
JVMCI_FLAG_CHECKED(UseJVMCICompiler) |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
66 |
JVMCI_FLAG_CHECKED(EnableJVMCI) |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
67 |
|
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
68 |
CHECK_NOT_SET(BootstrapJVMCI, UseJVMCICompiler) |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
69 |
CHECK_NOT_SET(PrintBootstrap, UseJVMCICompiler) |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
70 |
CHECK_NOT_SET(JVMCIThreads, UseJVMCICompiler) |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
71 |
CHECK_NOT_SET(JVMCIHostThreads, UseJVMCICompiler) |
36313
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
72 |
|
40081
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
73 |
if (UseJVMCICompiler) { |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
74 |
if (!FLAG_IS_DEFAULT(EnableJVMCI) && !EnableJVMCI) { |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
75 |
jio_fprintf(defaultStream::error_stream(), |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
76 |
"Improperly specified VM option UseJVMCICompiler: EnableJVMCI cannot be disabled\n"); |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
77 |
return false; |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
78 |
} |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
79 |
FLAG_SET_DEFAULT(EnableJVMCI, true); |
36313
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
80 |
} |
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
81 |
|
40081
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
82 |
CHECK_NOT_SET(JVMCITraceLevel, EnableJVMCI) |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
83 |
CHECK_NOT_SET(JVMCICounterSize, EnableJVMCI) |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
84 |
CHECK_NOT_SET(JVMCICountersExcludeCompiler, EnableJVMCI) |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
85 |
CHECK_NOT_SET(JVMCIUseFastLocking, EnableJVMCI) |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
86 |
CHECK_NOT_SET(JVMCINMethodSizeLimit, EnableJVMCI) |
40869
2f53be0a45ee
8163864: [JVMCI] move MethodProfileWidth to jvmci_globals.hpp
dnsimon
parents:
40081
diff
changeset
|
87 |
CHECK_NOT_SET(MethodProfileWidth, EnableJVMCI) |
41687
6b97c4598667
8167194: [JVMCI] no reliable mechanism for querying JVMCI system properties
dnsimon
parents:
40869
diff
changeset
|
88 |
CHECK_NOT_SET(JVMCIPrintProperties, EnableJVMCI) |
40081
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
89 |
CHECK_NOT_SET(TraceUncollectedSpeculations, EnableJVMCI) |
36313
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
90 |
|
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
91 |
#ifndef PRODUCT |
40081
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
92 |
#define JVMCI_CHECK4(type, name, value, doc) assert(name##checked, #name " flag not checked"); |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
93 |
#define JVMCI_CHECK3(type, name, doc) assert(name##checked, #name " flag not checked"); |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
94 |
// Ensures that all JVMCI flags are checked by this method. |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
95 |
APPLY_JVMCI_FLAGS(JVMCI_CHECK3, JVMCI_CHECK4) |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
96 |
#undef APPLY_JVMCI_FLAGS |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
97 |
#undef JVMCI_DECLARE_CHECK3 |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
98 |
#undef JVMCI_DECLARE_CHECK4 |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
99 |
#undef JVMCI_CHECK3 |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
100 |
#undef JVMCI_CHECK4 |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
101 |
#undef JVMCI_FLAG_CHECKED |
36313
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
102 |
#endif |
40081
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
103 |
#undef CHECK_NOT_SET |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
104 |
return true; |
36313
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
105 |
} |