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 "jvm.h"
27 #include "classfile/classLoader.hpp"
28 #include "classfile/javaAssertions.hpp"
29 #include "classfile/moduleEntry.hpp"
30 #include "classfile/stringTable.hpp"
31 #include "classfile/symbolTable.hpp"
32 #include "gc/shared/collectorPolicy.hpp"
33 #include "gc/shared/gcArguments.hpp"
34 #include "gc/shared/gcConfig.hpp"
35 #include "logging/log.hpp"
36 #include "logging/logConfiguration.hpp"
37 #include "logging/logStream.hpp"
38 #include "logging/logTag.hpp"
39 #include "memory/allocation.inline.hpp"
40 #include "memory/universe.hpp"
41 #include "oops/oop.inline.hpp"
42 #include "prims/jvmtiExport.hpp"
43 #include "runtime/arguments.hpp"
44 #include "runtime/arguments_ext.hpp"
45 #include "runtime/commandLineFlagConstraintList.hpp"
46 #include "runtime/commandLineFlagWriteableList.hpp"
47 #include "runtime/commandLineFlagRangeList.hpp"
48 #include "runtime/globals.hpp"
49 #include "runtime/globals_extension.hpp"
50 #include "runtime/java.hpp"
51 #include "runtime/os.inline.hpp"
52 #include "runtime/safepoint.hpp"
53 #include "runtime/safepointMechanism.hpp"
54 #include "runtime/vm_version.hpp"
55 #include "services/management.hpp"
56 #include "services/memTracker.hpp"
57 #include "utilities/align.hpp"
58 #include "utilities/defaultStream.hpp"
245 } else {
246 return false;
247 }
248 }
249
250 // Return true if any of the strings in null-terminated array 'names' matches.
251 // If tail_allowed is true, then the tail must begin with a colon; otherwise,
252 // the option must match exactly.
253 static bool match_option(const JavaVMOption* option, const char** names, const char** tail,
254 bool tail_allowed) {
255 for (/* empty */; *names != NULL; ++names) {
256 if (match_option(option, *names, tail)) {
257 if (**tail == '\0' || (tail_allowed && **tail == ':')) {
258 return true;
259 }
260 }
261 }
262 return false;
263 }
264
265 static void logOption(const char* opt) {
266 if (PrintVMOptions) {
267 jio_fprintf(defaultStream::output_stream(), "VM option '%s'\n", opt);
268 }
269 }
270
271 bool needs_module_property_warning = false;
272
273 #define MODULE_PROPERTY_PREFIX "jdk.module."
274 #define MODULE_PROPERTY_PREFIX_LEN 11
275 #define ADDEXPORTS "addexports"
276 #define ADDEXPORTS_LEN 10
277 #define ADDREADS "addreads"
278 #define ADDREADS_LEN 8
279 #define ADDOPENS "addopens"
280 #define ADDOPENS_LEN 8
281 #define PATCH "patch"
282 #define PATCH_LEN 5
283 #define ADDMODS "addmods"
284 #define ADDMODS_LEN 7
3147 jio_fprintf(defaultStream::error_stream(),
3148 "ExtendedDTraceProbes flag is not applicable for this configuration\n");
3149 return JNI_EINVAL;
3150 #endif // defined(DTRACE_ENABLED)
3151 #ifdef ASSERT
3152 } else if (match_option(option, "-XX:+FullGCALot")) {
3153 if (FLAG_SET_CMDLINE(bool, FullGCALot, true) != Flag::SUCCESS) {
3154 return JNI_EINVAL;
3155 }
3156 // disable scavenge before parallel mark-compact
3157 if (FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false) != Flag::SUCCESS) {
3158 return JNI_EINVAL;
3159 }
3160 #endif
3161 #if !INCLUDE_MANAGEMENT
3162 } else if (match_option(option, "-XX:+ManagementServer")) {
3163 jio_fprintf(defaultStream::error_stream(),
3164 "ManagementServer is not supported in this VM.\n");
3165 return JNI_ERR;
3166 #endif // INCLUDE_MANAGEMENT
3167 } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx
3168 // Skip -XX:Flags= and -XX:VMOptionsFile= since those cases have
3169 // already been handled
3170 if ((strncmp(tail, "Flags=", strlen("Flags=")) != 0) &&
3171 (strncmp(tail, "VMOptionsFile=", strlen("VMOptionsFile=")) != 0)) {
3172 if (!process_argument(tail, args->ignoreUnrecognized, origin)) {
3173 return JNI_EINVAL;
3174 }
3175 }
3176 // Unknown option
3177 } else if (is_bad_option(option, args->ignoreUnrecognized)) {
3178 return JNI_ERR;
3179 }
3180 }
3181
3182 // PrintSharedArchiveAndExit will turn on
3183 // -Xshare:on
3184 // -Xlog:class+path=info
3185 if (PrintSharedArchiveAndExit) {
3186 if (FLAG_SET_CMDLINE(bool, UseSharedSpaces, true) != Flag::SUCCESS) {
|
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 "jvm.h"
27 #include "classfile/classLoader.hpp"
28 #include "classfile/javaAssertions.hpp"
29 #include "classfile/moduleEntry.hpp"
30 #include "classfile/stringTable.hpp"
31 #include "classfile/symbolTable.hpp"
32 #include "gc/shared/collectorPolicy.hpp"
33 #include "gc/shared/gcArguments.hpp"
34 #include "gc/shared/gcConfig.hpp"
35 #include "logging/log.hpp"
36 #include "logging/logConfiguration.hpp"
37 #include "logging/logStream.hpp"
38 #include "logging/logTag.hpp"
39 #include "jfr/recorder/access/jfrOptionSet.hpp"
40 #include "memory/allocation.inline.hpp"
41 #include "memory/universe.hpp"
42 #include "oops/oop.inline.hpp"
43 #include "prims/jvmtiExport.hpp"
44 #include "runtime/arguments.hpp"
45 #include "runtime/arguments_ext.hpp"
46 #include "runtime/commandLineFlagConstraintList.hpp"
47 #include "runtime/commandLineFlagWriteableList.hpp"
48 #include "runtime/commandLineFlagRangeList.hpp"
49 #include "runtime/globals.hpp"
50 #include "runtime/globals_extension.hpp"
51 #include "runtime/java.hpp"
52 #include "runtime/os.inline.hpp"
53 #include "runtime/safepoint.hpp"
54 #include "runtime/safepointMechanism.hpp"
55 #include "runtime/vm_version.hpp"
56 #include "services/management.hpp"
57 #include "services/memTracker.hpp"
58 #include "utilities/align.hpp"
59 #include "utilities/defaultStream.hpp"
246 } else {
247 return false;
248 }
249 }
250
251 // Return true if any of the strings in null-terminated array 'names' matches.
252 // If tail_allowed is true, then the tail must begin with a colon; otherwise,
253 // the option must match exactly.
254 static bool match_option(const JavaVMOption* option, const char** names, const char** tail,
255 bool tail_allowed) {
256 for (/* empty */; *names != NULL; ++names) {
257 if (match_option(option, *names, tail)) {
258 if (**tail == '\0' || (tail_allowed && **tail == ':')) {
259 return true;
260 }
261 }
262 }
263 return false;
264 }
265
266 // return true on failure
267 static bool match_jfr_option(const JavaVMOption** option) {
268 assert((*option)->optionString != NULL, "invariant");
269 char* tail = NULL;
270 if (match_option(*option, "-XX:StartFlightRecording", (const char**)&tail)) {
271 return JfrOptionSet::parse_start_flight_recording(option, tail);
272 } else if (match_option(*option, "-XX:FlightRecorderOptions", (const char**)&tail)) {
273 return JfrOptionSet::parse_flight_recorder_options(option, tail);
274 }
275 return false;
276 }
277
278 static void logOption(const char* opt) {
279 if (PrintVMOptions) {
280 jio_fprintf(defaultStream::output_stream(), "VM option '%s'\n", opt);
281 }
282 }
283
284 bool needs_module_property_warning = false;
285
286 #define MODULE_PROPERTY_PREFIX "jdk.module."
287 #define MODULE_PROPERTY_PREFIX_LEN 11
288 #define ADDEXPORTS "addexports"
289 #define ADDEXPORTS_LEN 10
290 #define ADDREADS "addreads"
291 #define ADDREADS_LEN 8
292 #define ADDOPENS "addopens"
293 #define ADDOPENS_LEN 8
294 #define PATCH "patch"
295 #define PATCH_LEN 5
296 #define ADDMODS "addmods"
297 #define ADDMODS_LEN 7
3160 jio_fprintf(defaultStream::error_stream(),
3161 "ExtendedDTraceProbes flag is not applicable for this configuration\n");
3162 return JNI_EINVAL;
3163 #endif // defined(DTRACE_ENABLED)
3164 #ifdef ASSERT
3165 } else if (match_option(option, "-XX:+FullGCALot")) {
3166 if (FLAG_SET_CMDLINE(bool, FullGCALot, true) != Flag::SUCCESS) {
3167 return JNI_EINVAL;
3168 }
3169 // disable scavenge before parallel mark-compact
3170 if (FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false) != Flag::SUCCESS) {
3171 return JNI_EINVAL;
3172 }
3173 #endif
3174 #if !INCLUDE_MANAGEMENT
3175 } else if (match_option(option, "-XX:+ManagementServer")) {
3176 jio_fprintf(defaultStream::error_stream(),
3177 "ManagementServer is not supported in this VM.\n");
3178 return JNI_ERR;
3179 #endif // INCLUDE_MANAGEMENT
3180 } else if (match_jfr_option(&option)) {
3181 return JNI_EINVAL;
3182 } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx
3183 // Skip -XX:Flags= and -XX:VMOptionsFile= since those cases have
3184 // already been handled
3185 if ((strncmp(tail, "Flags=", strlen("Flags=")) != 0) &&
3186 (strncmp(tail, "VMOptionsFile=", strlen("VMOptionsFile=")) != 0)) {
3187 if (!process_argument(tail, args->ignoreUnrecognized, origin)) {
3188 return JNI_EINVAL;
3189 }
3190 }
3191 // Unknown option
3192 } else if (is_bad_option(option, args->ignoreUnrecognized)) {
3193 return JNI_ERR;
3194 }
3195 }
3196
3197 // PrintSharedArchiveAndExit will turn on
3198 // -Xshare:on
3199 // -Xlog:class+path=info
3200 if (PrintSharedArchiveAndExit) {
3201 if (FLAG_SET_CMDLINE(bool, UseSharedSpaces, true) != Flag::SUCCESS) {
|