src/share/vm/runtime/arguments.cpp

Print this page




1670     }
1671 
1672     // Feed the cache size setting into the JDK
1673     char buffer[1024];
1674     sprintf(buffer, "java.lang.Integer.IntegerCache.high=" INTX_FORMAT, AutoBoxCacheMax);
1675     add_property(buffer);
1676   }
1677   if (AggressiveOpts && FLAG_IS_DEFAULT(BiasedLockingStartupDelay)) {
1678     FLAG_SET_DEFAULT(BiasedLockingStartupDelay, 500);
1679   }
1680 #endif
1681 
1682   if (AggressiveOpts) {
1683 // Sample flag setting code
1684 //    if (FLAG_IS_DEFAULT(EliminateZeroing)) {
1685 //      FLAG_SET_DEFAULT(EliminateZeroing, true);
1686 //    }
1687   }
1688 }
1689 





































1690 //===========================================================================================================
1691 // Parsing of java.compiler property
1692 
1693 void Arguments::process_java_compiler_argument(char* arg) {
1694   // For backwards compatibility, Djava.compiler=NONE or ""
1695   // causes us to switch to -Xint mode UNLESS -Xdebug
1696   // is also specified.
1697   if (strlen(arg) == 0 || strcasecmp(arg, "NONE") == 0) {
1698     set_java_compiler(true);    // "-Djava.compiler[=...]" most recently seen.
1699   }
1700 }
1701 
1702 void Arguments::process_java_launcher_argument(const char* launcher, void* extra_info) {
1703   _sun_java_launcher = strdup(launcher);
1704   if (strcmp("gamma", _sun_java_launcher) == 0) {
1705     _created_by_gamma_launcher = true;
1706   }
1707 }
1708 
1709 bool Arguments::created_by_java_launcher() {


2835                     "Invalid concurrent threads: %s\n", option->optionString);
2836         return JNI_EINVAL;
2837       }
2838       FLAG_SET_CMDLINE(uintx, ConcGCThreads, conc_threads);
2839     } else if (match_option(option, "-XX:MaxDirectMemorySize=", &tail)) {
2840       julong max_direct_memory_size = 0;
2841       ArgsRange errcode = parse_memory_size(tail, &max_direct_memory_size, 0);
2842       if (errcode != arg_in_range) {
2843         jio_fprintf(defaultStream::error_stream(),
2844                     "Invalid maximum direct memory size: %s\n",
2845                     option->optionString);
2846         describe_range_error(errcode);
2847         return JNI_EINVAL;
2848       }
2849       FLAG_SET_CMDLINE(uintx, MaxDirectMemorySize, max_direct_memory_size);
2850     } else if (match_option(option, "-XX:+UseVMInterruptibleIO", &tail)) {
2851       // NOTE! In JDK 9, the UseVMInterruptibleIO flag will completely go
2852       //       away and will cause VM initialization failures!
2853       warning("-XX:+UseVMInterruptibleIO is obsolete and will be removed in a future release.");
2854       FLAG_SET_CMDLINE(bool, UseVMInterruptibleIO, true);












2855 #if !INCLUDE_MANAGEMENT
2856     } else if (match_option(option, "-XX:+ManagementServer", &tail)) {
2857         jio_fprintf(defaultStream::error_stream(),
2858           "ManagementServer is not supported in this VM.\n");
2859         return JNI_ERR;
2860 #endif // INCLUDE_MANAGEMENT
2861     } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx
2862       // Skip -XX:Flags= since that case has already been handled
2863       if (strncmp(tail, "Flags=", strlen("Flags=")) != 0) {
2864         if (!process_argument(tail, args->ignoreUnrecognized, origin)) {
2865           return JNI_EINVAL;
2866         }
2867       }
2868     // Unknown option
2869     } else if (is_bad_option(option, args->ignoreUnrecognized)) {
2870       return JNI_ERR;
2871     }
2872   }
2873 
2874   // Change the default value for flags  which have different default values


3095     }                                                                 \
3096     FLAG_SET_DEFAULT(gc, false);                                      \
3097   }                                                                   \
3098 } while(0)
3099 
3100 #if !INCLUDE_ALL_GCS
3101 static void force_serial_gc() {
3102   FLAG_SET_DEFAULT(UseSerialGC, true);
3103   FLAG_SET_DEFAULT(CMSIncrementalMode, false);  // special CMS suboption
3104   UNSUPPORTED_GC_OPTION(UseG1GC);
3105   UNSUPPORTED_GC_OPTION(UseParallelGC);
3106   UNSUPPORTED_GC_OPTION(UseParallelOldGC);
3107   UNSUPPORTED_GC_OPTION(UseConcMarkSweepGC);
3108   UNSUPPORTED_GC_OPTION(UseParNewGC);
3109 }
3110 #endif // INCLUDE_ALL_GCS
3111 
3112 // Parse entry point called from JNI_CreateJavaVM
3113 
3114 jint Arguments::parse(const JavaVMInitArgs* args) {



3115 
3116   // Sharing support
3117   // Construct the path to the archive
3118   char jvm_path[JVM_MAXPATHLEN];
3119   os::jvm_path(jvm_path, sizeof(jvm_path));
3120   char *end = strrchr(jvm_path, *os::file_separator());
3121   if (end != NULL) *end = '\0';
3122   char *shared_archive_path = NEW_C_HEAP_ARRAY(char, strlen(jvm_path) +
3123       strlen(os::file_separator()) + 20, mtInternal);
3124   if (shared_archive_path == NULL) return JNI_ENOMEM;
3125   strcpy(shared_archive_path, jvm_path);
3126   strcat(shared_archive_path, os::file_separator());
3127   strcat(shared_archive_path, "classes");
3128   strcat(shared_archive_path, ".jsa");
3129   SharedArchivePath = shared_archive_path;
3130 
3131   // Remaining part of option string
3132   const char* tail;
3133 
3134   // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed.




1670     }
1671 
1672     // Feed the cache size setting into the JDK
1673     char buffer[1024];
1674     sprintf(buffer, "java.lang.Integer.IntegerCache.high=" INTX_FORMAT, AutoBoxCacheMax);
1675     add_property(buffer);
1676   }
1677   if (AggressiveOpts && FLAG_IS_DEFAULT(BiasedLockingStartupDelay)) {
1678     FLAG_SET_DEFAULT(BiasedLockingStartupDelay, 500);
1679   }
1680 #endif
1681 
1682   if (AggressiveOpts) {
1683 // Sample flag setting code
1684 //    if (FLAG_IS_DEFAULT(EliminateZeroing)) {
1685 //      FLAG_SET_DEFAULT(EliminateZeroing, true);
1686 //    }
1687   }
1688 }
1689 
1690 void Arguments::process_stackguardpages_option(const char* tail) {
1691   int page_size = os::vm_page_size();
1692 #define convert_page_size_units(_value, _unit1, _unit2) (round_to(align_size_up((_value) * (_unit1), (page_size)), (_unit2)) / (_unit2))
1693 
1694   if (tail == NULL) {
1695     FLAG_SET_DEFAULT(StackYellowPages, convert_page_size_units(StackYellowSize, 1, page_size));
1696     FLAG_SET_DEFAULT(StackRedPages,    convert_page_size_units(StackRedSize,    1, page_size));
1697     FLAG_SET_DEFAULT(StackShadowPages, convert_page_size_units(StackShadowSize, 1, page_size));
1698   } else {
1699     if        (!strncmp(tail, "StackYellowSize=", strlen("StackYellowSize="))) {
1700       FLAG_SET_DEFAULT(StackYellowPages, convert_page_size_units(StackYellowSize, 1, page_size));
1701     } else if (!strncmp(tail, "StackRedSize=",    strlen("StackRedSize="))) {
1702       FLAG_SET_DEFAULT(StackRedPages,    convert_page_size_units(StackRedSize,    1, page_size));
1703     } else if (!strncmp(tail, "StackShadowSize=", strlen("StackShadowSize="))) {
1704       FLAG_SET_DEFAULT(StackShadowPages, convert_page_size_units(StackShadowSize, 1, page_size));
1705     } else
1706     if        (!strncmp(tail, "StackYellowPages=", strlen("StackYellowPages="))) {
1707       FLAG_SET_DEFAULT(StackYellowSize, convert_page_size_units(StackYellowPages, page_size, 1));
1708     } else if (!strncmp(tail, "StackRedPages=",    strlen("StackRedPages="))) {
1709       FLAG_SET_DEFAULT(StackRedSize,    convert_page_size_units(StackRedPages,    page_size, 1));
1710     } else if (!strncmp(tail, "StackShadowPages=", strlen("StackShadowPages="))) {
1711       FLAG_SET_DEFAULT(StackShadowSize, convert_page_size_units(StackShadowPages, page_size, 1));
1712     }
1713   }
1714 
1715   if (StackRedSize <= 0)    FLAG_SET_DEFAULT(StackRedSize,    page_size);
1716   if (StackYellowSize <= 0) FLAG_SET_DEFAULT(StackYellowSize, page_size);
1717   if (StackShadowSize <= 0) FLAG_SET_DEFAULT(StackShadowSize, page_size);
1718 
1719   // Make sure parameter pairs reflect identical size.
1720   if (StackRedPages <= 0)              FLAG_SET_DEFAULT(StackRedPages,    convert_page_size_units(StackRedSize,    1, page_size));
1721   if (StackYellowPages <= 0)           FLAG_SET_DEFAULT(StackYellowPages, convert_page_size_units(StackYellowSize, 1, page_size));
1722   if (StackShadowPages <= 0)           FLAG_SET_DEFAULT(StackShadowPages, convert_page_size_units(StackShadowSize, 1, page_size));
1723 
1724 #undef convert_page_size_units
1725 }
1726 
1727 //===========================================================================================================
1728 // Parsing of java.compiler property
1729 
1730 void Arguments::process_java_compiler_argument(char* arg) {
1731   // For backwards compatibility, Djava.compiler=NONE or ""
1732   // causes us to switch to -Xint mode UNLESS -Xdebug
1733   // is also specified.
1734   if (strlen(arg) == 0 || strcasecmp(arg, "NONE") == 0) {
1735     set_java_compiler(true);    // "-Djava.compiler[=...]" most recently seen.
1736   }
1737 }
1738 
1739 void Arguments::process_java_launcher_argument(const char* launcher, void* extra_info) {
1740   _sun_java_launcher = strdup(launcher);
1741   if (strcmp("gamma", _sun_java_launcher) == 0) {
1742     _created_by_gamma_launcher = true;
1743   }
1744 }
1745 
1746 bool Arguments::created_by_java_launcher() {


2872                     "Invalid concurrent threads: %s\n", option->optionString);
2873         return JNI_EINVAL;
2874       }
2875       FLAG_SET_CMDLINE(uintx, ConcGCThreads, conc_threads);
2876     } else if (match_option(option, "-XX:MaxDirectMemorySize=", &tail)) {
2877       julong max_direct_memory_size = 0;
2878       ArgsRange errcode = parse_memory_size(tail, &max_direct_memory_size, 0);
2879       if (errcode != arg_in_range) {
2880         jio_fprintf(defaultStream::error_stream(),
2881                     "Invalid maximum direct memory size: %s\n",
2882                     option->optionString);
2883         describe_range_error(errcode);
2884         return JNI_EINVAL;
2885       }
2886       FLAG_SET_CMDLINE(uintx, MaxDirectMemorySize, max_direct_memory_size);
2887     } else if (match_option(option, "-XX:+UseVMInterruptibleIO", &tail)) {
2888       // NOTE! In JDK 9, the UseVMInterruptibleIO flag will completely go
2889       //       away and will cause VM initialization failures!
2890       warning("-XX:+UseVMInterruptibleIO is obsolete and will be removed in a future release.");
2891       FLAG_SET_CMDLINE(bool, UseVMInterruptibleIO, true);
2892     } else if (match_option(option, "-XX:StackRedPages", &tail) ||
2893                match_option(option, "-XX:StackShadowPages", &tail) ||
2894                match_option(option, "-XX:StackYellowPages", &tail) ||
2895                match_option(option, "-XX:StackRedSize", &tail) ||
2896                match_option(option, "-XX:StackShadowSize", &tail) ||
2897                match_option(option, "-XX:StackYellowSize", &tail)) {
2898       if (match_option(option, "-XX:", &tail) &&
2899           process_argument(tail, args->ignoreUnrecognized, origin)) {
2900         process_stackguardpages_option(tail);
2901       } else {
2902         return JNI_EINVAL;
2903       }
2904 #if !INCLUDE_MANAGEMENT
2905     } else if (match_option(option, "-XX:+ManagementServer", &tail)) {
2906         jio_fprintf(defaultStream::error_stream(),
2907           "ManagementServer is not supported in this VM.\n");
2908         return JNI_ERR;
2909 #endif // INCLUDE_MANAGEMENT
2910     } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx
2911       // Skip -XX:Flags= since that case has already been handled
2912       if (strncmp(tail, "Flags=", strlen("Flags=")) != 0) {
2913         if (!process_argument(tail, args->ignoreUnrecognized, origin)) {
2914           return JNI_EINVAL;
2915         }
2916       }
2917     // Unknown option
2918     } else if (is_bad_option(option, args->ignoreUnrecognized)) {
2919       return JNI_ERR;
2920     }
2921   }
2922 
2923   // Change the default value for flags  which have different default values


