< prev index next >
src/share/vm/runtime/arguments.cpp
Print this page
@@ -137,10 +137,35 @@
} else {
return false;
}
}
+// Return true if any of the strings in null-terminated array 'names' matches.
+// If tail_allowed is true, then the tail must begin with a colon; otherwise,
+// the option must match exactly.
+static bool match_option(const JavaVMOption* option, const char** names, const char** tail,
+ bool tail_allowed) {
+ for (/* empty */; *names != NULL; ++names) {
+ if (match_option(option, *names, tail)) {
+ if (**tail == '\0' || tail_allowed && **tail == ':') {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+static bool match_option(const JavaVMOption *option, const char* name) {
+ const char* tail = NULL;
+ bool result = match_option(option, name, &tail);
+ if (tail != NULL && *tail == '\0') {
+ return result;
+ } else {
+ return false;
+ }
+}
+
static void logOption(const char* opt) {
if (PrintVMOptions) {
jio_fprintf(defaultStream::output_stream(), "VM option '%s'\n", opt);
}
}
@@ -2574,25 +2599,10 @@
static const char* system_assertion_options[] = {
"-dsa", "-esa", "-disablesystemassertions", "-enablesystemassertions", 0
};
-// Return true if any of the strings in null-terminated array 'names' matches.
-// If tail_allowed is true, then the tail must begin with a colon; otherwise,
-// the option must match exactly.
-static bool match_option(const JavaVMOption* option, const char** names, const char** tail,
- bool tail_allowed) {
- for (/* empty */; *names != NULL; ++names) {
- if (match_option(option, *names, tail)) {
- if (**tail == '\0' || tail_allowed && **tail == ':') {
- return true;
- }
- }
- }
- return false;
-}
-
bool Arguments::parse_uintx(const char* value,
uintx* uintx_arg,
uintx min_size) {
// Check the sign first since atomull() parses only unsigned values.
@@ -2830,20 +2840,20 @@
char *options = strcpy(NEW_C_HEAP_ARRAY(char, strlen(tail) + 1, mtInternal), tail);
add_init_agent("instrument", options, false);
}
#endif // !INCLUDE_JVMTI
// -Xnoclassgc
- } else if (match_option(option, "-Xnoclassgc", &tail)) {
+ } else if (match_option(option, "-Xnoclassgc")) {
FLAG_SET_CMDLINE(bool, ClassUnloading, false);
// -Xconcgc
- } else if (match_option(option, "-Xconcgc", &tail)) {
+ } else if (match_option(option, "-Xconcgc")) {
FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, true);
// -Xnoconcgc
- } else if (match_option(option, "-Xnoconcgc", &tail)) {
+ } else if (match_option(option, "-Xnoconcgc")) {
FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, false);
// -Xbatch
- } else if (match_option(option, "-Xbatch", &tail)) {
+ } else if (match_option(option, "-Xbatch")) {
FLAG_SET_CMDLINE(bool, BackgroundCompilation, false);
// -Xmn for compatibility with other JVM vendors
} else if (match_option(option, "-Xmn", &tail)) {
julong long_initial_young_size = 0;
ArgsRange errcode = parse_memory_size(tail, &long_initial_young_size, 1);
@@ -2984,49 +2994,49 @@
option->optionString);
return JNI_EINVAL;
}
FLAG_SET_CMDLINE(uintx, IncreaseFirstTierCompileThresholdAt, (uintx)uint_IncreaseFirstTierCompileThresholdAt);
// -green
- } else if (match_option(option, "-green", &tail)) {
+ } else if (match_option(option, "-green")) {
jio_fprintf(defaultStream::error_stream(),
"Green threads support not available\n");
return JNI_EINVAL;
// -native
- } else if (match_option(option, "-native", &tail)) {
+ } else if (match_option(option, "-native")) {
// HotSpot always uses native threads, ignore silently for compatibility
// -Xsqnopause
- } else if (match_option(option, "-Xsqnopause", &tail)) {
+ } else if (match_option(option, "-Xsqnopause")) {
// EVM option, ignore silently for compatibility
// -Xrs
- } else if (match_option(option, "-Xrs", &tail)) {
+ } else if (match_option(option, "-Xrs")) {
// Classic/EVM option, new functionality
FLAG_SET_CMDLINE(bool, ReduceSignalUsage, true);
- } else if (match_option(option, "-Xusealtsigs", &tail)) {
+ } else if (match_option(option, "-Xusealtsigs")) {
// change default internal VM signals used - lower case for back compat
FLAG_SET_CMDLINE(bool, UseAltSigs, true);
// -Xoptimize
- } else if (match_option(option, "-Xoptimize", &tail)) {
+ } else if (match_option(option, "-Xoptimize")) {
// EVM option, ignore silently for compatibility
// -Xprof
- } else if (match_option(option, "-Xprof", &tail)) {
+ } else if (match_option(option, "-Xprof")) {
#if INCLUDE_FPROF
_has_profile = true;
#else // INCLUDE_FPROF
jio_fprintf(defaultStream::error_stream(),
"Flat profiling is not supported in this VM.\n");
return JNI_ERR;
#endif // INCLUDE_FPROF
// -Xconcurrentio
- } else if (match_option(option, "-Xconcurrentio", &tail)) {
+ } else if (match_option(option, "-Xconcurrentio")) {
FLAG_SET_CMDLINE(bool, UseLWPSynchronization, true);
FLAG_SET_CMDLINE(bool, BackgroundCompilation, false);
FLAG_SET_CMDLINE(intx, DeferThrSuspendLoopCount, 1);
FLAG_SET_CMDLINE(bool, UseTLAB, false);
FLAG_SET_CMDLINE(uintx, NewSizeThreadIncrease, 16 * K); // 20Kb per thread added to new generation
// -Xinternalversion
- } else if (match_option(option, "-Xinternalversion", &tail)) {
+ } else if (match_option(option, "-Xinternalversion")) {
jio_fprintf(defaultStream::output_stream(), "%s\n",
VM_Version::internal_vm_info_string());
vm_exit(0);
#ifndef PRODUCT
// -Xprintflags
@@ -3048,33 +3058,33 @@
"-Dcom.sun.management is not supported in this VM.\n");
return JNI_ERR;
#endif
}
// -Xint
- } else if (match_option(option, "-Xint", &tail)) {
+ } else if (match_option(option, "-Xint")) {
set_mode_flags(_int);
// -Xmixed
- } else if (match_option(option, "-Xmixed", &tail)) {
+ } else if (match_option(option, "-Xmixed")) {
set_mode_flags(_mixed);
// -Xcomp
- } else if (match_option(option, "-Xcomp", &tail)) {
+ } else if (match_option(option, "-Xcomp")) {
// for testing the compiler; turn off all flags that inhibit compilation
set_mode_flags(_comp);
// -Xshare:dump
- } else if (match_option(option, "-Xshare:dump", &tail)) {
+ } else if (match_option(option, "-Xshare:dump")) {
FLAG_SET_CMDLINE(bool, DumpSharedSpaces, true);
set_mode_flags(_int); // Prevent compilation, which creates objects
// -Xshare:on
- } else if (match_option(option, "-Xshare:on", &tail)) {
+ } else if (match_option(option, "-Xshare:on")) {
FLAG_SET_CMDLINE(bool, UseSharedSpaces, true);
FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true);
// -Xshare:auto
- } else if (match_option(option, "-Xshare:auto", &tail)) {
+ } else if (match_option(option, "-Xshare:auto")) {
FLAG_SET_CMDLINE(bool, UseSharedSpaces, true);
FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false);
// -Xshare:off
- } else if (match_option(option, "-Xshare:off", &tail)) {
+ } else if (match_option(option, "-Xshare:off")) {
FLAG_SET_CMDLINE(bool, UseSharedSpaces, false);
FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false);
// -Xverify
} else if (match_option(option, "-Xverify", &tail)) {
if (strcmp(tail, ":all") == 0 || strcmp(tail, "") == 0) {
@@ -3088,17 +3098,17 @@
FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, false);
} else if (is_bad_option(option, args->ignoreUnrecognized, "verification")) {
return JNI_EINVAL;
}
// -Xdebug
- } else if (match_option(option, "-Xdebug", &tail)) {
+ } else if (match_option(option, "-Xdebug")) {
// note this flag has been used, then ignore
set_xdebug_mode(true);
// -Xnoagent
- } else if (match_option(option, "-Xnoagent", &tail)) {
+ } else if (match_option(option, "-Xnoagent")) {
// For compatibility with classic. HotSpot refuses to load the old style agent.dll.
- } else if (match_option(option, "-Xboundthreads", &tail)) {
+ } else if (match_option(option, "-Xboundthreads")) {
// Bind user level threads to kernel threads (Solaris only)
FLAG_SET_CMDLINE(bool, UseBoundThreads, true);
} else if (match_option(option, "-Xloggc:", &tail)) {
// Redirect GC output to the file. -Xloggc:<filename>
// ostream_init_log(), when called will use this filename
@@ -3124,18 +3134,18 @@
#endif // INCLUDE_JNI_CHECK
} else if (is_bad_option(option, args->ignoreUnrecognized,
"check")) {
return JNI_EINVAL;
}
- } else if (match_option(option, "vfprintf", &tail)) {
+ } else if (match_option(option, "vfprintf")) {
_vfprintf_hook = CAST_TO_FN_PTR(vfprintf_hook_t, option->extraInfo);
- } else if (match_option(option, "exit", &tail)) {
+ } else if (match_option(option, "exit")) {
_exit_hook = CAST_TO_FN_PTR(exit_hook_t, option->extraInfo);
- } else if (match_option(option, "abort", &tail)) {
+ } else if (match_option(option, "abort")) {
_abort_hook = CAST_TO_FN_PTR(abort_hook_t, option->extraInfo);
// -XX:+AggressiveHeap
- } else if (match_option(option, "-XX:+AggressiveHeap", &tail)) {
+ } else if (match_option(option, "-XX:+AggressiveHeap")) {
// This option inspects the machine and attempts to set various
// parameters to be optimal for long-running, memory allocation
// intensive jobs. It is intended for machines with large
// amounts of cpu and memory.
@@ -3222,15 +3232,15 @@
// but disallow DR and offlining (5008695).
FLAG_SET_CMDLINE(bool, BindGCTaskThreadsToCPUs, true);
// Need to keep consistency of MaxTenuringThreshold and AlwaysTenure/NeverTenure;
// and the last option wins.
- } else if (match_option(option, "-XX:+NeverTenure", &tail)) {
+ } else if (match_option(option, "-XX:+NeverTenure")) {
FLAG_SET_CMDLINE(bool, NeverTenure, true);
FLAG_SET_CMDLINE(bool, AlwaysTenure, false);
FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, markOopDesc::max_age + 1);
- } else if (match_option(option, "-XX:+AlwaysTenure", &tail)) {
+ } else if (match_option(option, "-XX:+AlwaysTenure")) {
FLAG_SET_CMDLINE(bool, NeverTenure, false);
FLAG_SET_CMDLINE(bool, AlwaysTenure, true);
FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, 0);
} else if (match_option(option, "-XX:MaxTenuringThreshold=", &tail)) {
uintx max_tenuring_thresh = 0;
@@ -3245,37 +3255,37 @@
FLAG_SET_CMDLINE(bool, AlwaysTenure, true);
} else {
FLAG_SET_CMDLINE(bool, NeverTenure, false);
FLAG_SET_CMDLINE(bool, AlwaysTenure, false);
}
- } else if (match_option(option, "-XX:+CMSPermGenSweepingEnabled", &tail) ||
- match_option(option, "-XX:-CMSPermGenSweepingEnabled", &tail)) {
+ } else if (match_option(option, "-XX:+CMSPermGenSweepingEnabled") ||
+ match_option(option, "-XX:-CMSPermGenSweepingEnabled")) {
jio_fprintf(defaultStream::error_stream(),
"Please use CMSClassUnloadingEnabled in place of "
"CMSPermGenSweepingEnabled in the future\n");
- } else if (match_option(option, "-XX:+UseGCTimeLimit", &tail)) {
+ } else if (match_option(option, "-XX:+UseGCTimeLimit")) {
FLAG_SET_CMDLINE(bool, UseGCOverheadLimit, true);
jio_fprintf(defaultStream::error_stream(),
"Please use -XX:+UseGCOverheadLimit in place of "
"-XX:+UseGCTimeLimit in the future\n");
- } else if (match_option(option, "-XX:-UseGCTimeLimit", &tail)) {
+ } else if (match_option(option, "-XX:-UseGCTimeLimit")) {
FLAG_SET_CMDLINE(bool, UseGCOverheadLimit, false);
jio_fprintf(defaultStream::error_stream(),
"Please use -XX:-UseGCOverheadLimit in place of "
"-XX:-UseGCTimeLimit in the future\n");
// The TLE options are for compatibility with 1.3 and will be
// removed without notice in a future release. These options
// are not to be documented.
} else if (match_option(option, "-XX:MaxTLERatio=", &tail)) {
// No longer used.
- } else if (match_option(option, "-XX:+ResizeTLE", &tail)) {
+ } else if (match_option(option, "-XX:+ResizeTLE")) {
FLAG_SET_CMDLINE(bool, ResizeTLAB, true);
- } else if (match_option(option, "-XX:-ResizeTLE", &tail)) {
+ } else if (match_option(option, "-XX:-ResizeTLE")) {
FLAG_SET_CMDLINE(bool, ResizeTLAB, false);
- } else if (match_option(option, "-XX:+PrintTLE", &tail)) {
+ } else if (match_option(option, "-XX:+PrintTLE")) {
FLAG_SET_CMDLINE(bool, PrintTLAB, true);
- } else if (match_option(option, "-XX:-PrintTLE", &tail)) {
+ } else if (match_option(option, "-XX:-PrintTLE")) {
FLAG_SET_CMDLINE(bool, PrintTLAB, false);
} else if (match_option(option, "-XX:TLEFragmentationRatio=", &tail)) {
// No longer used.
} else if (match_option(option, "-XX:TLESize=", &tail)) {
julong long_tlab_size = 0;
@@ -3287,21 +3297,21 @@
return JNI_EINVAL;
}
FLAG_SET_CMDLINE(uintx, TLABSize, long_tlab_size);
} else if (match_option(option, "-XX:TLEThreadRatio=", &tail)) {
// No longer used.
- } else if (match_option(option, "-XX:+UseTLE", &tail)) {
+ } else if (match_option(option, "-XX:+UseTLE")) {
FLAG_SET_CMDLINE(bool, UseTLAB, true);
- } else if (match_option(option, "-XX:-UseTLE", &tail)) {
+ } else if (match_option(option, "-XX:-UseTLE")) {
FLAG_SET_CMDLINE(bool, UseTLAB, false);
- } else if (match_option(option, "-XX:+DisplayVMOutputToStderr", &tail)) {
+ } else if (match_option(option, "-XX:+DisplayVMOutputToStderr")) {
FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, false);
FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, true);
- } else if (match_option(option, "-XX:+DisplayVMOutputToStdout", &tail)) {
+ } else if (match_option(option, "-XX:+DisplayVMOutputToStdout")) {
FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, false);
FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, true);
- } else if (match_option(option, "-XX:+ExtendedDTraceProbes", &tail)) {
+ } else if (match_option(option, "-XX:+ExtendedDTraceProbes")) {
#if defined(DTRACE_ENABLED)
FLAG_SET_CMDLINE(bool, ExtendedDTraceProbes, true);
FLAG_SET_CMDLINE(bool, DTraceMethodProbes, true);
FLAG_SET_CMDLINE(bool, DTraceAllocProbes, true);
FLAG_SET_CMDLINE(bool, DTraceMonitorProbes, true);
@@ -3395,11 +3405,11 @@
describe_range_error(errcode);
return JNI_EINVAL;
}
FLAG_SET_CMDLINE(uintx, MaxDirectMemorySize, max_direct_memory_size);
#if !INCLUDE_MANAGEMENT
- } else if (match_option(option, "-XX:+ManagementServer", &tail)) {
+ } else if (match_option(option, "-XX:+ManagementServer")) {
jio_fprintf(defaultStream::error_stream(),
"ManagementServer is not supported in this VM.\n");
return JNI_ERR;
#endif // INCLUDE_MANAGEMENT
} else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx
< prev index next >