388
389 // Flags that are aliases for other flags.
390 typedef struct {
391 const char* alias_name;
392 const char* real_name;
393 } AliasedFlag;
394
395 static AliasedFlag const aliased_jvm_flags[] = {
396 { "DefaultMaxRAMFraction", "MaxRAMFraction" },
397 { "CMSMarkStackSizeMax", "MarkStackSizeMax" },
398 { "CMSMarkStackSize", "MarkStackSize" },
399 { "G1MarkStackSize", "MarkStackSize" },
400 { "ParallelMarkingThreads", "ConcGCThreads" },
401 { "ParallelCMSThreads", "ConcGCThreads" },
402 { "CreateMinidumpOnCrash", "CreateCoredumpOnCrash" },
403 { NULL, NULL}
404 };
405
406 static AliasedLoggingFlag const aliased_logging_flags[] = {
407 { "TraceClassLoading", LogLevel::Info, true, LogTag::_classload },
408 { "TraceClassUnloading", LogLevel::Info, true, LogTag::_classunload },
409 { "TraceClassResolution", LogLevel::Info, true, LogTag::_classresolve },
410 { "TraceExceptions", LogLevel::Info, true, LogTag::_exceptions },
411 { "TraceMonitorInflation", LogLevel::Debug, true, LogTag::_monitorinflation },
412 { NULL, LogLevel::Off, false, LogTag::__NO_TAG }
413 };
414
415 // Return true if "v" is less than "other", where "other" may be "undefined".
416 static bool version_less_than(JDK_Version v, JDK_Version other) {
417 assert(!v.is_undefined(), "must be defined");
418 if (!other.is_undefined() && v.compare(other) >= 0) {
419 return false;
420 } else {
421 return true;
422 }
423 }
424
425 static bool lookup_special_flag(const char *flag_name, SpecialFlag& flag) {
426 for (size_t i = 0; special_jvm_flags[i].name != NULL; i++) {
427 if ((strcmp(special_jvm_flags[i].name, flag_name) == 0)) {
428 flag = special_jvm_flags[i];
429 return true;
3237 "ManagementServer is not supported in this VM.\n");
3238 return JNI_ERR;
3239 #endif // INCLUDE_MANAGEMENT
3240 } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx
3241 // Skip -XX:Flags= and -XX:VMOptionsFile= since those cases have
3242 // already been handled
3243 if ((strncmp(tail, "Flags=", strlen("Flags=")) != 0) &&
3244 (strncmp(tail, "VMOptionsFile=", strlen("VMOptionsFile=")) != 0)) {
3245 if (!process_argument(tail, args->ignoreUnrecognized, origin)) {
3246 return JNI_EINVAL;
3247 }
3248 }
3249 // Unknown option
3250 } else if (is_bad_option(option, args->ignoreUnrecognized)) {
3251 return JNI_ERR;
3252 }
3253 }
3254
3255 // PrintSharedArchiveAndExit will turn on
3256 // -Xshare:on
3257 // -XX:+TraceClassPaths
3258 if (PrintSharedArchiveAndExit) {
3259 if (FLAG_SET_CMDLINE(bool, UseSharedSpaces, true) != Flag::SUCCESS) {
3260 return JNI_EINVAL;
3261 }
3262 if (FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true) != Flag::SUCCESS) {
3263 return JNI_EINVAL;
3264 }
3265 if (FLAG_SET_CMDLINE(bool, TraceClassPaths, true) != Flag::SUCCESS) {
3266 return JNI_EINVAL;
3267 }
3268 }
3269
3270 // Change the default value for flags which have different default values
3271 // when working with older JDKs.
3272 #ifdef LINUX
3273 if (JDK_Version::current().compare_major(6) <= 0 &&
3274 FLAG_IS_DEFAULT(UseLinuxPosixThreadCPUClocks)) {
3275 FLAG_SET_DEFAULT(UseLinuxPosixThreadCPUClocks, false);
3276 }
3277 #endif // LINUX
3278 fix_appclasspath();
3279 return JNI_OK;
3280 }
3281
3282 // Remove all empty paths from the app classpath (if IgnoreEmptyClassPaths is enabled)
3283 //
3284 // This is necessary because some apps like to specify classpath like -cp foo.jar:${XYZ}:bar.jar
3285 // in their start-up scripts. If XYZ is empty, the classpath will look like "-cp foo.jar::bar.jar".
3286 // Java treats such empty paths as if the user specified "-cp foo.jar:.:bar.jar". I.e., an empty
3287 // path is treated as the current directory.
|
388
389 // Flags that are aliases for other flags.
390 typedef struct {
391 const char* alias_name;
392 const char* real_name;
393 } AliasedFlag;
394
395 static AliasedFlag const aliased_jvm_flags[] = {
396 { "DefaultMaxRAMFraction", "MaxRAMFraction" },
397 { "CMSMarkStackSizeMax", "MarkStackSizeMax" },
398 { "CMSMarkStackSize", "MarkStackSize" },
399 { "G1MarkStackSize", "MarkStackSize" },
400 { "ParallelMarkingThreads", "ConcGCThreads" },
401 { "ParallelCMSThreads", "ConcGCThreads" },
402 { "CreateMinidumpOnCrash", "CreateCoredumpOnCrash" },
403 { NULL, NULL}
404 };
405
406 static AliasedLoggingFlag const aliased_logging_flags[] = {
407 { "TraceClassLoading", LogLevel::Info, true, LogTag::_classload },
408 { "TraceClassPaths", LogLevel::Info, true, LogTag::_classpath },
409 { "TraceClassResolution", LogLevel::Info, true, LogTag::_classresolve },
410 { "TraceClassUnloading", LogLevel::Info, true, LogTag::_classunload },
411 { "TraceExceptions", LogLevel::Info, true, LogTag::_exceptions },
412 { "TraceMonitorInflation", LogLevel::Debug, true, LogTag::_monitorinflation },
413 { NULL, LogLevel::Off, false, LogTag::__NO_TAG }
414 };
415
416 // Return true if "v" is less than "other", where "other" may be "undefined".
417 static bool version_less_than(JDK_Version v, JDK_Version other) {
418 assert(!v.is_undefined(), "must be defined");
419 if (!other.is_undefined() && v.compare(other) >= 0) {
420 return false;
421 } else {
422 return true;
423 }
424 }
425
426 static bool lookup_special_flag(const char *flag_name, SpecialFlag& flag) {
427 for (size_t i = 0; special_jvm_flags[i].name != NULL; i++) {
428 if ((strcmp(special_jvm_flags[i].name, flag_name) == 0)) {
429 flag = special_jvm_flags[i];
430 return true;
3238 "ManagementServer is not supported in this VM.\n");
3239 return JNI_ERR;
3240 #endif // INCLUDE_MANAGEMENT
3241 } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx
3242 // Skip -XX:Flags= and -XX:VMOptionsFile= since those cases have
3243 // already been handled
3244 if ((strncmp(tail, "Flags=", strlen("Flags=")) != 0) &&
3245 (strncmp(tail, "VMOptionsFile=", strlen("VMOptionsFile=")) != 0)) {
3246 if (!process_argument(tail, args->ignoreUnrecognized, origin)) {
3247 return JNI_EINVAL;
3248 }
3249 }
3250 // Unknown option
3251 } else if (is_bad_option(option, args->ignoreUnrecognized)) {
3252 return JNI_ERR;
3253 }
3254 }
3255
3256 // PrintSharedArchiveAndExit will turn on
3257 // -Xshare:on
3258 // -Xlog:classpath=info
3259 if (PrintSharedArchiveAndExit) {
3260 if (FLAG_SET_CMDLINE(bool, UseSharedSpaces, true) != Flag::SUCCESS) {
3261 return JNI_EINVAL;
3262 }
3263 if (FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true) != Flag::SUCCESS) {
3264 return JNI_EINVAL;
3265 }
3266 LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(classpath));
3267 }
3268
3269 // Change the default value for flags which have different default values
3270 // when working with older JDKs.
3271 #ifdef LINUX
3272 if (JDK_Version::current().compare_major(6) <= 0 &&
3273 FLAG_IS_DEFAULT(UseLinuxPosixThreadCPUClocks)) {
3274 FLAG_SET_DEFAULT(UseLinuxPosixThreadCPUClocks, false);
3275 }
3276 #endif // LINUX
3277 fix_appclasspath();
3278 return JNI_OK;
3279 }
3280
3281 // Remove all empty paths from the app classpath (if IgnoreEmptyClassPaths is enabled)
3282 //
3283 // This is necessary because some apps like to specify classpath like -cp foo.jar:${XYZ}:bar.jar
3284 // in their start-up scripts. If XYZ is empty, the classpath will look like "-cp foo.jar::bar.jar".
3285 // Java treats such empty paths as if the user specified "-cp foo.jar:.:bar.jar". I.e., an empty
3286 // path is treated as the current directory.
|