src/share/vm/runtime/arguments.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File bug_8162412 Sdiff src/share/vm/runtime

src/share/vm/runtime/arguments.cpp

Print this page




 146 static bool match_option(const JavaVMOption* option, const char** names, const char** tail,
 147   bool tail_allowed) {
 148   for (/* empty */; *names != NULL; ++names) {
 149     if (match_option(option, *names, tail)) {
 150       if (**tail == '\0' || tail_allowed && **tail == ':') {
 151         return true;
 152       }
 153     }
 154   }
 155   return false;
 156 }
 157 
 158 static void logOption(const char* opt) {
 159   if (PrintVMOptions) {
 160     jio_fprintf(defaultStream::output_stream(), "VM option '%s'\n", opt);
 161   }
 162 }
 163 
 164 bool needs_module_property_warning = false;
 165 
 166 #define MODULE_PROPERTY_PREFIX "jdk.module"
 167 #define MODULE_PROPERTY_PREFIX_LEN 10
 168 #define MODULE_MAIN_PROPERTY "jdk.module.main"
 169 #define MODULE_MAIN_PROPERTY_LEN 15
 170 
 171 // Return TRUE if option matches property, or property=, or property..
 172 static bool matches_property_prefix(const char* option, const char* property, size_t len) {
 173   return (strncmp(option, property, len) == 0) &&
 174           (option[len] == '=' || option[len] == '.' || option[len] == '\0');
 175 }
 176 
 177 // Return true if the property is either "jdk.module" or starts with "jdk.module.",
 178 // but does not start with "jdk.module.main".
 179 // Return false if jdk.module.main because jdk.module.main and jdk.module.main.class
 180 // are valid non-internal system properties.
 181 // "property" should be passed without the leading "-D".










 182 bool Arguments::is_internal_module_property(const char* property) {
 183   assert((strncmp(property, "-D", 2) != 0), "Unexpected leading -D");
 184   return (matches_property_prefix(property, MODULE_PROPERTY_PREFIX, MODULE_PROPERTY_PREFIX_LEN) &&
 185           !matches_property_prefix(property, MODULE_MAIN_PROPERTY, MODULE_MAIN_PROPERTY_LEN));











 186 }
 187 
 188 // Process java launcher properties.
 189 void Arguments::process_sun_java_launcher_properties(JavaVMInitArgs* args) {
 190   // See if sun.java.launcher, sun.java.launcher.is_altjvm or
 191   // sun.java.launcher.pid is defined.
 192   // Must do this before setting up other system properties,
 193   // as some of them may depend on launcher type.
 194   for (int index = 0; index < args->nOptions; index++) {
 195     const JavaVMOption* option = args->options + index;
 196     const char* tail;
 197 
 198     if (match_option(option, "-Dsun.java.launcher=", &tail)) {
 199       process_java_launcher_argument(tail, option->extraInfo);
 200       continue;
 201     }
 202     if (match_option(option, "-Dsun.java.launcher.is_altjvm=", &tail)) {
 203       if (strcmp(tail, "true") == 0) {
 204         _sun_java_launcher_is_altjvm = true;
 205       }


4270   // Call get_shared_archive_path() here, after possible SharedArchiveFile option got parsed.
4271   SharedArchivePath = get_shared_archive_path();
4272   if (SharedArchivePath == NULL) {
4273     return JNI_ENOMEM;
4274   }
4275 
4276   // Set up VerifySharedSpaces
4277   if (FLAG_IS_DEFAULT(VerifySharedSpaces) && SharedArchiveFile != NULL) {
4278     VerifySharedSpaces = true;
4279   }
4280 
4281   // Delay warning until here so that we've had a chance to process
4282   // the -XX:-PrintWarnings flag
4283   if (needs_hotspotrc_warning) {
4284     warning("%s file is present but has been ignored.  "
4285             "Run with -XX:Flags=%s to load the file.",
4286             hotspotrc, hotspotrc);
4287   }
4288 
4289   if (needs_module_property_warning) {
4290     warning("Ignoring system property options whose names start with '-Djdk.module'."
4291             "  They are reserved for internal use.");
4292   }
4293 
4294 #if defined(_ALLBSD_SOURCE) || defined(AIX)  // UseLargePages is not yet supported on BSD and AIX.
4295   UNSUPPORTED_OPTION(UseLargePages);
4296 #endif
4297 
4298   ArgumentsExt::report_unsupported_options();
4299 
4300 #ifndef PRODUCT
4301   if (TraceBytecodesAt != 0) {
4302     TraceBytecodes = true;
4303   }
4304   if (CountCompiledCalls) {
4305     if (UseCounterDecay) {
4306       warning("UseCounterDecay disabled because CountCalls is set");
4307       UseCounterDecay = false;
4308     }
4309   }
4310 #endif // PRODUCT
4311 




 146 static bool match_option(const JavaVMOption* option, const char** names, const char** tail,
 147   bool tail_allowed) {
 148   for (/* empty */; *names != NULL; ++names) {
 149     if (match_option(option, *names, tail)) {
 150       if (**tail == '\0' || tail_allowed && **tail == ':') {
 151         return true;
 152       }
 153     }
 154   }
 155   return false;
 156 }
 157 
 158 static void logOption(const char* opt) {
 159   if (PrintVMOptions) {
 160     jio_fprintf(defaultStream::output_stream(), "VM option '%s'\n", opt);
 161   }
 162 }
 163 
 164 bool needs_module_property_warning = false;
 165 
 166 #define MODULE_PROPERTY_PREFIX "jdk.module."
 167 #define MODULE_PROPERTY_PREFIX_LEN 11
 168 #define ADDEXPORTS "addexports"
 169 #define ADDEXPORTS_LEN 10
 170 #define ADDREADS "addreads"
 171 #define ADDREADS_LEN 8
 172 #define PATCH "patch"
 173 #define PATCH_LEN 5
 174 #define ADDMODS "addmods"
 175 #define ADDMODS_LEN 7
 176 #define LIMITMODS "limitmods"
 177 #define LIMITMODS_LEN 9
 178 #define PATH "path"
 179 #define PATH_LEN 4
 180 #define UPGRADE_PATH "upgrade.path"
 181 #define UPGRADE_PATH_LEN 12
 182 
 183 // Return TRUE if option matches 'property', or 'property=', or 'property.'.
 184 static bool matches_property_suffix(const char* option, const char* property, size_t len) {
 185   return ((strncmp(option, property, len) == 0) &&
 186           (option[len] == '=' || option[len] == '.' || option[len] == '\0'));
 187 }
 188 
 189 // Return true if property starts with "jdk.module." and its ensuing chars match
 190 // any of the reserved module properties.
 191 // property should be passed without the leading "-D".
 192 bool Arguments::is_internal_module_property(const char* property) {
 193   assert((strncmp(property, "-D", 2) != 0), "Unexpected leading -D");
 194   if  (strncmp(property, MODULE_PROPERTY_PREFIX, MODULE_PROPERTY_PREFIX_LEN) == 0) {
 195     const char* property_suffix = property + MODULE_PROPERTY_PREFIX_LEN;
 196     if (matches_property_suffix(property_suffix, ADDEXPORTS, ADDEXPORTS_LEN) ||
 197         matches_property_suffix(property_suffix, ADDREADS, ADDREADS_LEN) ||
 198         matches_property_suffix(property_suffix, ADDMODS, ADDMODS_LEN) ||
 199         matches_property_suffix(property_suffix, LIMITMODS, LIMITMODS_LEN) ||
 200         matches_property_suffix(property_suffix, PATCH, PATCH_LEN) ||
 201         matches_property_suffix(property_suffix, PATH, PATH_LEN) ||
 202         matches_property_suffix(property_suffix, UPGRADE_PATH, UPGRADE_PATH_LEN)) {
 203       return true;
 204     }
 205   }
 206   return false;
 207 }
 208 
 209 // Process java launcher properties.
 210 void Arguments::process_sun_java_launcher_properties(JavaVMInitArgs* args) {
 211   // See if sun.java.launcher, sun.java.launcher.is_altjvm or
 212   // sun.java.launcher.pid is defined.
 213   // Must do this before setting up other system properties,
 214   // as some of them may depend on launcher type.
 215   for (int index = 0; index < args->nOptions; index++) {
 216     const JavaVMOption* option = args->options + index;
 217     const char* tail;
 218 
 219     if (match_option(option, "-Dsun.java.launcher=", &tail)) {
 220       process_java_launcher_argument(tail, option->extraInfo);
 221       continue;
 222     }
 223     if (match_option(option, "-Dsun.java.launcher.is_altjvm=", &tail)) {
 224       if (strcmp(tail, "true") == 0) {
 225         _sun_java_launcher_is_altjvm = true;
 226       }


4291   // Call get_shared_archive_path() here, after possible SharedArchiveFile option got parsed.
4292   SharedArchivePath = get_shared_archive_path();
4293   if (SharedArchivePath == NULL) {
4294     return JNI_ENOMEM;
4295   }
4296 
4297   // Set up VerifySharedSpaces
4298   if (FLAG_IS_DEFAULT(VerifySharedSpaces) && SharedArchiveFile != NULL) {
4299     VerifySharedSpaces = true;
4300   }
4301 
4302   // Delay warning until here so that we've had a chance to process
4303   // the -XX:-PrintWarnings flag
4304   if (needs_hotspotrc_warning) {
4305     warning("%s file is present but has been ignored.  "
4306             "Run with -XX:Flags=%s to load the file.",
4307             hotspotrc, hotspotrc);
4308   }
4309 
4310   if (needs_module_property_warning) {
4311     warning("Ignoring system property options whose names match the '-Djdk.module.*'."
4312             " names that are reserved for internal use.");
4313   }
4314 
4315 #if defined(_ALLBSD_SOURCE) || defined(AIX)  // UseLargePages is not yet supported on BSD and AIX.
4316   UNSUPPORTED_OPTION(UseLargePages);
4317 #endif
4318 
4319   ArgumentsExt::report_unsupported_options();
4320 
4321 #ifndef PRODUCT
4322   if (TraceBytecodesAt != 0) {
4323     TraceBytecodes = true;
4324   }
4325   if (CountCompiledCalls) {
4326     if (UseCounterDecay) {
4327       warning("UseCounterDecay disabled because CountCalls is set");
4328       UseCounterDecay = false;
4329     }
4330   }
4331 #endif // PRODUCT
4332 


src/share/vm/runtime/arguments.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File