src/share/vm/runtime/arguments.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
bug_8165634.hs Cdiff src/share/vm/runtime/arguments.cpp
src/share/vm/runtime/arguments.cpp
Print this page
*** 1306,1344 ****
}
return true;
}
- // sets or adds a module name to the jdk.module.addmods property
- bool Arguments::append_to_addmods_property(const char* module_name) {
- const char* key = "jdk.module.addmods";
- const char* old_value = Arguments::get_property(key);
- size_t buf_len = strlen(key) + strlen(module_name) + 2;
- if (old_value != NULL) {
- buf_len += strlen(old_value) + 1;
- }
- char* new_value = AllocateHeap(buf_len, mtArguments);
- if (new_value == NULL) {
- return false;
- }
- if (old_value == NULL) {
- jio_snprintf(new_value, buf_len, "%s=%s", key, module_name);
- } else {
- jio_snprintf(new_value, buf_len, "%s=%s,%s", key, old_value, module_name);
- }
- bool added = add_property(new_value, UnwriteableProperty, InternalProperty);
- FreeHeap(new_value);
- return added;
- }
-
#if INCLUDE_CDS
void Arguments::check_unsupported_dumping_properties() {
assert(DumpSharedSpaces, "this function is only used with -Xshare:dump");
const char* unsupported_properties[5] = { "jdk.module.main",
"jdk.module.path",
"jdk.module.upgrade.path",
! "jdk.module.addmods",
"jdk.module.limitmods" };
const char* unsupported_options[5] = { "-m",
"--module-path",
"--upgrade-module-path",
"--add-modules",
--- 1306,1322 ----
}
return true;
}
#if INCLUDE_CDS
void Arguments::check_unsupported_dumping_properties() {
assert(DumpSharedSpaces, "this function is only used with -Xshare:dump");
const char* unsupported_properties[5] = { "jdk.module.main",
"jdk.module.path",
"jdk.module.upgrade.path",
! "jdk.module.addmods.0",
"jdk.module.limitmods" };
const char* unsupported_options[5] = { "-m",
"--module-path",
"--upgrade-module-path",
"--add-modules",
*** 2564,2575 ****
return false;
}
unsigned int addreads_count = 0;
unsigned int addexports_count = 0;
unsigned int patch_mod_count = 0;
- const char* add_modules_value = NULL;
bool Arguments::create_property(const char* prop_name, const char* prop_value, PropertyInternal internal) {
size_t prop_len = strlen(prop_name) + strlen(prop_value) + 2;
char* property = AllocateHeap(prop_len, mtArguments);
int ret = jio_snprintf(property, prop_len, "%s=%s", prop_name, prop_value);
--- 2542,2553 ----
return false;
}
unsigned int addreads_count = 0;
unsigned int addexports_count = 0;
+ unsigned int addmods_count = 0;
unsigned int patch_mod_count = 0;
bool Arguments::create_property(const char* prop_name, const char* prop_value, PropertyInternal internal) {
size_t prop_len = strlen(prop_name) + strlen(prop_value) + 2;
char* property = AllocateHeap(prop_len, mtArguments);
int ret = jio_snprintf(property, prop_len, "%s=%s", prop_name, prop_value);
*** 2819,2829 ****
} else if (match_option(option, "--add-exports=", &tail)) {
if (!create_numbered_property("jdk.module.addexports", tail, addexports_count++)) {
return JNI_ENOMEM;
}
} else if (match_option(option, "--add-modules=", &tail)) {
! add_modules_value = tail;
} else if (match_option(option, "--limit-modules=", &tail)) {
if (!create_property("jdk.module.limitmods", tail, InternalProperty)) {
return JNI_ENOMEM;
}
} else if (match_option(option, "--module-path=", &tail)) {
--- 2797,2809 ----
} else if (match_option(option, "--add-exports=", &tail)) {
if (!create_numbered_property("jdk.module.addexports", tail, addexports_count++)) {
return JNI_ENOMEM;
}
} else if (match_option(option, "--add-modules=", &tail)) {
! if (!create_numbered_property("jdk.module.addmods", tail, addmods_count++)) {
! return JNI_ENOMEM;
! }
} else if (match_option(option, "--limit-modules=", &tail)) {
if (!create_property("jdk.module.limitmods", tail, InternalProperty)) {
return JNI_ENOMEM;
}
} else if (match_option(option, "--module-path=", &tail)) {
*** 2871,2881 ****
#else
if (tail != NULL) {
char *options = strcpy(NEW_C_HEAP_ARRAY(char, strlen(tail) + 1, mtArguments), tail);
add_init_agent("instrument", options, false);
// java agents need module java.instrument
! if (!Arguments::append_to_addmods_property("java.instrument")) {
return JNI_ENOMEM;
}
}
#endif // !INCLUDE_JVMTI
// -Xnoclassgc
--- 2851,2861 ----
#else
if (tail != NULL) {
char *options = strcpy(NEW_C_HEAP_ARRAY(char, strlen(tail) + 1, mtArguments), tail);
add_init_agent("instrument", options, false);
// java agents need module java.instrument
! if (!create_numbered_property("jdk.module.addmods", "java.instrument", addmods_count++)) {
return JNI_ENOMEM;
}
}
#endif // !INCLUDE_JVMTI
// -Xnoclassgc
*** 3147,3157 ****
#if INCLUDE_MANAGEMENT
if (FLAG_SET_CMDLINE(bool, ManagementServer, true) != Flag::SUCCESS) {
return JNI_EINVAL;
}
// management agent in module java.management
! if (!Arguments::append_to_addmods_property("java.management")) {
return JNI_ENOMEM;
}
#else
jio_fprintf(defaultStream::output_stream(),
"-Dcom.sun.management is not supported in this VM.\n");
--- 3127,3137 ----
#if INCLUDE_MANAGEMENT
if (FLAG_SET_CMDLINE(bool, ManagementServer, true) != Flag::SUCCESS) {
return JNI_EINVAL;
}
// management agent in module java.management
! if (!create_numbered_property("jdk.module.addmods", "java.management", addmods_count++)) {
return JNI_ENOMEM;
}
#else
jio_fprintf(defaultStream::output_stream(),
"-Dcom.sun.management is not supported in this VM.\n");
*** 3558,3576 ****
"Use -classpath instead.\n.");
os::closedir(dir);
return JNI_ERR;
}
- // Append the value of the last --add-modules option specified on the command line.
- // This needs to be done here, to prevent overwriting possible values written
- // to the jdk.module.addmods property by -javaagent and other options.
- if (add_modules_value != NULL) {
- if (!append_to_addmods_property(add_modules_value)) {
- return JNI_ENOMEM;
- }
- }
-
// This must be done after all arguments have been processed.
// java_compiler() true means set to "NONE" or empty.
if (java_compiler() && !xdebug_mode()) {
// For backwards compatibility, we switch to interpreted mode if
// -Djava.compiler="NONE" or "" is specified AND "-Xdebug" was
--- 3538,3547 ----
*** 3615,3625 ****
// Tiered compilation is undefined.
UNSUPPORTED_OPTION(TieredCompilation);
#endif
#if INCLUDE_JVMCI
! if (EnableJVMCI && !append_to_addmods_property("jdk.vm.ci")) {
return JNI_ENOMEM;
}
#endif
// If we are running in a headless jre, force java.awt.headless property
--- 3586,3597 ----
// Tiered compilation is undefined.
UNSUPPORTED_OPTION(TieredCompilation);
#endif
#if INCLUDE_JVMCI
! if (EnableJVMCI &&
! !create_numbered_property("jdk.module.addmods", "jdk.vm.ci", addmods_count++)) {
return JNI_ENOMEM;
}
#endif
// If we are running in a headless jre, force java.awt.headless property
src/share/vm/runtime/arguments.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File