122 SystemProperty *Arguments::_java_home = NULL;
123 SystemProperty *Arguments::_java_class_path = NULL;
124 SystemProperty *Arguments::_sun_boot_class_path = NULL;
125
126 char* Arguments::_meta_index_path = NULL;
127 char* Arguments::_meta_index_dir = NULL;
128
129 // Check if head of 'option' matches 'name', and sets 'tail' remaining part of option string
130
131 static bool match_option(const JavaVMOption *option, const char* name,
132 const char** tail) {
133 int len = (int)strlen(name);
134 if (strncmp(option->optionString, name, len) == 0) {
135 *tail = option->optionString + len;
136 return true;
137 } else {
138 return false;
139 }
140 }
141
142 static void logOption(const char* opt) {
143 if (PrintVMOptions) {
144 jio_fprintf(defaultStream::output_stream(), "VM option '%s'\n", opt);
145 }
146 }
147
148 // Process java launcher properties.
149 void Arguments::process_sun_java_launcher_properties(JavaVMInitArgs* args) {
150 // See if sun.java.launcher, sun.java.launcher.is_altjvm or
151 // sun.java.launcher.pid is defined.
152 // Must do this before setting up other system properties,
153 // as some of them may depend on launcher type.
154 for (int index = 0; index < args->nOptions; index++) {
155 const JavaVMOption* option = args->options + index;
156 const char* tail;
157
158 if (match_option(option, "-Dsun.java.launcher=", &tail)) {
159 process_java_launcher_argument(tail, option->extraInfo);
160 continue;
161 }
2559 jio_fprintf(defaultStream::error_stream(),
2560 "Obsolete %s%soption: %s\n", option_type, spacer,
2561 option->optionString);
2562 return false;
2563 } else {
2564 jio_fprintf(defaultStream::error_stream(),
2565 "Unrecognized %s%soption: %s\n", option_type, spacer,
2566 option->optionString);
2567 return true;
2568 }
2569 }
2570
2571 static const char* user_assertion_options[] = {
2572 "-da", "-ea", "-disableassertions", "-enableassertions", 0
2573 };
2574
2575 static const char* system_assertion_options[] = {
2576 "-dsa", "-esa", "-disablesystemassertions", "-enablesystemassertions", 0
2577 };
2578
2579 // Return true if any of the strings in null-terminated array 'names' matches.
2580 // If tail_allowed is true, then the tail must begin with a colon; otherwise,
2581 // the option must match exactly.
2582 static bool match_option(const JavaVMOption* option, const char** names, const char** tail,
2583 bool tail_allowed) {
2584 for (/* empty */; *names != NULL; ++names) {
2585 if (match_option(option, *names, tail)) {
2586 if (**tail == '\0' || tail_allowed && **tail == ':') {
2587 return true;
2588 }
2589 }
2590 }
2591 return false;
2592 }
2593
2594 bool Arguments::parse_uintx(const char* value,
2595 uintx* uintx_arg,
2596 uintx min_size) {
2597
2598 // Check the sign first since atomull() parses only unsigned values.
2599 bool value_is_positive = !(*value == '-');
2600
2601 if (value_is_positive) {
2602 julong n;
2603 bool good_return = atomull(value, &n);
2604 if (good_return) {
2605 bool above_minimum = n >= min_size;
2606 bool value_is_too_large = n > max_uintx;
2607
2608 if (above_minimum && !value_is_too_large) {
2609 *uintx_arg = n;
2610 return true;
2611 }
2612 }
2613 }
2815 jio_fprintf(defaultStream::error_stream(),
2816 "Profiling and debugging agents are not supported in this VM\n");
2817 return JNI_ERR;
2818 }
2819 #endif // !INCLUDE_JVMTI
2820 add_init_agent(name, options, is_absolute_path);
2821 }
2822 // -javaagent
2823 } else if (match_option(option, "-javaagent:", &tail)) {
2824 #if !INCLUDE_JVMTI
2825 jio_fprintf(defaultStream::error_stream(),
2826 "Instrumentation agents are not supported in this VM\n");
2827 return JNI_ERR;
2828 #else
2829 if(tail != NULL) {
2830 char *options = strcpy(NEW_C_HEAP_ARRAY(char, strlen(tail) + 1, mtInternal), tail);
2831 add_init_agent("instrument", options, false);
2832 }
2833 #endif // !INCLUDE_JVMTI
2834 // -Xnoclassgc
2835 } else if (match_option(option, "-Xnoclassgc", &tail)) {
2836 FLAG_SET_CMDLINE(bool, ClassUnloading, false);
2837 // -Xconcgc
2838 } else if (match_option(option, "-Xconcgc", &tail)) {
2839 FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, true);
2840 // -Xnoconcgc
2841 } else if (match_option(option, "-Xnoconcgc", &tail)) {
2842 FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, false);
2843 // -Xbatch
2844 } else if (match_option(option, "-Xbatch", &tail)) {
2845 FLAG_SET_CMDLINE(bool, BackgroundCompilation, false);
2846 // -Xmn for compatibility with other JVM vendors
2847 } else if (match_option(option, "-Xmn", &tail)) {
2848 julong long_initial_young_size = 0;
2849 ArgsRange errcode = parse_memory_size(tail, &long_initial_young_size, 1);
2850 if (errcode != arg_in_range) {
2851 jio_fprintf(defaultStream::error_stream(),
2852 "Invalid initial young generation size: %s\n", option->optionString);
2853 describe_range_error(errcode);
2854 return JNI_EINVAL;
2855 }
2856 FLAG_SET_CMDLINE(uintx, MaxNewSize, (uintx)long_initial_young_size);
2857 FLAG_SET_CMDLINE(uintx, NewSize, (uintx)long_initial_young_size);
2858 // -Xms
2859 } else if (match_option(option, "-Xms", &tail)) {
2860 julong long_initial_heap_size = 0;
2861 // an initial heap size of 0 means automatically determine
2862 ArgsRange errcode = parse_memory_size(tail, &long_initial_heap_size, 0);
2863 if (errcode != arg_in_range) {
2864 jio_fprintf(defaultStream::error_stream(),
2969 julong long_NonProfiledCodeHeapSize = 0;
2970
2971 ArgsRange errcode = parse_memory_size(tail, &long_NonProfiledCodeHeapSize, 1);
2972 if (errcode != arg_in_range) {
2973 jio_fprintf(defaultStream::error_stream(),
2974 "Invalid maximum non-profiled code heap size: %s.\n", option->optionString);
2975 return JNI_EINVAL;
2976 }
2977 FLAG_SET_CMDLINE(uintx, NonProfiledCodeHeapSize, (uintx)long_NonProfiledCodeHeapSize);
2978 //-XX:IncreaseFirstTierCompileThresholdAt=
2979 } else if (match_option(option, "-XX:IncreaseFirstTierCompileThresholdAt=", &tail)) {
2980 uintx uint_IncreaseFirstTierCompileThresholdAt = 0;
2981 if (!parse_uintx(tail, &uint_IncreaseFirstTierCompileThresholdAt, 0) || uint_IncreaseFirstTierCompileThresholdAt > 99) {
2982 jio_fprintf(defaultStream::error_stream(),
2983 "Invalid value for IncreaseFirstTierCompileThresholdAt: %s. Should be between 0 and 99.\n",
2984 option->optionString);
2985 return JNI_EINVAL;
2986 }
2987 FLAG_SET_CMDLINE(uintx, IncreaseFirstTierCompileThresholdAt, (uintx)uint_IncreaseFirstTierCompileThresholdAt);
2988 // -green
2989 } else if (match_option(option, "-green", &tail)) {
2990 jio_fprintf(defaultStream::error_stream(),
2991 "Green threads support not available\n");
2992 return JNI_EINVAL;
2993 // -native
2994 } else if (match_option(option, "-native", &tail)) {
2995 // HotSpot always uses native threads, ignore silently for compatibility
2996 // -Xsqnopause
2997 } else if (match_option(option, "-Xsqnopause", &tail)) {
2998 // EVM option, ignore silently for compatibility
2999 // -Xrs
3000 } else if (match_option(option, "-Xrs", &tail)) {
3001 // Classic/EVM option, new functionality
3002 FLAG_SET_CMDLINE(bool, ReduceSignalUsage, true);
3003 } else if (match_option(option, "-Xusealtsigs", &tail)) {
3004 // change default internal VM signals used - lower case for back compat
3005 FLAG_SET_CMDLINE(bool, UseAltSigs, true);
3006 // -Xoptimize
3007 } else if (match_option(option, "-Xoptimize", &tail)) {
3008 // EVM option, ignore silently for compatibility
3009 // -Xprof
3010 } else if (match_option(option, "-Xprof", &tail)) {
3011 #if INCLUDE_FPROF
3012 _has_profile = true;
3013 #else // INCLUDE_FPROF
3014 jio_fprintf(defaultStream::error_stream(),
3015 "Flat profiling is not supported in this VM.\n");
3016 return JNI_ERR;
3017 #endif // INCLUDE_FPROF
3018 // -Xconcurrentio
3019 } else if (match_option(option, "-Xconcurrentio", &tail)) {
3020 FLAG_SET_CMDLINE(bool, UseLWPSynchronization, true);
3021 FLAG_SET_CMDLINE(bool, BackgroundCompilation, false);
3022 FLAG_SET_CMDLINE(intx, DeferThrSuspendLoopCount, 1);
3023 FLAG_SET_CMDLINE(bool, UseTLAB, false);
3024 FLAG_SET_CMDLINE(uintx, NewSizeThreadIncrease, 16 * K); // 20Kb per thread added to new generation
3025
3026 // -Xinternalversion
3027 } else if (match_option(option, "-Xinternalversion", &tail)) {
3028 jio_fprintf(defaultStream::output_stream(), "%s\n",
3029 VM_Version::internal_vm_info_string());
3030 vm_exit(0);
3031 #ifndef PRODUCT
3032 // -Xprintflags
3033 } else if (match_option(option, "-Xprintflags", &tail)) {
3034 CommandLineFlags::printFlags(tty, false);
3035 vm_exit(0);
3036 #endif
3037 // -D
3038 } else if (match_option(option, "-D", &tail)) {
3039 if (!add_property(tail)) {
3040 return JNI_ENOMEM;
3041 }
3042 // Out of the box management support
3043 if (match_option(option, "-Dcom.sun.management", &tail)) {
3044 #if INCLUDE_MANAGEMENT
3045 FLAG_SET_CMDLINE(bool, ManagementServer, true);
3046 #else
3047 jio_fprintf(defaultStream::output_stream(),
3048 "-Dcom.sun.management is not supported in this VM.\n");
3049 return JNI_ERR;
3050 #endif
3051 }
3052 // -Xint
3053 } else if (match_option(option, "-Xint", &tail)) {
3054 set_mode_flags(_int);
3055 // -Xmixed
3056 } else if (match_option(option, "-Xmixed", &tail)) {
3057 set_mode_flags(_mixed);
3058 // -Xcomp
3059 } else if (match_option(option, "-Xcomp", &tail)) {
3060 // for testing the compiler; turn off all flags that inhibit compilation
3061 set_mode_flags(_comp);
3062 // -Xshare:dump
3063 } else if (match_option(option, "-Xshare:dump", &tail)) {
3064 FLAG_SET_CMDLINE(bool, DumpSharedSpaces, true);
3065 set_mode_flags(_int); // Prevent compilation, which creates objects
3066 // -Xshare:on
3067 } else if (match_option(option, "-Xshare:on", &tail)) {
3068 FLAG_SET_CMDLINE(bool, UseSharedSpaces, true);
3069 FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true);
3070 // -Xshare:auto
3071 } else if (match_option(option, "-Xshare:auto", &tail)) {
3072 FLAG_SET_CMDLINE(bool, UseSharedSpaces, true);
3073 FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false);
3074 // -Xshare:off
3075 } else if (match_option(option, "-Xshare:off", &tail)) {
3076 FLAG_SET_CMDLINE(bool, UseSharedSpaces, false);
3077 FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false);
3078 // -Xverify
3079 } else if (match_option(option, "-Xverify", &tail)) {
3080 if (strcmp(tail, ":all") == 0 || strcmp(tail, "") == 0) {
3081 FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, true);
3082 FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, true);
3083 } else if (strcmp(tail, ":remote") == 0) {
3084 FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, false);
3085 FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, true);
3086 } else if (strcmp(tail, ":none") == 0) {
3087 FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, false);
3088 FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, false);
3089 } else if (is_bad_option(option, args->ignoreUnrecognized, "verification")) {
3090 return JNI_EINVAL;
3091 }
3092 // -Xdebug
3093 } else if (match_option(option, "-Xdebug", &tail)) {
3094 // note this flag has been used, then ignore
3095 set_xdebug_mode(true);
3096 // -Xnoagent
3097 } else if (match_option(option, "-Xnoagent", &tail)) {
3098 // For compatibility with classic. HotSpot refuses to load the old style agent.dll.
3099 } else if (match_option(option, "-Xboundthreads", &tail)) {
3100 // Bind user level threads to kernel threads (Solaris only)
3101 FLAG_SET_CMDLINE(bool, UseBoundThreads, true);
3102 } else if (match_option(option, "-Xloggc:", &tail)) {
3103 // Redirect GC output to the file. -Xloggc:<filename>
3104 // ostream_init_log(), when called will use this filename
3105 // to initialize a fileStream.
3106 _gc_log_filename = os::strdup_check_oom(tail);
3107 if (!is_filename_valid(_gc_log_filename)) {
3108 jio_fprintf(defaultStream::output_stream(),
3109 "Invalid file name for use with -Xloggc: Filename can only contain the "
3110 "characters [A-Z][a-z][0-9]-_.%%[p|t] but it has been %s\n"
3111 "Note %%p or %%t can only be used once\n", _gc_log_filename);
3112 return JNI_EINVAL;
3113 }
3114 FLAG_SET_CMDLINE(bool, PrintGC, true);
3115 FLAG_SET_CMDLINE(bool, PrintGCTimeStamps, true);
3116
3117 // JNI hooks
3118 } else if (match_option(option, "-Xcheck", &tail)) {
3119 if (!strcmp(tail, ":jni")) {
3120 #if !INCLUDE_JNI_CHECK
3121 warning("JNI CHECKING is not supported in this VM");
3122 #else
3123 CheckJNICalls = true;
3124 #endif // INCLUDE_JNI_CHECK
3125 } else if (is_bad_option(option, args->ignoreUnrecognized,
3126 "check")) {
3127 return JNI_EINVAL;
3128 }
3129 } else if (match_option(option, "vfprintf", &tail)) {
3130 _vfprintf_hook = CAST_TO_FN_PTR(vfprintf_hook_t, option->extraInfo);
3131 } else if (match_option(option, "exit", &tail)) {
3132 _exit_hook = CAST_TO_FN_PTR(exit_hook_t, option->extraInfo);
3133 } else if (match_option(option, "abort", &tail)) {
3134 _abort_hook = CAST_TO_FN_PTR(abort_hook_t, option->extraInfo);
3135 // -XX:+AggressiveHeap
3136 } else if (match_option(option, "-XX:+AggressiveHeap", &tail)) {
3137
3138 // This option inspects the machine and attempts to set various
3139 // parameters to be optimal for long-running, memory allocation
3140 // intensive jobs. It is intended for machines with large
3141 // amounts of cpu and memory.
3142
3143 // initHeapSize is needed since _initial_heap_size is 4 bytes on a 32 bit
3144 // VM, but we may not be able to represent the total physical memory
3145 // available (like having 8gb of memory on a box but using a 32bit VM).
3146 // Thus, we need to make sure we're using a julong for intermediate
3147 // calculations.
3148 julong initHeapSize;
3149 julong total_memory = os::physical_memory();
3150
3151 if (total_memory < (julong)256*M) {
3152 jio_fprintf(defaultStream::error_stream(),
3153 "You need at least 256mb of memory to use -XX:+AggressiveHeap\n");
3154 vm_exit(1);
3155 }
3156
3207 FLAG_SET_CMDLINE(uintx, OldPLABSize, 8*K); // Note: this is in words
3208
3209 // Enable parallel GC and adaptive generation sizing
3210 FLAG_SET_CMDLINE(bool, UseParallelGC, true);
3211 FLAG_SET_DEFAULT(ParallelGCThreads,
3212 Abstract_VM_Version::parallel_worker_threads());
3213
3214 // Encourage steady state memory management
3215 FLAG_SET_CMDLINE(uintx, ThresholdTolerance, 100);
3216
3217 // This appears to improve mutator locality
3218 FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false);
3219
3220 // Get around early Solaris scheduling bug
3221 // (affinity vs other jobs on system)
3222 // but disallow DR and offlining (5008695).
3223 FLAG_SET_CMDLINE(bool, BindGCTaskThreadsToCPUs, true);
3224
3225 // Need to keep consistency of MaxTenuringThreshold and AlwaysTenure/NeverTenure;
3226 // and the last option wins.
3227 } else if (match_option(option, "-XX:+NeverTenure", &tail)) {
3228 FLAG_SET_CMDLINE(bool, NeverTenure, true);
3229 FLAG_SET_CMDLINE(bool, AlwaysTenure, false);
3230 FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, markOopDesc::max_age + 1);
3231 } else if (match_option(option, "-XX:+AlwaysTenure", &tail)) {
3232 FLAG_SET_CMDLINE(bool, NeverTenure, false);
3233 FLAG_SET_CMDLINE(bool, AlwaysTenure, true);
3234 FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, 0);
3235 } else if (match_option(option, "-XX:MaxTenuringThreshold=", &tail)) {
3236 uintx max_tenuring_thresh = 0;
3237 if(!parse_uintx(tail, &max_tenuring_thresh, 0)) {
3238 jio_fprintf(defaultStream::error_stream(),
3239 "Invalid MaxTenuringThreshold: %s\n", option->optionString);
3240 }
3241 FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, max_tenuring_thresh);
3242
3243 if (MaxTenuringThreshold == 0) {
3244 FLAG_SET_CMDLINE(bool, NeverTenure, false);
3245 FLAG_SET_CMDLINE(bool, AlwaysTenure, true);
3246 } else {
3247 FLAG_SET_CMDLINE(bool, NeverTenure, false);
3248 FLAG_SET_CMDLINE(bool, AlwaysTenure, false);
3249 }
3250 } else if (match_option(option, "-XX:+CMSPermGenSweepingEnabled", &tail) ||
3251 match_option(option, "-XX:-CMSPermGenSweepingEnabled", &tail)) {
3252 jio_fprintf(defaultStream::error_stream(),
3253 "Please use CMSClassUnloadingEnabled in place of "
3254 "CMSPermGenSweepingEnabled in the future\n");
3255 } else if (match_option(option, "-XX:+UseGCTimeLimit", &tail)) {
3256 FLAG_SET_CMDLINE(bool, UseGCOverheadLimit, true);
3257 jio_fprintf(defaultStream::error_stream(),
3258 "Please use -XX:+UseGCOverheadLimit in place of "
3259 "-XX:+UseGCTimeLimit in the future\n");
3260 } else if (match_option(option, "-XX:-UseGCTimeLimit", &tail)) {
3261 FLAG_SET_CMDLINE(bool, UseGCOverheadLimit, false);
3262 jio_fprintf(defaultStream::error_stream(),
3263 "Please use -XX:-UseGCOverheadLimit in place of "
3264 "-XX:-UseGCTimeLimit in the future\n");
3265 // The TLE options are for compatibility with 1.3 and will be
3266 // removed without notice in a future release. These options
3267 // are not to be documented.
3268 } else if (match_option(option, "-XX:MaxTLERatio=", &tail)) {
3269 // No longer used.
3270 } else if (match_option(option, "-XX:+ResizeTLE", &tail)) {
3271 FLAG_SET_CMDLINE(bool, ResizeTLAB, true);
3272 } else if (match_option(option, "-XX:-ResizeTLE", &tail)) {
3273 FLAG_SET_CMDLINE(bool, ResizeTLAB, false);
3274 } else if (match_option(option, "-XX:+PrintTLE", &tail)) {
3275 FLAG_SET_CMDLINE(bool, PrintTLAB, true);
3276 } else if (match_option(option, "-XX:-PrintTLE", &tail)) {
3277 FLAG_SET_CMDLINE(bool, PrintTLAB, false);
3278 } else if (match_option(option, "-XX:TLEFragmentationRatio=", &tail)) {
3279 // No longer used.
3280 } else if (match_option(option, "-XX:TLESize=", &tail)) {
3281 julong long_tlab_size = 0;
3282 ArgsRange errcode = parse_memory_size(tail, &long_tlab_size, 1);
3283 if (errcode != arg_in_range) {
3284 jio_fprintf(defaultStream::error_stream(),
3285 "Invalid TLAB size: %s\n", option->optionString);
3286 describe_range_error(errcode);
3287 return JNI_EINVAL;
3288 }
3289 FLAG_SET_CMDLINE(uintx, TLABSize, long_tlab_size);
3290 } else if (match_option(option, "-XX:TLEThreadRatio=", &tail)) {
3291 // No longer used.
3292 } else if (match_option(option, "-XX:+UseTLE", &tail)) {
3293 FLAG_SET_CMDLINE(bool, UseTLAB, true);
3294 } else if (match_option(option, "-XX:-UseTLE", &tail)) {
3295 FLAG_SET_CMDLINE(bool, UseTLAB, false);
3296 } else if (match_option(option, "-XX:+DisplayVMOutputToStderr", &tail)) {
3297 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, false);
3298 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, true);
3299 } else if (match_option(option, "-XX:+DisplayVMOutputToStdout", &tail)) {
3300 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, false);
3301 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, true);
3302 } else if (match_option(option, "-XX:+ExtendedDTraceProbes", &tail)) {
3303 #if defined(DTRACE_ENABLED)
3304 FLAG_SET_CMDLINE(bool, ExtendedDTraceProbes, true);
3305 FLAG_SET_CMDLINE(bool, DTraceMethodProbes, true);
3306 FLAG_SET_CMDLINE(bool, DTraceAllocProbes, true);
3307 FLAG_SET_CMDLINE(bool, DTraceMonitorProbes, true);
3308 #else // defined(DTRACE_ENABLED)
3309 jio_fprintf(defaultStream::error_stream(),
3310 "ExtendedDTraceProbes flag is not applicable for this configuration\n");
3311 return JNI_EINVAL;
3312 #endif // defined(DTRACE_ENABLED)
3313 #ifdef ASSERT
3314 } else if (match_option(option, "-XX:+FullGCALot", &tail)) {
3315 FLAG_SET_CMDLINE(bool, FullGCALot, true);
3316 // disable scavenge before parallel mark-compact
3317 FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false);
3318 #endif
3319 } else if (match_option(option, "-XX:CMSParPromoteBlocksToClaim=", &tail)) {
3320 julong cms_blocks_to_claim = (julong)atol(tail);
3321 FLAG_SET_CMDLINE(uintx, CMSParPromoteBlocksToClaim, cms_blocks_to_claim);
3322 jio_fprintf(defaultStream::error_stream(),
3380 match_option(option, "-XX:ParallelCMSThreads=", &tail)) {
3381 uintx conc_threads = 0;
3382 if (!parse_uintx(tail, &conc_threads, 1)) {
3383 jio_fprintf(defaultStream::error_stream(),
3384 "Invalid concurrent threads: %s\n", option->optionString);
3385 return JNI_EINVAL;
3386 }
3387 FLAG_SET_CMDLINE(uintx, ConcGCThreads, conc_threads);
3388 } else if (match_option(option, "-XX:MaxDirectMemorySize=", &tail)) {
3389 julong max_direct_memory_size = 0;
3390 ArgsRange errcode = parse_memory_size(tail, &max_direct_memory_size, 0);
3391 if (errcode != arg_in_range) {
3392 jio_fprintf(defaultStream::error_stream(),
3393 "Invalid maximum direct memory size: %s\n",
3394 option->optionString);
3395 describe_range_error(errcode);
3396 return JNI_EINVAL;
3397 }
3398 FLAG_SET_CMDLINE(uintx, MaxDirectMemorySize, max_direct_memory_size);
3399 #if !INCLUDE_MANAGEMENT
3400 } else if (match_option(option, "-XX:+ManagementServer", &tail)) {
3401 jio_fprintf(defaultStream::error_stream(),
3402 "ManagementServer is not supported in this VM.\n");
3403 return JNI_ERR;
3404 #endif // INCLUDE_MANAGEMENT
3405 } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx
3406 // Skip -XX:Flags= since that case has already been handled
3407 if (strncmp(tail, "Flags=", strlen("Flags=")) != 0) {
3408 if (!process_argument(tail, args->ignoreUnrecognized, origin)) {
3409 return JNI_EINVAL;
3410 }
3411 }
3412 // Unknown option
3413 } else if (is_bad_option(option, args->ignoreUnrecognized)) {
3414 return JNI_ERR;
3415 }
3416 }
3417
3418 // PrintSharedArchiveAndExit will turn on
3419 // -Xshare:on
3420 // -XX:+TraceClassPaths
|
122 SystemProperty *Arguments::_java_home = NULL;
123 SystemProperty *Arguments::_java_class_path = NULL;
124 SystemProperty *Arguments::_sun_boot_class_path = NULL;
125
126 char* Arguments::_meta_index_path = NULL;
127 char* Arguments::_meta_index_dir = NULL;
128
129 // Check if head of 'option' matches 'name', and sets 'tail' remaining part of option string
130
131 static bool match_option(const JavaVMOption *option, const char* name,
132 const char** tail) {
133 int len = (int)strlen(name);
134 if (strncmp(option->optionString, name, len) == 0) {
135 *tail = option->optionString + len;
136 return true;
137 } else {
138 return false;
139 }
140 }
141
142 // Return true if any of the strings in null-terminated array 'names' matches.
143 // If tail_allowed is true, then the tail must begin with a colon; otherwise,
144 // the option must match exactly.
145 static bool match_option(const JavaVMOption* option, const char** names, const char** tail,
146 bool tail_allowed) {
147 for (/* empty */; *names != NULL; ++names) {
148 if (match_option(option, *names, tail)) {
149 if (**tail == '\0' || tail_allowed && **tail == ':') {
150 return true;
151 }
152 }
153 }
154 return false;
155 }
156
157 static bool match_option(const JavaVMOption *option, const char* name) {
158 const char* tail = NULL;
159 bool result = match_option(option, name, &tail);
160 if (tail != NULL && *tail == '\0') {
161 return result;
162 } else {
163 return false;
164 }
165 }
166
167 static void logOption(const char* opt) {
168 if (PrintVMOptions) {
169 jio_fprintf(defaultStream::output_stream(), "VM option '%s'\n", opt);
170 }
171 }
172
173 // Process java launcher properties.
174 void Arguments::process_sun_java_launcher_properties(JavaVMInitArgs* args) {
175 // See if sun.java.launcher, sun.java.launcher.is_altjvm or
176 // sun.java.launcher.pid is defined.
177 // Must do this before setting up other system properties,
178 // as some of them may depend on launcher type.
179 for (int index = 0; index < args->nOptions; index++) {
180 const JavaVMOption* option = args->options + index;
181 const char* tail;
182
183 if (match_option(option, "-Dsun.java.launcher=", &tail)) {
184 process_java_launcher_argument(tail, option->extraInfo);
185 continue;
186 }
2584 jio_fprintf(defaultStream::error_stream(),
2585 "Obsolete %s%soption: %s\n", option_type, spacer,
2586 option->optionString);
2587 return false;
2588 } else {
2589 jio_fprintf(defaultStream::error_stream(),
2590 "Unrecognized %s%soption: %s\n", option_type, spacer,
2591 option->optionString);
2592 return true;
2593 }
2594 }
2595
2596 static const char* user_assertion_options[] = {
2597 "-da", "-ea", "-disableassertions", "-enableassertions", 0
2598 };
2599
2600 static const char* system_assertion_options[] = {
2601 "-dsa", "-esa", "-disablesystemassertions", "-enablesystemassertions", 0
2602 };
2603
2604 bool Arguments::parse_uintx(const char* value,
2605 uintx* uintx_arg,
2606 uintx min_size) {
2607
2608 // Check the sign first since atomull() parses only unsigned values.
2609 bool value_is_positive = !(*value == '-');
2610
2611 if (value_is_positive) {
2612 julong n;
2613 bool good_return = atomull(value, &n);
2614 if (good_return) {
2615 bool above_minimum = n >= min_size;
2616 bool value_is_too_large = n > max_uintx;
2617
2618 if (above_minimum && !value_is_too_large) {
2619 *uintx_arg = n;
2620 return true;
2621 }
2622 }
2623 }
2825 jio_fprintf(defaultStream::error_stream(),
2826 "Profiling and debugging agents are not supported in this VM\n");
2827 return JNI_ERR;
2828 }
2829 #endif // !INCLUDE_JVMTI
2830 add_init_agent(name, options, is_absolute_path);
2831 }
2832 // -javaagent
2833 } else if (match_option(option, "-javaagent:", &tail)) {
2834 #if !INCLUDE_JVMTI
2835 jio_fprintf(defaultStream::error_stream(),
2836 "Instrumentation agents are not supported in this VM\n");
2837 return JNI_ERR;
2838 #else
2839 if(tail != NULL) {
2840 char *options = strcpy(NEW_C_HEAP_ARRAY(char, strlen(tail) + 1, mtInternal), tail);
2841 add_init_agent("instrument", options, false);
2842 }
2843 #endif // !INCLUDE_JVMTI
2844 // -Xnoclassgc
2845 } else if (match_option(option, "-Xnoclassgc")) {
2846 FLAG_SET_CMDLINE(bool, ClassUnloading, false);
2847 // -Xconcgc
2848 } else if (match_option(option, "-Xconcgc")) {
2849 FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, true);
2850 // -Xnoconcgc
2851 } else if (match_option(option, "-Xnoconcgc")) {
2852 FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, false);
2853 // -Xbatch
2854 } else if (match_option(option, "-Xbatch")) {
2855 FLAG_SET_CMDLINE(bool, BackgroundCompilation, false);
2856 // -Xmn for compatibility with other JVM vendors
2857 } else if (match_option(option, "-Xmn", &tail)) {
2858 julong long_initial_young_size = 0;
2859 ArgsRange errcode = parse_memory_size(tail, &long_initial_young_size, 1);
2860 if (errcode != arg_in_range) {
2861 jio_fprintf(defaultStream::error_stream(),
2862 "Invalid initial young generation size: %s\n", option->optionString);
2863 describe_range_error(errcode);
2864 return JNI_EINVAL;
2865 }
2866 FLAG_SET_CMDLINE(uintx, MaxNewSize, (uintx)long_initial_young_size);
2867 FLAG_SET_CMDLINE(uintx, NewSize, (uintx)long_initial_young_size);
2868 // -Xms
2869 } else if (match_option(option, "-Xms", &tail)) {
2870 julong long_initial_heap_size = 0;
2871 // an initial heap size of 0 means automatically determine
2872 ArgsRange errcode = parse_memory_size(tail, &long_initial_heap_size, 0);
2873 if (errcode != arg_in_range) {
2874 jio_fprintf(defaultStream::error_stream(),
2979 julong long_NonProfiledCodeHeapSize = 0;
2980
2981 ArgsRange errcode = parse_memory_size(tail, &long_NonProfiledCodeHeapSize, 1);
2982 if (errcode != arg_in_range) {
2983 jio_fprintf(defaultStream::error_stream(),
2984 "Invalid maximum non-profiled code heap size: %s.\n", option->optionString);
2985 return JNI_EINVAL;
2986 }
2987 FLAG_SET_CMDLINE(uintx, NonProfiledCodeHeapSize, (uintx)long_NonProfiledCodeHeapSize);
2988 //-XX:IncreaseFirstTierCompileThresholdAt=
2989 } else if (match_option(option, "-XX:IncreaseFirstTierCompileThresholdAt=", &tail)) {
2990 uintx uint_IncreaseFirstTierCompileThresholdAt = 0;
2991 if (!parse_uintx(tail, &uint_IncreaseFirstTierCompileThresholdAt, 0) || uint_IncreaseFirstTierCompileThresholdAt > 99) {
2992 jio_fprintf(defaultStream::error_stream(),
2993 "Invalid value for IncreaseFirstTierCompileThresholdAt: %s. Should be between 0 and 99.\n",
2994 option->optionString);
2995 return JNI_EINVAL;
2996 }
2997 FLAG_SET_CMDLINE(uintx, IncreaseFirstTierCompileThresholdAt, (uintx)uint_IncreaseFirstTierCompileThresholdAt);
2998 // -green
2999 } else if (match_option(option, "-green")) {
3000 jio_fprintf(defaultStream::error_stream(),
3001 "Green threads support not available\n");
3002 return JNI_EINVAL;
3003 // -native
3004 } else if (match_option(option, "-native")) {
3005 // HotSpot always uses native threads, ignore silently for compatibility
3006 // -Xsqnopause
3007 } else if (match_option(option, "-Xsqnopause")) {
3008 // EVM option, ignore silently for compatibility
3009 // -Xrs
3010 } else if (match_option(option, "-Xrs")) {
3011 // Classic/EVM option, new functionality
3012 FLAG_SET_CMDLINE(bool, ReduceSignalUsage, true);
3013 } else if (match_option(option, "-Xusealtsigs")) {
3014 // change default internal VM signals used - lower case for back compat
3015 FLAG_SET_CMDLINE(bool, UseAltSigs, true);
3016 // -Xoptimize
3017 } else if (match_option(option, "-Xoptimize")) {
3018 // EVM option, ignore silently for compatibility
3019 // -Xprof
3020 } else if (match_option(option, "-Xprof")) {
3021 #if INCLUDE_FPROF
3022 _has_profile = true;
3023 #else // INCLUDE_FPROF
3024 jio_fprintf(defaultStream::error_stream(),
3025 "Flat profiling is not supported in this VM.\n");
3026 return JNI_ERR;
3027 #endif // INCLUDE_FPROF
3028 // -Xconcurrentio
3029 } else if (match_option(option, "-Xconcurrentio")) {
3030 FLAG_SET_CMDLINE(bool, UseLWPSynchronization, true);
3031 FLAG_SET_CMDLINE(bool, BackgroundCompilation, false);
3032 FLAG_SET_CMDLINE(intx, DeferThrSuspendLoopCount, 1);
3033 FLAG_SET_CMDLINE(bool, UseTLAB, false);
3034 FLAG_SET_CMDLINE(uintx, NewSizeThreadIncrease, 16 * K); // 20Kb per thread added to new generation
3035
3036 // -Xinternalversion
3037 } else if (match_option(option, "-Xinternalversion")) {
3038 jio_fprintf(defaultStream::output_stream(), "%s\n",
3039 VM_Version::internal_vm_info_string());
3040 vm_exit(0);
3041 #ifndef PRODUCT
3042 // -Xprintflags
3043 } else if (match_option(option, "-Xprintflags", &tail)) {
3044 CommandLineFlags::printFlags(tty, false);
3045 vm_exit(0);
3046 #endif
3047 // -D
3048 } else if (match_option(option, "-D", &tail)) {
3049 if (!add_property(tail)) {
3050 return JNI_ENOMEM;
3051 }
3052 // Out of the box management support
3053 if (match_option(option, "-Dcom.sun.management", &tail)) {
3054 #if INCLUDE_MANAGEMENT
3055 FLAG_SET_CMDLINE(bool, ManagementServer, true);
3056 #else
3057 jio_fprintf(defaultStream::output_stream(),
3058 "-Dcom.sun.management is not supported in this VM.\n");
3059 return JNI_ERR;
3060 #endif
3061 }
3062 // -Xint
3063 } else if (match_option(option, "-Xint")) {
3064 set_mode_flags(_int);
3065 // -Xmixed
3066 } else if (match_option(option, "-Xmixed")) {
3067 set_mode_flags(_mixed);
3068 // -Xcomp
3069 } else if (match_option(option, "-Xcomp")) {
3070 // for testing the compiler; turn off all flags that inhibit compilation
3071 set_mode_flags(_comp);
3072 // -Xshare:dump
3073 } else if (match_option(option, "-Xshare:dump")) {
3074 FLAG_SET_CMDLINE(bool, DumpSharedSpaces, true);
3075 set_mode_flags(_int); // Prevent compilation, which creates objects
3076 // -Xshare:on
3077 } else if (match_option(option, "-Xshare:on")) {
3078 FLAG_SET_CMDLINE(bool, UseSharedSpaces, true);
3079 FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true);
3080 // -Xshare:auto
3081 } else if (match_option(option, "-Xshare:auto")) {
3082 FLAG_SET_CMDLINE(bool, UseSharedSpaces, true);
3083 FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false);
3084 // -Xshare:off
3085 } else if (match_option(option, "-Xshare:off")) {
3086 FLAG_SET_CMDLINE(bool, UseSharedSpaces, false);
3087 FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false);
3088 // -Xverify
3089 } else if (match_option(option, "-Xverify", &tail)) {
3090 if (strcmp(tail, ":all") == 0 || strcmp(tail, "") == 0) {
3091 FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, true);
3092 FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, true);
3093 } else if (strcmp(tail, ":remote") == 0) {
3094 FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, false);
3095 FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, true);
3096 } else if (strcmp(tail, ":none") == 0) {
3097 FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, false);
3098 FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, false);
3099 } else if (is_bad_option(option, args->ignoreUnrecognized, "verification")) {
3100 return JNI_EINVAL;
3101 }
3102 // -Xdebug
3103 } else if (match_option(option, "-Xdebug")) {
3104 // note this flag has been used, then ignore
3105 set_xdebug_mode(true);
3106 // -Xnoagent
3107 } else if (match_option(option, "-Xnoagent")) {
3108 // For compatibility with classic. HotSpot refuses to load the old style agent.dll.
3109 } else if (match_option(option, "-Xboundthreads")) {
3110 // Bind user level threads to kernel threads (Solaris only)
3111 FLAG_SET_CMDLINE(bool, UseBoundThreads, true);
3112 } else if (match_option(option, "-Xloggc:", &tail)) {
3113 // Redirect GC output to the file. -Xloggc:<filename>
3114 // ostream_init_log(), when called will use this filename
3115 // to initialize a fileStream.
3116 _gc_log_filename = os::strdup_check_oom(tail);
3117 if (!is_filename_valid(_gc_log_filename)) {
3118 jio_fprintf(defaultStream::output_stream(),
3119 "Invalid file name for use with -Xloggc: Filename can only contain the "
3120 "characters [A-Z][a-z][0-9]-_.%%[p|t] but it has been %s\n"
3121 "Note %%p or %%t can only be used once\n", _gc_log_filename);
3122 return JNI_EINVAL;
3123 }
3124 FLAG_SET_CMDLINE(bool, PrintGC, true);
3125 FLAG_SET_CMDLINE(bool, PrintGCTimeStamps, true);
3126
3127 // JNI hooks
3128 } else if (match_option(option, "-Xcheck", &tail)) {
3129 if (!strcmp(tail, ":jni")) {
3130 #if !INCLUDE_JNI_CHECK
3131 warning("JNI CHECKING is not supported in this VM");
3132 #else
3133 CheckJNICalls = true;
3134 #endif // INCLUDE_JNI_CHECK
3135 } else if (is_bad_option(option, args->ignoreUnrecognized,
3136 "check")) {
3137 return JNI_EINVAL;
3138 }
3139 } else if (match_option(option, "vfprintf")) {
3140 _vfprintf_hook = CAST_TO_FN_PTR(vfprintf_hook_t, option->extraInfo);
3141 } else if (match_option(option, "exit")) {
3142 _exit_hook = CAST_TO_FN_PTR(exit_hook_t, option->extraInfo);
3143 } else if (match_option(option, "abort")) {
3144 _abort_hook = CAST_TO_FN_PTR(abort_hook_t, option->extraInfo);
3145 // -XX:+AggressiveHeap
3146 } else if (match_option(option, "-XX:+AggressiveHeap")) {
3147
3148 // This option inspects the machine and attempts to set various
3149 // parameters to be optimal for long-running, memory allocation
3150 // intensive jobs. It is intended for machines with large
3151 // amounts of cpu and memory.
3152
3153 // initHeapSize is needed since _initial_heap_size is 4 bytes on a 32 bit
3154 // VM, but we may not be able to represent the total physical memory
3155 // available (like having 8gb of memory on a box but using a 32bit VM).
3156 // Thus, we need to make sure we're using a julong for intermediate
3157 // calculations.
3158 julong initHeapSize;
3159 julong total_memory = os::physical_memory();
3160
3161 if (total_memory < (julong)256*M) {
3162 jio_fprintf(defaultStream::error_stream(),
3163 "You need at least 256mb of memory to use -XX:+AggressiveHeap\n");
3164 vm_exit(1);
3165 }
3166
3217 FLAG_SET_CMDLINE(uintx, OldPLABSize, 8*K); // Note: this is in words
3218
3219 // Enable parallel GC and adaptive generation sizing
3220 FLAG_SET_CMDLINE(bool, UseParallelGC, true);
3221 FLAG_SET_DEFAULT(ParallelGCThreads,
3222 Abstract_VM_Version::parallel_worker_threads());
3223
3224 // Encourage steady state memory management
3225 FLAG_SET_CMDLINE(uintx, ThresholdTolerance, 100);
3226
3227 // This appears to improve mutator locality
3228 FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false);
3229
3230 // Get around early Solaris scheduling bug
3231 // (affinity vs other jobs on system)
3232 // but disallow DR and offlining (5008695).
3233 FLAG_SET_CMDLINE(bool, BindGCTaskThreadsToCPUs, true);
3234
3235 // Need to keep consistency of MaxTenuringThreshold and AlwaysTenure/NeverTenure;
3236 // and the last option wins.
3237 } else if (match_option(option, "-XX:+NeverTenure")) {
3238 FLAG_SET_CMDLINE(bool, NeverTenure, true);
3239 FLAG_SET_CMDLINE(bool, AlwaysTenure, false);
3240 FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, markOopDesc::max_age + 1);
3241 } else if (match_option(option, "-XX:+AlwaysTenure")) {
3242 FLAG_SET_CMDLINE(bool, NeverTenure, false);
3243 FLAG_SET_CMDLINE(bool, AlwaysTenure, true);
3244 FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, 0);
3245 } else if (match_option(option, "-XX:MaxTenuringThreshold=", &tail)) {
3246 uintx max_tenuring_thresh = 0;
3247 if(!parse_uintx(tail, &max_tenuring_thresh, 0)) {
3248 jio_fprintf(defaultStream::error_stream(),
3249 "Invalid MaxTenuringThreshold: %s\n", option->optionString);
3250 }
3251 FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, max_tenuring_thresh);
3252
3253 if (MaxTenuringThreshold == 0) {
3254 FLAG_SET_CMDLINE(bool, NeverTenure, false);
3255 FLAG_SET_CMDLINE(bool, AlwaysTenure, true);
3256 } else {
3257 FLAG_SET_CMDLINE(bool, NeverTenure, false);
3258 FLAG_SET_CMDLINE(bool, AlwaysTenure, false);
3259 }
3260 } else if (match_option(option, "-XX:+CMSPermGenSweepingEnabled") ||
3261 match_option(option, "-XX:-CMSPermGenSweepingEnabled")) {
3262 jio_fprintf(defaultStream::error_stream(),
3263 "Please use CMSClassUnloadingEnabled in place of "
3264 "CMSPermGenSweepingEnabled in the future\n");
3265 } else if (match_option(option, "-XX:+UseGCTimeLimit")) {
3266 FLAG_SET_CMDLINE(bool, UseGCOverheadLimit, true);
3267 jio_fprintf(defaultStream::error_stream(),
3268 "Please use -XX:+UseGCOverheadLimit in place of "
3269 "-XX:+UseGCTimeLimit in the future\n");
3270 } else if (match_option(option, "-XX:-UseGCTimeLimit")) {
3271 FLAG_SET_CMDLINE(bool, UseGCOverheadLimit, false);
3272 jio_fprintf(defaultStream::error_stream(),
3273 "Please use -XX:-UseGCOverheadLimit in place of "
3274 "-XX:-UseGCTimeLimit in the future\n");
3275 // The TLE options are for compatibility with 1.3 and will be
3276 // removed without notice in a future release. These options
3277 // are not to be documented.
3278 } else if (match_option(option, "-XX:MaxTLERatio=", &tail)) {
3279 // No longer used.
3280 } else if (match_option(option, "-XX:+ResizeTLE")) {
3281 FLAG_SET_CMDLINE(bool, ResizeTLAB, true);
3282 } else if (match_option(option, "-XX:-ResizeTLE")) {
3283 FLAG_SET_CMDLINE(bool, ResizeTLAB, false);
3284 } else if (match_option(option, "-XX:+PrintTLE")) {
3285 FLAG_SET_CMDLINE(bool, PrintTLAB, true);
3286 } else if (match_option(option, "-XX:-PrintTLE")) {
3287 FLAG_SET_CMDLINE(bool, PrintTLAB, false);
3288 } else if (match_option(option, "-XX:TLEFragmentationRatio=", &tail)) {
3289 // No longer used.
3290 } else if (match_option(option, "-XX:TLESize=", &tail)) {
3291 julong long_tlab_size = 0;
3292 ArgsRange errcode = parse_memory_size(tail, &long_tlab_size, 1);
3293 if (errcode != arg_in_range) {
3294 jio_fprintf(defaultStream::error_stream(),
3295 "Invalid TLAB size: %s\n", option->optionString);
3296 describe_range_error(errcode);
3297 return JNI_EINVAL;
3298 }
3299 FLAG_SET_CMDLINE(uintx, TLABSize, long_tlab_size);
3300 } else if (match_option(option, "-XX:TLEThreadRatio=", &tail)) {
3301 // No longer used.
3302 } else if (match_option(option, "-XX:+UseTLE")) {
3303 FLAG_SET_CMDLINE(bool, UseTLAB, true);
3304 } else if (match_option(option, "-XX:-UseTLE")) {
3305 FLAG_SET_CMDLINE(bool, UseTLAB, false);
3306 } else if (match_option(option, "-XX:+DisplayVMOutputToStderr")) {
3307 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, false);
3308 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, true);
3309 } else if (match_option(option, "-XX:+DisplayVMOutputToStdout")) {
3310 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, false);
3311 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, true);
3312 } else if (match_option(option, "-XX:+ExtendedDTraceProbes")) {
3313 #if defined(DTRACE_ENABLED)
3314 FLAG_SET_CMDLINE(bool, ExtendedDTraceProbes, true);
3315 FLAG_SET_CMDLINE(bool, DTraceMethodProbes, true);
3316 FLAG_SET_CMDLINE(bool, DTraceAllocProbes, true);
3317 FLAG_SET_CMDLINE(bool, DTraceMonitorProbes, true);
3318 #else // defined(DTRACE_ENABLED)
3319 jio_fprintf(defaultStream::error_stream(),
3320 "ExtendedDTraceProbes flag is not applicable for this configuration\n");
3321 return JNI_EINVAL;
3322 #endif // defined(DTRACE_ENABLED)
3323 #ifdef ASSERT
3324 } else if (match_option(option, "-XX:+FullGCALot", &tail)) {
3325 FLAG_SET_CMDLINE(bool, FullGCALot, true);
3326 // disable scavenge before parallel mark-compact
3327 FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false);
3328 #endif
3329 } else if (match_option(option, "-XX:CMSParPromoteBlocksToClaim=", &tail)) {
3330 julong cms_blocks_to_claim = (julong)atol(tail);
3331 FLAG_SET_CMDLINE(uintx, CMSParPromoteBlocksToClaim, cms_blocks_to_claim);
3332 jio_fprintf(defaultStream::error_stream(),
3390 match_option(option, "-XX:ParallelCMSThreads=", &tail)) {
3391 uintx conc_threads = 0;
3392 if (!parse_uintx(tail, &conc_threads, 1)) {
3393 jio_fprintf(defaultStream::error_stream(),
3394 "Invalid concurrent threads: %s\n", option->optionString);
3395 return JNI_EINVAL;
3396 }
3397 FLAG_SET_CMDLINE(uintx, ConcGCThreads, conc_threads);
3398 } else if (match_option(option, "-XX:MaxDirectMemorySize=", &tail)) {
3399 julong max_direct_memory_size = 0;
3400 ArgsRange errcode = parse_memory_size(tail, &max_direct_memory_size, 0);
3401 if (errcode != arg_in_range) {
3402 jio_fprintf(defaultStream::error_stream(),
3403 "Invalid maximum direct memory size: %s\n",
3404 option->optionString);
3405 describe_range_error(errcode);
3406 return JNI_EINVAL;
3407 }
3408 FLAG_SET_CMDLINE(uintx, MaxDirectMemorySize, max_direct_memory_size);
3409 #if !INCLUDE_MANAGEMENT
3410 } else if (match_option(option, "-XX:+ManagementServer")) {
3411 jio_fprintf(defaultStream::error_stream(),
3412 "ManagementServer is not supported in this VM.\n");
3413 return JNI_ERR;
3414 #endif // INCLUDE_MANAGEMENT
3415 } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx
3416 // Skip -XX:Flags= since that case has already been handled
3417 if (strncmp(tail, "Flags=", strlen("Flags=")) != 0) {
3418 if (!process_argument(tail, args->ignoreUnrecognized, origin)) {
3419 return JNI_EINVAL;
3420 }
3421 }
3422 // Unknown option
3423 } else if (is_bad_option(option, args->ignoreUnrecognized)) {
3424 return JNI_ERR;
3425 }
3426 }
3427
3428 // PrintSharedArchiveAndExit will turn on
3429 // -Xshare:on
3430 // -XX:+TraceClassPaths
|