65 # define DEFAULT_VENDOR_URL_BUG VENDOR_URL_VM_BUG
66 #else
67 # define DEFAULT_VENDOR_URL_BUG "http://bugreport.java.com/bugreport/crash.jsp"
68 #endif
69 #define DEFAULT_JAVA_LAUNCHER "generic"
70
71 char* Arguments::_jvm_flags_file = NULL;
72 char** Arguments::_jvm_flags_array = NULL;
73 int Arguments::_num_jvm_flags = 0;
74 char** Arguments::_jvm_args_array = NULL;
75 int Arguments::_num_jvm_args = 0;
76 char* Arguments::_java_command = NULL;
77 SystemProperty* Arguments::_system_properties = NULL;
78 const char* Arguments::_gc_log_filename = NULL;
79 size_t Arguments::_conservative_max_heap_alignment = 0;
80 Arguments::Mode Arguments::_mode = _mixed;
81 bool Arguments::_java_compiler = false;
82 bool Arguments::_xdebug_mode = false;
83 const char* Arguments::_java_vendor_url_bug = DEFAULT_VENDOR_URL_BUG;
84 const char* Arguments::_sun_java_launcher = DEFAULT_JAVA_LAUNCHER;
85 int Arguments::_sun_java_launcher_pid = -1;
86 bool Arguments::_sun_java_launcher_is_altjvm = false;
87
88 // These parameters are reset in method parse_vm_init_args()
89 bool Arguments::_AlwaysCompileLoopMethods = AlwaysCompileLoopMethods;
90 bool Arguments::_UseOnStackReplacement = UseOnStackReplacement;
91 bool Arguments::_BackgroundCompilation = BackgroundCompilation;
92 bool Arguments::_ClipInlining = ClipInlining;
93 intx Arguments::_Tier3InvokeNotifyFreqLog = Tier3InvokeNotifyFreqLog;
94 intx Arguments::_Tier4InvocationThreshold = Tier4InvocationThreshold;
95
96 bool Arguments::_enable_preview = false;
97
98 char* Arguments::SharedArchivePath = NULL;
99 char* Arguments::SharedDynamicArchivePath = NULL;
100
101 AgentLibraryList Arguments::_libraryList;
102 AgentLibraryList Arguments::_agentList;
103
104 // These are not set by the JDK's built-in launchers, but they can be set by
105 // programs that embed the JVM using JNI_CreateJavaVM. See comments around
344 bool Arguments::is_internal_module_property(const char* property) {
345 assert((strncmp(property, "-D", 2) != 0), "Unexpected leading -D");
346 if (strncmp(property, MODULE_PROPERTY_PREFIX, MODULE_PROPERTY_PREFIX_LEN) == 0) {
347 const char* property_suffix = property + MODULE_PROPERTY_PREFIX_LEN;
348 if (matches_property_suffix(property_suffix, ADDEXPORTS, ADDEXPORTS_LEN) ||
349 matches_property_suffix(property_suffix, ADDREADS, ADDREADS_LEN) ||
350 matches_property_suffix(property_suffix, ADDOPENS, ADDOPENS_LEN) ||
351 matches_property_suffix(property_suffix, PATCH, PATCH_LEN) ||
352 matches_property_suffix(property_suffix, ADDMODS, ADDMODS_LEN) ||
353 matches_property_suffix(property_suffix, LIMITMODS, LIMITMODS_LEN) ||
354 matches_property_suffix(property_suffix, PATH, PATH_LEN) ||
355 matches_property_suffix(property_suffix, UPGRADE_PATH, UPGRADE_PATH_LEN)) {
356 return true;
357 }
358 }
359 return false;
360 }
361
362 // Process java launcher properties.
363 void Arguments::process_sun_java_launcher_properties(JavaVMInitArgs* args) {
364 // See if sun.java.launcher, sun.java.launcher.is_altjvm or
365 // sun.java.launcher.pid is defined.
366 // Must do this before setting up other system properties,
367 // as some of them may depend on launcher type.
368 for (int index = 0; index < args->nOptions; index++) {
369 const JavaVMOption* option = args->options + index;
370 const char* tail;
371
372 if (match_option(option, "-Dsun.java.launcher=", &tail)) {
373 process_java_launcher_argument(tail, option->extraInfo);
374 continue;
375 }
376 if (match_option(option, "-Dsun.java.launcher.is_altjvm=", &tail)) {
377 if (strcmp(tail, "true") == 0) {
378 _sun_java_launcher_is_altjvm = true;
379 }
380 continue;
381 }
382 if (match_option(option, "-Dsun.java.launcher.pid=", &tail)) {
383 _sun_java_launcher_pid = atoi(tail);
384 continue;
385 }
386 }
387 }
388
389 // Initialize system properties key and value.
390 void Arguments::init_system_properties() {
391
392 // Set up _system_boot_class_path which is not a property but
393 // relies heavily on argument processing and the jdk.boot.class.path.append
394 // property. It is used to store the underlying system boot class path.
395 _system_boot_class_path = new PathString(NULL);
396
397 PropertyList_add(&_system_properties, new SystemProperty("java.vm.specification.name",
398 "Java Virtual Machine Specification", false));
399 PropertyList_add(&_system_properties, new SystemProperty("java.vm.version", VM_Version::vm_release(), false));
400 PropertyList_add(&_system_properties, new SystemProperty("java.vm.name", VM_Version::vm_name(), false));
401 PropertyList_add(&_system_properties, new SystemProperty("jdk.debug", VM_Version::jdk_debug_level(), false));
402
403 // Initialize the vm.info now, but it will need updating after argument parsing.
404 _vm_info = new SystemProperty("java.vm.info", VM_Version::vm_info_string(), true);
405
1394 const char* value = "";
1395
1396 if (eq == NULL) {
1397 // property doesn't have a value, thus use passed string
1398 key = prop;
1399 } else {
1400 // property have a value, thus extract it and save to the
1401 // allocated string
1402 size_t key_len = eq - prop;
1403 char* tmp_key = AllocateHeap(key_len + 1, mtArguments);
1404
1405 jio_snprintf(tmp_key, key_len + 1, "%s", prop);
1406 key = tmp_key;
1407
1408 value = &prop[key_len + 1];
1409 }
1410
1411 if (strcmp(key, "java.compiler") == 0) {
1412 process_java_compiler_argument(value);
1413 // Record value in Arguments, but let it get passed to Java.
1414 } else if (strcmp(key, "sun.java.launcher.is_altjvm") == 0 ||
1415 strcmp(key, "sun.java.launcher.pid") == 0) {
1416 // sun.java.launcher.is_altjvm and sun.java.launcher.pid property are
1417 // private and are processed in process_sun_java_launcher_properties();
1418 // the sun.java.launcher property is passed on to the java application
1419 } else if (strcmp(key, "sun.boot.library.path") == 0) {
1420 // append is true, writable is true, internal is false
1421 PropertyList_unique_add(&_system_properties, key, value, AppendProperty,
1422 WriteableProperty, ExternalProperty);
1423 } else {
1424 if (strcmp(key, "sun.java.command") == 0) {
1425 char *old_java_command = _java_command;
1426 _java_command = os::strdup_check_oom(value, mtArguments);
1427 if (old_java_command != NULL) {
1428 os::free(old_java_command);
1429 }
1430 } else if (strcmp(key, "java.vendor.url.bug") == 0) {
1431 const char* old_java_vendor_url_bug = _java_vendor_url_bug;
1432 // save it in _java_vendor_url_bug, so JVM fatal error handler can access
1433 // its value without going through the property list or making a Java call.
1434 _java_vendor_url_bug = os::strdup_check_oom(value, mtArguments);
1435 if (old_java_vendor_url_bug != DEFAULT_VENDOR_URL_BUG) {
1436 assert(old_java_vendor_url_bug != NULL, "_java_vendor_url_bug is NULL");
1437 os::free((void *)old_java_vendor_url_bug);
|
65 # define DEFAULT_VENDOR_URL_BUG VENDOR_URL_VM_BUG
66 #else
67 # define DEFAULT_VENDOR_URL_BUG "http://bugreport.java.com/bugreport/crash.jsp"
68 #endif
69 #define DEFAULT_JAVA_LAUNCHER "generic"
70
71 char* Arguments::_jvm_flags_file = NULL;
72 char** Arguments::_jvm_flags_array = NULL;
73 int Arguments::_num_jvm_flags = 0;
74 char** Arguments::_jvm_args_array = NULL;
75 int Arguments::_num_jvm_args = 0;
76 char* Arguments::_java_command = NULL;
77 SystemProperty* Arguments::_system_properties = NULL;
78 const char* Arguments::_gc_log_filename = NULL;
79 size_t Arguments::_conservative_max_heap_alignment = 0;
80 Arguments::Mode Arguments::_mode = _mixed;
81 bool Arguments::_java_compiler = false;
82 bool Arguments::_xdebug_mode = false;
83 const char* Arguments::_java_vendor_url_bug = DEFAULT_VENDOR_URL_BUG;
84 const char* Arguments::_sun_java_launcher = DEFAULT_JAVA_LAUNCHER;
85 bool Arguments::_sun_java_launcher_is_altjvm = false;
86
87 // These parameters are reset in method parse_vm_init_args()
88 bool Arguments::_AlwaysCompileLoopMethods = AlwaysCompileLoopMethods;
89 bool Arguments::_UseOnStackReplacement = UseOnStackReplacement;
90 bool Arguments::_BackgroundCompilation = BackgroundCompilation;
91 bool Arguments::_ClipInlining = ClipInlining;
92 intx Arguments::_Tier3InvokeNotifyFreqLog = Tier3InvokeNotifyFreqLog;
93 intx Arguments::_Tier4InvocationThreshold = Tier4InvocationThreshold;
94
95 bool Arguments::_enable_preview = false;
96
97 char* Arguments::SharedArchivePath = NULL;
98 char* Arguments::SharedDynamicArchivePath = NULL;
99
100 AgentLibraryList Arguments::_libraryList;
101 AgentLibraryList Arguments::_agentList;
102
103 // These are not set by the JDK's built-in launchers, but they can be set by
104 // programs that embed the JVM using JNI_CreateJavaVM. See comments around
343 bool Arguments::is_internal_module_property(const char* property) {
344 assert((strncmp(property, "-D", 2) != 0), "Unexpected leading -D");
345 if (strncmp(property, MODULE_PROPERTY_PREFIX, MODULE_PROPERTY_PREFIX_LEN) == 0) {
346 const char* property_suffix = property + MODULE_PROPERTY_PREFIX_LEN;
347 if (matches_property_suffix(property_suffix, ADDEXPORTS, ADDEXPORTS_LEN) ||
348 matches_property_suffix(property_suffix, ADDREADS, ADDREADS_LEN) ||
349 matches_property_suffix(property_suffix, ADDOPENS, ADDOPENS_LEN) ||
350 matches_property_suffix(property_suffix, PATCH, PATCH_LEN) ||
351 matches_property_suffix(property_suffix, ADDMODS, ADDMODS_LEN) ||
352 matches_property_suffix(property_suffix, LIMITMODS, LIMITMODS_LEN) ||
353 matches_property_suffix(property_suffix, PATH, PATH_LEN) ||
354 matches_property_suffix(property_suffix, UPGRADE_PATH, UPGRADE_PATH_LEN)) {
355 return true;
356 }
357 }
358 return false;
359 }
360
361 // Process java launcher properties.
362 void Arguments::process_sun_java_launcher_properties(JavaVMInitArgs* args) {
363 // See if sun.java.launcher or sun.java.launcher.is_altjvm is defined.
364 // Must do this before setting up other system properties,
365 // as some of them may depend on launcher type.
366 for (int index = 0; index < args->nOptions; index++) {
367 const JavaVMOption* option = args->options + index;
368 const char* tail;
369
370 if (match_option(option, "-Dsun.java.launcher=", &tail)) {
371 process_java_launcher_argument(tail, option->extraInfo);
372 continue;
373 }
374 if (match_option(option, "-Dsun.java.launcher.is_altjvm=", &tail)) {
375 if (strcmp(tail, "true") == 0) {
376 _sun_java_launcher_is_altjvm = true;
377 }
378 continue;
379 }
380 }
381 }
382
383 // Initialize system properties key and value.
384 void Arguments::init_system_properties() {
385
386 // Set up _system_boot_class_path which is not a property but
387 // relies heavily on argument processing and the jdk.boot.class.path.append
388 // property. It is used to store the underlying system boot class path.
389 _system_boot_class_path = new PathString(NULL);
390
391 PropertyList_add(&_system_properties, new SystemProperty("java.vm.specification.name",
392 "Java Virtual Machine Specification", false));
393 PropertyList_add(&_system_properties, new SystemProperty("java.vm.version", VM_Version::vm_release(), false));
394 PropertyList_add(&_system_properties, new SystemProperty("java.vm.name", VM_Version::vm_name(), false));
395 PropertyList_add(&_system_properties, new SystemProperty("jdk.debug", VM_Version::jdk_debug_level(), false));
396
397 // Initialize the vm.info now, but it will need updating after argument parsing.
398 _vm_info = new SystemProperty("java.vm.info", VM_Version::vm_info_string(), true);
399
1388 const char* value = "";
1389
1390 if (eq == NULL) {
1391 // property doesn't have a value, thus use passed string
1392 key = prop;
1393 } else {
1394 // property have a value, thus extract it and save to the
1395 // allocated string
1396 size_t key_len = eq - prop;
1397 char* tmp_key = AllocateHeap(key_len + 1, mtArguments);
1398
1399 jio_snprintf(tmp_key, key_len + 1, "%s", prop);
1400 key = tmp_key;
1401
1402 value = &prop[key_len + 1];
1403 }
1404
1405 if (strcmp(key, "java.compiler") == 0) {
1406 process_java_compiler_argument(value);
1407 // Record value in Arguments, but let it get passed to Java.
1408 } else if (strcmp(key, "sun.java.launcher.is_altjvm") == 0) {
1409 // sun.java.launcher.is_altjvm property is
1410 // private and is processed in process_sun_java_launcher_properties();
1411 // the sun.java.launcher property is passed on to the java application
1412 } else if (strcmp(key, "sun.boot.library.path") == 0) {
1413 // append is true, writable is true, internal is false
1414 PropertyList_unique_add(&_system_properties, key, value, AppendProperty,
1415 WriteableProperty, ExternalProperty);
1416 } else {
1417 if (strcmp(key, "sun.java.command") == 0) {
1418 char *old_java_command = _java_command;
1419 _java_command = os::strdup_check_oom(value, mtArguments);
1420 if (old_java_command != NULL) {
1421 os::free(old_java_command);
1422 }
1423 } else if (strcmp(key, "java.vendor.url.bug") == 0) {
1424 const char* old_java_vendor_url_bug = _java_vendor_url_bug;
1425 // save it in _java_vendor_url_bug, so JVM fatal error handler can access
1426 // its value without going through the property list or making a Java call.
1427 _java_vendor_url_bug = os::strdup_check_oom(value, mtArguments);
1428 if (old_java_vendor_url_bug != DEFAULT_VENDOR_URL_BUG) {
1429 assert(old_java_vendor_url_bug != NULL, "_java_vendor_url_bug is NULL");
1430 os::free((void *)old_java_vendor_url_bug);
|