3144     }                                                                 \
3145     FLAG_SET_DEFAULT(gc, false);                                      \
3146   }                                                                   \
3147 } while(0)
3148 
3149 #if !INCLUDE_ALL_GCS
3150 static void force_serial_gc() {
3151   FLAG_SET_DEFAULT(UseSerialGC, true);
3152   FLAG_SET_DEFAULT(CMSIncrementalMode, false);  // special CMS suboption
3153   UNSUPPORTED_GC_OPTION(UseG1GC);
3154   UNSUPPORTED_GC_OPTION(UseParallelGC);
3155   UNSUPPORTED_GC_OPTION(UseParallelOldGC);
3156   UNSUPPORTED_GC_OPTION(UseConcMarkSweepGC);
3157   UNSUPPORTED_GC_OPTION(UseParNewGC);
3158 }
3159 #endif // INCLUDE_ALL_GCS
3160 
3161 // Parse entry point called from JNI_CreateJavaVM
3162 
3163 jint Arguments::parse(const JavaVMInitArgs* args) {
3164 
3165   // Derive and set default values for Stack{Red,Yellow,Shadow}Pages options.
3166   process_stackguardpages_option();
3167 
3168   // Sharing support
3169   // Construct the path to the archive
3170   char jvm_path[JVM_MAXPATHLEN];
3171   os::jvm_path(jvm_path, sizeof(jvm_path));
3172   char *end = strrchr(jvm_path, *os::file_separator());
3173   if (end != NULL) *end = '\0';
3174   char *shared_archive_path = NEW_C_HEAP_ARRAY(char, strlen(jvm_path) +
3175       strlen(os::file_separator()) + 20, mtInternal);
3176   if (shared_archive_path == NULL) return JNI_ENOMEM;
3177   strcpy(shared_archive_path, jvm_path);
3178   strcat(shared_archive_path, os::file_separator());
3179   strcat(shared_archive_path, "classes");
3180   strcat(shared_archive_path, ".jsa");
3181   SharedArchivePath = shared_archive_path;
3182 
3183   // Remaining part of option string
3184   const char* tail;
3185 
3186   // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed.