mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8204668: Cleanup management of the java.vm.info System property
Reviewed-by: rehn, cjplummer
This commit is contained in:
parent
6b62a66298
commit
ab90071069
4 changed files with 19 additions and 50 deletions
|
@ -374,7 +374,6 @@
|
||||||
template(fillInStackTrace_name, "fillInStackTrace") \
|
template(fillInStackTrace_name, "fillInStackTrace") \
|
||||||
template(getCause_name, "getCause") \
|
template(getCause_name, "getCause") \
|
||||||
template(initCause_name, "initCause") \
|
template(initCause_name, "initCause") \
|
||||||
template(setProperty_name, "setProperty") \
|
|
||||||
template(getProperty_name, "getProperty") \
|
template(getProperty_name, "getProperty") \
|
||||||
template(context_name, "context") \
|
template(context_name, "context") \
|
||||||
template(contextClassLoader_name, "contextClassLoader") \
|
template(contextClassLoader_name, "contextClassLoader") \
|
||||||
|
|
|
@ -116,6 +116,7 @@ SystemProperty *Arguments::_java_library_path = NULL;
|
||||||
SystemProperty *Arguments::_java_home = NULL;
|
SystemProperty *Arguments::_java_home = NULL;
|
||||||
SystemProperty *Arguments::_java_class_path = NULL;
|
SystemProperty *Arguments::_java_class_path = NULL;
|
||||||
SystemProperty *Arguments::_jdk_boot_class_path_append = NULL;
|
SystemProperty *Arguments::_jdk_boot_class_path_append = NULL;
|
||||||
|
SystemProperty *Arguments::_vm_info = NULL;
|
||||||
|
|
||||||
GrowableArray<ModulePatchPath*> *Arguments::_patch_mod_prefix = NULL;
|
GrowableArray<ModulePatchPath*> *Arguments::_patch_mod_prefix = NULL;
|
||||||
PathString *Arguments::_system_boot_class_path = NULL;
|
PathString *Arguments::_system_boot_class_path = NULL;
|
||||||
|
@ -395,9 +396,11 @@ void Arguments::init_system_properties() {
|
||||||
"Java Virtual Machine Specification", false));
|
"Java Virtual Machine Specification", false));
|
||||||
PropertyList_add(&_system_properties, new SystemProperty("java.vm.version", VM_Version::vm_release(), false));
|
PropertyList_add(&_system_properties, new SystemProperty("java.vm.version", VM_Version::vm_release(), false));
|
||||||
PropertyList_add(&_system_properties, new SystemProperty("java.vm.name", VM_Version::vm_name(), false));
|
PropertyList_add(&_system_properties, new SystemProperty("java.vm.name", VM_Version::vm_name(), false));
|
||||||
PropertyList_add(&_system_properties, new SystemProperty("java.vm.info", VM_Version::vm_info_string(), true));
|
|
||||||
PropertyList_add(&_system_properties, new SystemProperty("jdk.debug", VM_Version::jdk_debug_level(), false));
|
PropertyList_add(&_system_properties, new SystemProperty("jdk.debug", VM_Version::jdk_debug_level(), false));
|
||||||
|
|
||||||
|
// Initialize the vm.info now, but it will need updating after argument parsing.
|
||||||
|
_vm_info = new SystemProperty("java.vm.info", VM_Version::vm_info_string(), true);
|
||||||
|
|
||||||
// Following are JVMTI agent writable properties.
|
// Following are JVMTI agent writable properties.
|
||||||
// Properties values are set to NULL and they are
|
// Properties values are set to NULL and they are
|
||||||
// os specific they are initialized in os::init_system_properties_values().
|
// os specific they are initialized in os::init_system_properties_values().
|
||||||
|
@ -417,6 +420,7 @@ void Arguments::init_system_properties() {
|
||||||
PropertyList_add(&_system_properties, _java_home);
|
PropertyList_add(&_system_properties, _java_home);
|
||||||
PropertyList_add(&_system_properties, _java_class_path);
|
PropertyList_add(&_system_properties, _java_class_path);
|
||||||
PropertyList_add(&_system_properties, _jdk_boot_class_path_append);
|
PropertyList_add(&_system_properties, _jdk_boot_class_path_append);
|
||||||
|
PropertyList_add(&_system_properties, _vm_info);
|
||||||
|
|
||||||
// Set OS specific system properties values
|
// Set OS specific system properties values
|
||||||
os::init_system_properties_values();
|
os::init_system_properties_values();
|
||||||
|
@ -4451,18 +4455,6 @@ void Arguments::PropertyList_unique_add(SystemProperty** plist, const char* k, c
|
||||||
PropertyList_add(plist, k, v, writeable == WriteableProperty, internal == InternalProperty);
|
PropertyList_add(plist, k, v, writeable == WriteableProperty, internal == InternalProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update existing property with new value.
|
|
||||||
void Arguments::PropertyList_update_value(SystemProperty* plist, const char* k, const char* v) {
|
|
||||||
SystemProperty* prop;
|
|
||||||
for (prop = plist; prop != NULL; prop = prop->next()) {
|
|
||||||
if (strcmp(k, prop->key()) == 0) {
|
|
||||||
prop->set_value(v);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assert(false, "invalid property");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copies src into buf, replacing "%%" with "%" and "%p" with pid
|
// Copies src into buf, replacing "%%" with "%" and "%p" with pid
|
||||||
// Returns true if all of the source pointed by src has been copied over to
|
// Returns true if all of the source pointed by src has been copied over to
|
||||||
// the destination buffer pointed by buf. Otherwise, returns false.
|
// the destination buffer pointed by buf. Otherwise, returns false.
|
||||||
|
|
|
@ -291,6 +291,7 @@ class Arguments : AllStatic {
|
||||||
static SystemProperty *_java_home;
|
static SystemProperty *_java_home;
|
||||||
static SystemProperty *_java_class_path;
|
static SystemProperty *_java_class_path;
|
||||||
static SystemProperty *_jdk_boot_class_path_append;
|
static SystemProperty *_jdk_boot_class_path_append;
|
||||||
|
static SystemProperty *_vm_info;
|
||||||
|
|
||||||
// --patch-module=module=<file>(<pathsep><file>)*
|
// --patch-module=module=<file>(<pathsep><file>)*
|
||||||
// Each element contains the associated module name, path
|
// Each element contains the associated module name, path
|
||||||
|
@ -643,6 +644,11 @@ class Arguments : AllStatic {
|
||||||
// Update/Initialize System properties after JDK version number is known
|
// Update/Initialize System properties after JDK version number is known
|
||||||
static void init_version_specific_system_properties();
|
static void init_version_specific_system_properties();
|
||||||
|
|
||||||
|
// Update VM info property - called after argument parsing
|
||||||
|
static void update_vm_info_property(const char* vm_info) {
|
||||||
|
_vm_info->set_value(vm_info);
|
||||||
|
}
|
||||||
|
|
||||||
// Property List manipulation
|
// Property List manipulation
|
||||||
static void PropertyList_add(SystemProperty *element);
|
static void PropertyList_add(SystemProperty *element);
|
||||||
static void PropertyList_add(SystemProperty** plist, SystemProperty *element);
|
static void PropertyList_add(SystemProperty** plist, SystemProperty *element);
|
||||||
|
@ -651,7 +657,6 @@ class Arguments : AllStatic {
|
||||||
static void PropertyList_unique_add(SystemProperty** plist, const char* k, const char* v,
|
static void PropertyList_unique_add(SystemProperty** plist, const char* k, const char* v,
|
||||||
PropertyAppendable append, PropertyWriteable writeable,
|
PropertyAppendable append, PropertyWriteable writeable,
|
||||||
PropertyInternal internal);
|
PropertyInternal internal);
|
||||||
static void PropertyList_update_value(SystemProperty* plist, const char* k, const char* v);
|
|
||||||
static const char* PropertyList_get_value(SystemProperty* plist, const char* key);
|
static const char* PropertyList_get_value(SystemProperty* plist, const char* key);
|
||||||
static const char* PropertyList_get_readable_value(SystemProperty* plist, const char* key);
|
static const char* PropertyList_get_readable_value(SystemProperty* plist, const char* key);
|
||||||
static int PropertyList_count(SystemProperty* pl);
|
static int PropertyList_count(SystemProperty* pl);
|
||||||
|
|
|
@ -1127,35 +1127,6 @@ static void call_postVMInitHook(TRAPS) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void reset_vm_info_property(TRAPS) {
|
|
||||||
// the vm info string
|
|
||||||
ResourceMark rm(THREAD);
|
|
||||||
const char *vm_info = VM_Version::vm_info_string();
|
|
||||||
|
|
||||||
// update the native system property first
|
|
||||||
Arguments::PropertyList_update_value(Arguments::system_properties(), "java.vm.info", vm_info);
|
|
||||||
|
|
||||||
// java.lang.System class
|
|
||||||
Klass* klass = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_System(), true, CHECK);
|
|
||||||
|
|
||||||
// setProperty arguments
|
|
||||||
Handle key_str = java_lang_String::create_from_str("java.vm.info", CHECK);
|
|
||||||
Handle value_str = java_lang_String::create_from_str(vm_info, CHECK);
|
|
||||||
|
|
||||||
// return value
|
|
||||||
JavaValue r(T_OBJECT);
|
|
||||||
|
|
||||||
// public static String setProperty(String key, String value);
|
|
||||||
JavaCalls::call_static(&r,
|
|
||||||
klass,
|
|
||||||
vmSymbols::setProperty_name(),
|
|
||||||
vmSymbols::string_string_string_signature(),
|
|
||||||
key_str,
|
|
||||||
value_str,
|
|
||||||
CHECK);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void JavaThread::allocate_threadObj(Handle thread_group, const char* thread_name,
|
void JavaThread::allocate_threadObj(Handle thread_group, const char* thread_name,
|
||||||
bool daemon, TRAPS) {
|
bool daemon, TRAPS) {
|
||||||
assert(thread_group.not_null(), "thread group should be specified");
|
assert(thread_group.not_null(), "thread group should be specified");
|
||||||
|
@ -3771,6 +3742,14 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
|
||||||
VMThread::execute(&verify_op);
|
VMThread::execute(&verify_op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need this to update the java.vm.info property in case any flags used
|
||||||
|
// to initially define it have been changed. This is needed for both CDS and
|
||||||
|
// AOT, since UseSharedSpaces and UseAOT may be changed after java.vm.info
|
||||||
|
// is initially computed. See Abstract_VM_Version::vm_info_string().
|
||||||
|
// This update must happen before we initialize the java classes, but
|
||||||
|
// after any initialization logic that might modify the flags.
|
||||||
|
Arguments::update_vm_info_property(VM_Version::vm_info_string());
|
||||||
|
|
||||||
Thread* THREAD = Thread::current();
|
Thread* THREAD = Thread::current();
|
||||||
|
|
||||||
// Always call even when there are not JVMTI environments yet, since environments
|
// Always call even when there are not JVMTI environments yet, since environments
|
||||||
|
@ -3782,12 +3761,6 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
|
||||||
|
|
||||||
initialize_java_lang_classes(main_thread, CHECK_JNI_ERR);
|
initialize_java_lang_classes(main_thread, CHECK_JNI_ERR);
|
||||||
|
|
||||||
// We need this to update the java.vm.info property in case any flags used
|
|
||||||
// to initially define it have been changed. This is needed for both CDS and
|
|
||||||
// AOT, since UseSharedSpaces and UseAOT may be changed after java.vm.info
|
|
||||||
// is initially computed. See Abstract_VM_Version::vm_info_string().
|
|
||||||
reset_vm_info_property(CHECK_JNI_ERR);
|
|
||||||
|
|
||||||
quicken_jni_functions();
|
quicken_jni_functions();
|
||||||
|
|
||||||
// No more stub generation allowed after that point.
|
// No more stub generation allowed after that point.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue