src/hotspot/share/services/management.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File
*** old/src/hotspot/share/services/management.cpp	Thu Apr  5 12:03:41 2018
--- new/src/hotspot/share/services/management.cpp	Thu Apr  5 12:03:41 2018

*** 864,877 **** --- 864,877 ---- 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]; // Exclude the locked (diagnostic, experimental) flags if (flag->is_unlocked() || flag->is_unlocker()) { count++; } }
*** 1417,1434 **** --- 1417,1434 ---- 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; // allocate a temp array objArrayOop r = oopFactory::new_objArray(SystemDictionary::String_klass(), nFlags, CHECK_0); objArrayHandle flags_ah(THREAD, r); int num_entries = 0; for (int i = 0; i < nFlags; i++) { ! JVMFlag* flag = &JVMFlag::flags[i]; // Exclude notproduct and develop flags in product builds. if (flag->is_constant_in_binary()) { continue; } // Exclude the locked (experimental, diagnostic) flags
*** 1452,1462 **** --- 1452,1462 ---- JVM_END // 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, JVMFlag *flag, TRAPS) { Handle flag_name; if (name() == NULL) { flag_name = java_lang_String::create_from_str(flag->_name, CHECK_false); } else { flag_name = name;
*** 1497,1525 **** --- 1497,1525 ---- } global->writeable = flag->is_writeable(); global->external = flag->is_external(); switch (flag->get_origin()) { ! case JVMFlag::DEFAULT: global->origin = JMM_VMGLOBAL_ORIGIN_DEFAULT; break; ! case JVMFlag::COMMAND_LINE: global->origin = JMM_VMGLOBAL_ORIGIN_COMMAND_LINE; break; ! case JVMFlag::ENVIRON_VAR: global->origin = JMM_VMGLOBAL_ORIGIN_ENVIRON_VAR; break; ! case JVMFlag::CONFIG_FILE: global->origin = JMM_VMGLOBAL_ORIGIN_CONFIG_FILE; break; ! case JVMFlag::MANAGEMENT: global->origin = JMM_VMGLOBAL_ORIGIN_MANAGEMENT; break; ! case JVMFlag::ERGONOMIC: global->origin = JMM_VMGLOBAL_ORIGIN_ERGONOMIC; break; ! case JVMFlag::ATTACH_ON_DEMAND: global->origin = JMM_VMGLOBAL_ORIGIN_ATTACH_ON_DEMAND; break; default: global->origin = JMM_VMGLOBAL_ORIGIN_OTHER; }
*** 1529,1539 **** --- 1529,1539 ---- // Fill globals array of count length with jmmVMGlobal entries // specified by names. If names == NULL, fill globals array // with all Flags. Return value is number of entries // created in globals. ! // If a JVMFlag with a given name in an array element does not // exist, globals[i].name will be set to NULL. JVM_ENTRY(jint, jmm_GetVMGlobals(JNIEnv *env, jobjectArray names, jmmVMGlobal *globals, jint count))
*** 1564,1574 **** --- 1564,1574 ---- THROW_(vmSymbols::java_lang_NullPointerException(), 0); } Handle sh(THREAD, s); char* str = java_lang_String::as_utf8_string(s); ! JVMFlag* flag = JVMFlag::find_flag(str, strlen(str)); if (flag != NULL && add_global_entry(env, sh, &globals[i], flag, THREAD)) { num_entries++; } else { globals[i].name = NULL;
*** 1577,1591 **** --- 1577,1591 ---- 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]; // Exclude notproduct and develop flags in product builds. if (flag->is_constant_in_binary()) { continue; } // Exclude the locked (diagnostic, experimental) flags
*** 1607,1629 **** --- 1607,1629 ---- "The flag name cannot be null."); } char* name = java_lang_String::as_utf8_string(fn); FormatBuffer<80> error_msg("%s", ""); ! int succeed = WriteableFlags::set_flag(name, new_value, JVMFlag::MANAGEMENT, error_msg); ! if (succeed != JVMFlag::SUCCESS) { ! if (succeed == JVMFlag::MISSING_VALUE) { // missing value causes NPE to be thrown THROW(vmSymbols::java_lang_NullPointerException()); } else { // all the other errors are reported as IAE with the appropriate error message THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), error_msg.buffer()); } } ! assert(succeed == JVMFlag::SUCCESS, "Setting flag should succeed"); JVM_END class ThreadTimesClosure: public ThreadClosure { private: objArrayHandle _names_strings;

src/hotspot/share/services/management.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File