1 /* |
1 /* |
2 * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
25 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
26 #include "jvm.h" |
26 #include "jvm.h" |
27 #include "jvmci/jvmci_globals.hpp" |
27 #include "jvmci/jvmci_globals.hpp" |
28 #include "gc/shared/gcConfig.hpp" |
28 #include "gc/shared/gcConfig.hpp" |
29 #include "utilities/defaultStream.hpp" |
29 #include "utilities/defaultStream.hpp" |
|
30 #include "utilities/ostream.hpp" |
30 #include "runtime/globals_extension.hpp" |
31 #include "runtime/globals_extension.hpp" |
|
32 |
|
33 fileStream* JVMCIGlobals::_jni_config_file = NULL; |
31 |
34 |
32 JVMCI_FLAGS(MATERIALIZE_DEVELOPER_FLAG, \ |
35 JVMCI_FLAGS(MATERIALIZE_DEVELOPER_FLAG, \ |
33 MATERIALIZE_PD_DEVELOPER_FLAG, \ |
36 MATERIALIZE_PD_DEVELOPER_FLAG, \ |
34 MATERIALIZE_PRODUCT_FLAG, \ |
37 MATERIALIZE_PRODUCT_FLAG, \ |
35 MATERIALIZE_PD_PRODUCT_FLAG, \ |
38 MATERIALIZE_PD_PRODUCT_FLAG, \ |
77 jio_fprintf(defaultStream::error_stream(), |
80 jio_fprintf(defaultStream::error_stream(), |
78 "Improperly specified VM option UseJVMCICompiler: EnableJVMCI cannot be disabled\n"); |
81 "Improperly specified VM option UseJVMCICompiler: EnableJVMCI cannot be disabled\n"); |
79 return false; |
82 return false; |
80 } |
83 } |
81 FLAG_SET_DEFAULT(EnableJVMCI, true); |
84 FLAG_SET_DEFAULT(EnableJVMCI, true); |
|
85 if (BootstrapJVMCI && UseJVMCINativeLibrary) { |
|
86 jio_fprintf(defaultStream::error_stream(), "-XX:+BootstrapJVMCI is not compatible with -XX:+UseJVMCINativeLibrary"); |
|
87 return false; |
|
88 } |
82 } |
89 } |
83 |
90 |
84 if (!EnableJVMCI) { |
91 if (!EnableJVMCI) { |
85 // Switch off eager JVMCI initialization if JVMCI is disabled. |
92 // Switch off eager JVMCI initialization if JVMCI is disabled. |
86 // Don't throw error if EagerJVMCI is set to allow testing. |
93 // Don't throw error if EagerJVMCI is set to allow testing. |
95 CHECK_NOT_SET(JVMCICountersExcludeCompiler, EnableJVMCI) |
102 CHECK_NOT_SET(JVMCICountersExcludeCompiler, EnableJVMCI) |
96 CHECK_NOT_SET(JVMCIUseFastLocking, EnableJVMCI) |
103 CHECK_NOT_SET(JVMCIUseFastLocking, EnableJVMCI) |
97 CHECK_NOT_SET(JVMCINMethodSizeLimit, EnableJVMCI) |
104 CHECK_NOT_SET(JVMCINMethodSizeLimit, EnableJVMCI) |
98 CHECK_NOT_SET(MethodProfileWidth, EnableJVMCI) |
105 CHECK_NOT_SET(MethodProfileWidth, EnableJVMCI) |
99 CHECK_NOT_SET(JVMCIPrintProperties, EnableJVMCI) |
106 CHECK_NOT_SET(JVMCIPrintProperties, EnableJVMCI) |
100 CHECK_NOT_SET(TraceUncollectedSpeculations, EnableJVMCI) |
107 CHECK_NOT_SET(UseJVMCINativeLibrary, EnableJVMCI) |
|
108 CHECK_NOT_SET(JVMCILibPath, EnableJVMCI) |
|
109 CHECK_NOT_SET(JVMCILibDumpJNIConfig, EnableJVMCI) |
101 |
110 |
102 #ifndef PRODUCT |
111 #ifndef PRODUCT |
103 #define JVMCI_CHECK4(type, name, value, doc) assert(name##checked, #name " flag not checked"); |
112 #define JVMCI_CHECK4(type, name, value, doc) assert(name##checked, #name " flag not checked"); |
104 #define JVMCI_CHECK3(type, name, doc) assert(name##checked, #name " flag not checked"); |
113 #define JVMCI_CHECK3(type, name, doc) assert(name##checked, #name " flag not checked"); |
105 // Ensures that all JVMCI flags are checked by this method. |
114 // Ensures that all JVMCI flags are checked by this method. |
108 #undef JVMCI_DECLARE_CHECK3 |
117 #undef JVMCI_DECLARE_CHECK3 |
109 #undef JVMCI_DECLARE_CHECK4 |
118 #undef JVMCI_DECLARE_CHECK4 |
110 #undef JVMCI_CHECK3 |
119 #undef JVMCI_CHECK3 |
111 #undef JVMCI_CHECK4 |
120 #undef JVMCI_CHECK4 |
112 #undef JVMCI_FLAG_CHECKED |
121 #undef JVMCI_FLAG_CHECKED |
113 #endif |
122 #endif // PRODUCT |
114 #undef CHECK_NOT_SET |
123 #undef CHECK_NOT_SET |
|
124 |
|
125 if (JVMCILibDumpJNIConfig != NULL) { |
|
126 _jni_config_file = new(ResourceObj::C_HEAP, mtJVMCI) fileStream(JVMCILibDumpJNIConfig); |
|
127 if (_jni_config_file == NULL || !_jni_config_file->is_open()) { |
|
128 jio_fprintf(defaultStream::error_stream(), |
|
129 "Could not open file for dumping JVMCI shared library JNI config: %s\n", JVMCILibDumpJNIConfig); |
|
130 return false; |
|
131 } |
|
132 } |
|
133 |
115 return true; |
134 return true; |
116 } |
135 } |
|
136 |
117 void JVMCIGlobals::check_jvmci_supported_gc() { |
137 void JVMCIGlobals::check_jvmci_supported_gc() { |
118 if (EnableJVMCI) { |
138 if (EnableJVMCI) { |
119 // Check if selected GC is supported by JVMCI and Java compiler |
139 // Check if selected GC is supported by JVMCI and Java compiler |
120 if (!(UseSerialGC || UseParallelGC || UseParallelOldGC || UseG1GC)) { |
140 if (!(UseSerialGC || UseParallelGC || UseParallelOldGC || UseG1GC)) { |
121 vm_exit_during_initialization("JVMCI Compiler does not support selected GC", GCConfig::hs_err_name()); |
141 vm_exit_during_initialization("JVMCI Compiler does not support selected GC", GCConfig::hs_err_name()); |