author | herrick |
Wed, 27 Mar 2019 08:27:58 -0400 | |
branch | JDK-8200758-branch |
changeset 57288 | 0be43184f52a |
parent 50589 | e5d741569070 |
child 54669 | ad45b3802d4e |
permissions | -rw-r--r-- |
33160 | 1 |
/* |
49191
13378aa8527e
8195632: [Graal] Introduce EagerJVMCI flag to force eager JVMCI initialization
kvn
parents:
47765
diff
changeset
|
2 |
* Copyright (c) 2000, 2018, 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" |
|
47765
b7c7428eaab9
8189610: Reconcile jvm.h and all jvm_md.h between java.base and hotspot
coleenp
parents:
47216
diff
changeset
|
26 |
#include "jvm.h" |
33160 | 27 |
#include "jvmci/jvmci_globals.hpp" |
50589
e5d741569070
8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents:
49191
diff
changeset
|
28 |
#include "gc/shared/gcConfig.hpp" |
36313
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
29 |
#include "utilities/defaultStream.hpp" |
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
30 |
#include "runtime/globals_extension.hpp" |
33160 | 31 |
|
32 |
JVMCI_FLAGS(MATERIALIZE_DEVELOPER_FLAG, \ |
|
33 |
MATERIALIZE_PD_DEVELOPER_FLAG, \ |
|
34 |
MATERIALIZE_PRODUCT_FLAG, \ |
|
35 |
MATERIALIZE_PD_PRODUCT_FLAG, \ |
|
36 |
MATERIALIZE_DIAGNOSTIC_FLAG, \ |
|
39117 | 37 |
MATERIALIZE_PD_DIAGNOSTIC_FLAG, \ |
33160 | 38 |
MATERIALIZE_EXPERIMENTAL_FLAG, \ |
39 |
MATERIALIZE_NOTPRODUCT_FLAG, |
|
40 |
IGNORE_RANGE, \ |
|
38273
2634194d7555
8073500: Prevent certain commercial flags from being changed at runtime
gziemski
parents:
36313
diff
changeset
|
41 |
IGNORE_CONSTRAINT, \ |
2634194d7555
8073500: Prevent certain commercial flags from being changed at runtime
gziemski
parents:
36313
diff
changeset
|
42 |
IGNORE_WRITEABLE) |
36313
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
43 |
|
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
44 |
// Return true if jvmci flags are consistent. |
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
45 |
bool JVMCIGlobals::check_jvmci_flags_are_consistent() { |
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
46 |
|
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
47 |
#ifndef PRODUCT |
40081
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
48 |
#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
|
49 |
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
|
50 |
#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
|
51 |
#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
|
52 |
#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
|
53 |
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
|
54 |
#else |
40081
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
55 |
#define JVMCI_FLAG_CHECKED(name) |
36313
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
56 |
#endif |
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
57 |
|
40081
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
58 |
// 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
|
59 |
#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
|
60 |
JVMCI_FLAG_CHECKED(FLAG) \ |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
61 |
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
|
62 |
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
|
63 |
"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
|
64 |
return false; \ |
36313
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
65 |
} |
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
66 |
|
40081
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
67 |
JVMCI_FLAG_CHECKED(UseJVMCICompiler) |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
68 |
JVMCI_FLAG_CHECKED(EnableJVMCI) |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
69 |
|
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
70 |
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
|
71 |
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
|
72 |
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
|
73 |
CHECK_NOT_SET(JVMCIHostThreads, UseJVMCICompiler) |
36313
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
74 |
|
40081
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
75 |
if (UseJVMCICompiler) { |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
76 |
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
|
77 |
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
|
78 |
"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
|
79 |
return false; |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
80 |
} |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
81 |
FLAG_SET_DEFAULT(EnableJVMCI, true); |
36313
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
82 |
} |
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
83 |
|
49191
13378aa8527e
8195632: [Graal] Introduce EagerJVMCI flag to force eager JVMCI initialization
kvn
parents:
47765
diff
changeset
|
84 |
if (!EnableJVMCI) { |
13378aa8527e
8195632: [Graal] Introduce EagerJVMCI flag to force eager JVMCI initialization
kvn
parents:
47765
diff
changeset
|
85 |
// Switch off eager JVMCI initialization if JVMCI is disabled. |
13378aa8527e
8195632: [Graal] Introduce EagerJVMCI flag to force eager JVMCI initialization
kvn
parents:
47765
diff
changeset
|
86 |
// Don't throw error if EagerJVMCI is set to allow testing. |
13378aa8527e
8195632: [Graal] Introduce EagerJVMCI flag to force eager JVMCI initialization
kvn
parents:
47765
diff
changeset
|
87 |
if (EagerJVMCI) { |
13378aa8527e
8195632: [Graal] Introduce EagerJVMCI flag to force eager JVMCI initialization
kvn
parents:
47765
diff
changeset
|
88 |
FLAG_SET_DEFAULT(EagerJVMCI, false); |
13378aa8527e
8195632: [Graal] Introduce EagerJVMCI flag to force eager JVMCI initialization
kvn
parents:
47765
diff
changeset
|
89 |
} |
13378aa8527e
8195632: [Graal] Introduce EagerJVMCI flag to force eager JVMCI initialization
kvn
parents:
47765
diff
changeset
|
90 |
} |
13378aa8527e
8195632: [Graal] Introduce EagerJVMCI flag to force eager JVMCI initialization
kvn
parents:
47765
diff
changeset
|
91 |
JVMCI_FLAG_CHECKED(EagerJVMCI) |
13378aa8527e
8195632: [Graal] Introduce EagerJVMCI flag to force eager JVMCI initialization
kvn
parents:
47765
diff
changeset
|
92 |
|
40081
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
93 |
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
|
94 |
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
|
95 |
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
|
96 |
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
|
97 |
CHECK_NOT_SET(JVMCINMethodSizeLimit, EnableJVMCI) |
40869
2f53be0a45ee
8163864: [JVMCI] move MethodProfileWidth to jvmci_globals.hpp
dnsimon
parents:
40081
diff
changeset
|
98 |
CHECK_NOT_SET(MethodProfileWidth, EnableJVMCI) |
41687
6b97c4598667
8167194: [JVMCI] no reliable mechanism for querying JVMCI system properties
dnsimon
parents:
40869
diff
changeset
|
99 |
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
|
100 |
CHECK_NOT_SET(TraceUncollectedSpeculations, EnableJVMCI) |
36313
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
101 |
|
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
102 |
#ifndef PRODUCT |
40081
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
103 |
#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
|
104 |
#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
|
105 |
// 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
|
106 |
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
|
107 |
#undef APPLY_JVMCI_FLAGS |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
108 |
#undef JVMCI_DECLARE_CHECK3 |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
109 |
#undef JVMCI_DECLARE_CHECK4 |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
110 |
#undef JVMCI_CHECK3 |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
111 |
#undef JVMCI_CHECK4 |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
112 |
#undef JVMCI_FLAG_CHECKED |
36313
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
113 |
#endif |
40081
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
114 |
#undef CHECK_NOT_SET |
50be9fe0e9c2
8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents:
40046
diff
changeset
|
115 |
return true; |
36313
e7eff81d7f1d
8145333: -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-EnableJVMCI makes JVM crash
jcm
parents:
33160
diff
changeset
|
116 |
} |
50589
e5d741569070
8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents:
49191
diff
changeset
|
117 |
void JVMCIGlobals::check_jvmci_supported_gc() { |
e5d741569070
8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents:
49191
diff
changeset
|
118 |
if (EnableJVMCI) { |
e5d741569070
8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents:
49191
diff
changeset
|
119 |
// Check if selected GC is supported by JVMCI and Java compiler |
e5d741569070
8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents:
49191
diff
changeset
|
120 |
if (!(UseSerialGC || UseParallelGC || UseParallelOldGC || UseG1GC)) { |
e5d741569070
8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents:
49191
diff
changeset
|
121 |
vm_exit_during_initialization("JVMCI Compiler does not support selected GC", GCConfig::hs_err_name()); |
e5d741569070
8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents:
49191
diff
changeset
|
122 |
FLAG_SET_DEFAULT(EnableJVMCI, false); |
e5d741569070
8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents:
49191
diff
changeset
|
123 |
FLAG_SET_DEFAULT(UseJVMCICompiler, false); |
e5d741569070
8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents:
49191
diff
changeset
|
124 |
} |
e5d741569070
8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents:
49191
diff
changeset
|
125 |
} |
e5d741569070
8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents:
49191
diff
changeset
|
126 |
} |