< prev index next >
src/hotspot/share/services/management.cpp
Print this page
@@ -852,14 +852,13 @@
return vmtcc.count();
}
static jint get_num_flags() {
// last flag entry is always NULL, so subtract 1
- int nFlags = (int) JVMFlag::numFlags - 1;
int count = 0;
- for (int i = 0; i < nFlags; i++) {
- JVMFlag* flag = &JVMFlag::flags[i];
+ JVMFlag* flag;
+ JVMFLAG_FOR_EACH(flag) {
// Exclude the locked (diagnostic, experimental) flags
if (flag->is_unlocked() || flag->is_unlocker()) {
count++;
}
}
@@ -1396,26 +1395,25 @@
return -1;
JVM_END
// Returns a String array of all VM global flag names
JVM_ENTRY(jobjectArray, jmm_GetVMGlobalNames(JNIEnv *env))
- // last flag entry is always NULL, so subtract 1
- int nFlags = (int) JVMFlag::numFlags - 1;
+ int nFlags = JVMFlag::num_flags();
// allocate a temp array
objArrayOop r = oopFactory::new_objArray(SystemDictionary::String_klass(),
nFlags, CHECK_NULL);
objArrayHandle flags_ah(THREAD, r);
int num_entries = 0;
- for (int i = 0; i < nFlags; i++) {
- JVMFlag* flag = &JVMFlag::flags[i];
+ JVMFlag* flag;
+ JVMFLAG_FOR_EACH(flag) {
// Exclude notproduct and develop flags in product builds.
if (flag->is_constant_in_binary()) {
continue;
}
// Exclude the locked (experimental, diagnostic) flags
if (flag->is_unlocked() || flag->is_unlocker()) {
- Handle s = java_lang_String::create_from_str(flag->_name, CHECK_NULL);
+ Handle s = java_lang_String::create_from_str(flag->name(), CHECK_NULL);
flags_ah->obj_at_put(num_entries, s());
num_entries++;
}
}
@@ -1435,11 +1433,11 @@
// 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, JVMFlag *flag, TRAPS) {
Handle flag_name;
if (name() == NULL) {
- flag_name = java_lang_String::create_from_str(flag->_name, CHECK_false);
+ 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());
@@ -1557,15 +1555,17 @@
return num_entries;
} else {
// return all globals if names == NULL
// last flag entry is always NULL, so subtract 1
- int nFlags = (int) JVMFlag::numFlags - 1;
Handle null_h;
int num_entries = 0;
- for (int i = 0; i < nFlags && num_entries < count; i++) {
- JVMFlag* flag = &JVMFlag::flags[i];
+ JVMFlag* flag;
+ JVMFLAG_FOR_EACH(flag) {
+ if (num_entries >= count) {
+ break;
+ }
// Exclude notproduct and develop flags in product builds.
if (flag->is_constant_in_binary()) {
continue;
}
// Exclude the locked (diagnostic, experimental) flags
< prev index next >