mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
6898160: Need serviceability support for new vm argument type 'uint64_t'
Add serviceability support for uint64_t. Flags of unknown type assert in debug builds and are ignored in product builds. Reviewed-by: never, xlu, mchung, dcubed
This commit is contained in:
parent
f5e722511a
commit
e38fa6385f
3 changed files with 58 additions and 21 deletions
|
@ -1507,16 +1507,17 @@ JVM_ENTRY(jobjectArray, jmm_GetVMGlobalNames(JNIEnv *env))
|
|||
return (jobjectArray)JNIHandles::make_local(env, flags_ah());
|
||||
JVM_END
|
||||
|
||||
// utility function used by jmm_GetVMGlobals
|
||||
void add_global_entry(JNIEnv* env, Handle name, jmmVMGlobal *global, Flag *flag, TRAPS) {
|
||||
// Utility function used by jmm_GetVMGlobals. Returns false if flag type
|
||||
// can't be determined, true otherwise. If false is returned, then *global
|
||||
// will be incomplete and invalid.
|
||||
bool add_global_entry(JNIEnv* env, Handle name, jmmVMGlobal *global, Flag *flag, TRAPS) {
|
||||
Handle flag_name;
|
||||
if (name() == NULL) {
|
||||
flag_name = java_lang_String::create_from_str(flag->name, CHECK);
|
||||
flag_name = java_lang_String::create_from_str(flag->name, CHECK_false);
|
||||
} else {
|
||||
flag_name = name;
|
||||
}
|
||||
global->name = (jstring)JNIHandles::make_local(env, flag_name());
|
||||
global->type = JMM_VMGLOBAL_TYPE_UNKNOWN;
|
||||
|
||||
if (flag->is_bool()) {
|
||||
global->value.z = flag->get_bool() ? JNI_TRUE : JNI_FALSE;
|
||||
|
@ -1527,10 +1528,17 @@ void add_global_entry(JNIEnv* env, Handle name, jmmVMGlobal *global, Flag *flag,
|
|||
} else if (flag->is_uintx()) {
|
||||
global->value.j = (jlong)flag->get_uintx();
|
||||
global->type = JMM_VMGLOBAL_TYPE_JLONG;
|
||||
} else if (flag->is_uint64_t()) {
|
||||
global->value.j = (jlong)flag->get_uint64_t();
|
||||
global->type = JMM_VMGLOBAL_TYPE_JLONG;
|
||||
} else if (flag->is_ccstr()) {
|
||||
Handle str = java_lang_String::create_from_str(flag->get_ccstr(), CHECK);
|
||||
Handle str = java_lang_String::create_from_str(flag->get_ccstr(), CHECK_false);
|
||||
global->value.l = (jobject)JNIHandles::make_local(env, str());
|
||||
global->type = JMM_VMGLOBAL_TYPE_JSTRING;
|
||||
} else {
|
||||
global->type = JMM_VMGLOBAL_TYPE_UNKNOWN;
|
||||
assert(false, "Unsupported VMGlobal Type");
|
||||
return false;
|
||||
}
|
||||
|
||||
global->writeable = flag->is_writeable();
|
||||
|
@ -1557,6 +1565,8 @@ void add_global_entry(JNIEnv* env, Handle name, jmmVMGlobal *global, Flag *flag,
|
|||
default:
|
||||
global->origin = JMM_VMGLOBAL_ORIGIN_OTHER;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Fill globals array of count length with jmmVMGlobal entries
|
||||
|
@ -1599,8 +1609,8 @@ JVM_ENTRY(jint, jmm_GetVMGlobals(JNIEnv *env,
|
|||
Handle sh(THREAD, s);
|
||||
char* str = java_lang_String::as_utf8_string(s);
|
||||
Flag* flag = Flag::find_flag(str, strlen(str));
|
||||
if (flag != NULL) {
|
||||
add_global_entry(env, sh, &globals[i], flag, THREAD);
|
||||
if (flag != NULL &&
|
||||
add_global_entry(env, sh, &globals[i], flag, THREAD)) {
|
||||
num_entries++;
|
||||
} else {
|
||||
globals[i].name = NULL;
|
||||
|
@ -1617,8 +1627,8 @@ JVM_ENTRY(jint, jmm_GetVMGlobals(JNIEnv *env,
|
|||
for (int i = 0; i < nFlags && num_entries < count; i++) {
|
||||
Flag* flag = &Flag::flags[i];
|
||||
// Exclude the locked (diagnostic, experimental) flags
|
||||
if (flag->is_unlocked() || flag->is_unlocker()) {
|
||||
add_global_entry(env, null_h, &globals[num_entries], flag, THREAD);
|
||||
if ((flag->is_unlocked() || flag->is_unlocker()) &&
|
||||
add_global_entry(env, null_h, &globals[num_entries], flag, THREAD)) {
|
||||
num_entries++;
|
||||
}
|
||||
}
|
||||
|
@ -1650,11 +1660,14 @@ JVM_ENTRY(void, jmm_SetVMGlobal(JNIEnv *env, jstring flag_name, jvalue new_value
|
|||
bool bvalue = (new_value.z == JNI_TRUE ? true : false);
|
||||
succeed = CommandLineFlags::boolAtPut(name, &bvalue, MANAGEMENT);
|
||||
} else if (flag->is_intx()) {
|
||||
intx ivalue = new_value.j;
|
||||
intx ivalue = (intx)new_value.j;
|
||||
succeed = CommandLineFlags::intxAtPut(name, &ivalue, MANAGEMENT);
|
||||
} else if (flag->is_uintx()) {
|
||||
uintx uvalue = new_value.j;
|
||||
uintx uvalue = (uintx)new_value.j;
|
||||
succeed = CommandLineFlags::uintxAtPut(name, &uvalue, MANAGEMENT);
|
||||
} else if (flag->is_uint64_t()) {
|
||||
uint64_t uvalue = (uint64_t)new_value.j;
|
||||
succeed = CommandLineFlags::uint64_tAtPut(name, &uvalue, MANAGEMENT);
|
||||
} else if (flag->is_ccstr()) {
|
||||
oop str = JNIHandles::resolve_external_guard(new_value.l);
|
||||
if (str == NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue