comparison src/share/vm/services/management.cpp @ 12322:72b7e96c1922

8024545: make develop and notproduct flag values available in product builds Reviewed-by: dholmes, kvn
author twisti
date Thu, 26 Sep 2013 12:07:53 -0700
parents a70566600baf
children e4f478e7781b
comparison
equal deleted inserted replaced
12295:1b64d46620a3 12322:72b7e96c1922
1641 nFlags, CHECK_0); 1641 nFlags, CHECK_0);
1642 objArrayHandle flags_ah(THREAD, r); 1642 objArrayHandle flags_ah(THREAD, r);
1643 int num_entries = 0; 1643 int num_entries = 0;
1644 for (int i = 0; i < nFlags; i++) { 1644 for (int i = 0; i < nFlags; i++) {
1645 Flag* flag = &Flag::flags[i]; 1645 Flag* flag = &Flag::flags[i];
1646 // Exclude notproduct and develop flags in product builds.
1647 if (flag->is_constant_in_binary()) {
1648 continue;
1649 }
1646 // Exclude the locked (experimental, diagnostic) flags 1650 // Exclude the locked (experimental, diagnostic) flags
1647 if (flag->is_unlocked() || flag->is_unlocker()) { 1651 if (flag->is_unlocked() || flag->is_unlocker()) {
1648 Handle s = java_lang_String::create_from_str(flag->name, CHECK_0); 1652 Handle s = java_lang_String::create_from_str(flag->_name, CHECK_0);
1649 flags_ah->obj_at_put(num_entries, s()); 1653 flags_ah->obj_at_put(num_entries, s());
1650 num_entries++; 1654 num_entries++;
1651 } 1655 }
1652 } 1656 }
1653 1657
1667 // can't be determined, true otherwise. If false is returned, then *global 1671 // can't be determined, true otherwise. If false is returned, then *global
1668 // will be incomplete and invalid. 1672 // will be incomplete and invalid.
1669 bool add_global_entry(JNIEnv* env, Handle name, jmmVMGlobal *global, Flag *flag, TRAPS) { 1673 bool add_global_entry(JNIEnv* env, Handle name, jmmVMGlobal *global, Flag *flag, TRAPS) {
1670 Handle flag_name; 1674 Handle flag_name;
1671 if (name() == NULL) { 1675 if (name() == NULL) {
1672 flag_name = java_lang_String::create_from_str(flag->name, CHECK_false); 1676 flag_name = java_lang_String::create_from_str(flag->_name, CHECK_false);
1673 } else { 1677 } else {
1674 flag_name = name; 1678 flag_name = name;
1675 } 1679 }
1676 global->name = (jstring)JNIHandles::make_local(env, flag_name()); 1680 global->name = (jstring)JNIHandles::make_local(env, flag_name());
1677 1681
1696 return false; 1700 return false;
1697 } 1701 }
1698 1702
1699 global->writeable = flag->is_writeable(); 1703 global->writeable = flag->is_writeable();
1700 global->external = flag->is_external(); 1704 global->external = flag->is_external();
1701 switch (flag->origin) { 1705 switch (flag->get_origin()) {
1702 case DEFAULT: 1706 case Flag::DEFAULT:
1703 global->origin = JMM_VMGLOBAL_ORIGIN_DEFAULT; 1707 global->origin = JMM_VMGLOBAL_ORIGIN_DEFAULT;
1704 break; 1708 break;
1705 case COMMAND_LINE: 1709 case Flag::COMMAND_LINE:
1706 global->origin = JMM_VMGLOBAL_ORIGIN_COMMAND_LINE; 1710 global->origin = JMM_VMGLOBAL_ORIGIN_COMMAND_LINE;
1707 break; 1711 break;
1708 case ENVIRON_VAR: 1712 case Flag::ENVIRON_VAR:
1709 global->origin = JMM_VMGLOBAL_ORIGIN_ENVIRON_VAR; 1713 global->origin = JMM_VMGLOBAL_ORIGIN_ENVIRON_VAR;
1710 break; 1714 break;
1711 case CONFIG_FILE: 1715 case Flag::CONFIG_FILE:
1712 global->origin = JMM_VMGLOBAL_ORIGIN_CONFIG_FILE; 1716 global->origin = JMM_VMGLOBAL_ORIGIN_CONFIG_FILE;
1713 break; 1717 break;
1714 case MANAGEMENT: 1718 case Flag::MANAGEMENT:
1715 global->origin = JMM_VMGLOBAL_ORIGIN_MANAGEMENT; 1719 global->origin = JMM_VMGLOBAL_ORIGIN_MANAGEMENT;
1716 break; 1720 break;
1717 case ERGONOMIC: 1721 case Flag::ERGONOMIC:
1718 global->origin = JMM_VMGLOBAL_ORIGIN_ERGONOMIC; 1722 global->origin = JMM_VMGLOBAL_ORIGIN_ERGONOMIC;
1719 break; 1723 break;
1720 default: 1724 default:
1721 global->origin = JMM_VMGLOBAL_ORIGIN_OTHER; 1725 global->origin = JMM_VMGLOBAL_ORIGIN_OTHER;
1722 } 1726 }
1779 int nFlags = (int) Flag::numFlags - 1; 1783 int nFlags = (int) Flag::numFlags - 1;
1780 Handle null_h; 1784 Handle null_h;
1781 int num_entries = 0; 1785 int num_entries = 0;
1782 for (int i = 0; i < nFlags && num_entries < count; i++) { 1786 for (int i = 0; i < nFlags && num_entries < count; i++) {
1783 Flag* flag = &Flag::flags[i]; 1787 Flag* flag = &Flag::flags[i];
1788 // Exclude notproduct and develop flags in product builds.
1789 if (flag->is_constant_in_binary()) {
1790 continue;
1791 }
1784 // Exclude the locked (diagnostic, experimental) flags 1792 // Exclude the locked (diagnostic, experimental) flags
1785 if ((flag->is_unlocked() || flag->is_unlocker()) && 1793 if ((flag->is_unlocked() || flag->is_unlocker()) &&
1786 add_global_entry(env, null_h, &globals[num_entries], flag, THREAD)) { 1794 add_global_entry(env, null_h, &globals[num_entries], flag, THREAD)) {
1787 num_entries++; 1795 num_entries++;
1788 } 1796 }
1811 } 1819 }
1812 1820
1813 bool succeed; 1821 bool succeed;
1814 if (flag->is_bool()) { 1822 if (flag->is_bool()) {
1815 bool bvalue = (new_value.z == JNI_TRUE ? true : false); 1823 bool bvalue = (new_value.z == JNI_TRUE ? true : false);
1816 succeed = CommandLineFlags::boolAtPut(name, &bvalue, MANAGEMENT); 1824 succeed = CommandLineFlags::boolAtPut(name, &bvalue, Flag::MANAGEMENT);
1817 } else if (flag->is_intx()) { 1825 } else if (flag->is_intx()) {
1818 intx ivalue = (intx)new_value.j; 1826 intx ivalue = (intx)new_value.j;
1819 succeed = CommandLineFlags::intxAtPut(name, &ivalue, MANAGEMENT); 1827 succeed = CommandLineFlags::intxAtPut(name, &ivalue, Flag::MANAGEMENT);
1820 } else if (flag->is_uintx()) { 1828 } else if (flag->is_uintx()) {
1821 uintx uvalue = (uintx)new_value.j; 1829 uintx uvalue = (uintx)new_value.j;
1822 succeed = CommandLineFlags::uintxAtPut(name, &uvalue, MANAGEMENT); 1830 succeed = CommandLineFlags::uintxAtPut(name, &uvalue, Flag::MANAGEMENT);
1823 } else if (flag->is_uint64_t()) { 1831 } else if (flag->is_uint64_t()) {
1824 uint64_t uvalue = (uint64_t)new_value.j; 1832 uint64_t uvalue = (uint64_t)new_value.j;
1825 succeed = CommandLineFlags::uint64_tAtPut(name, &uvalue, MANAGEMENT); 1833 succeed = CommandLineFlags::uint64_tAtPut(name, &uvalue, Flag::MANAGEMENT);
1826 } else if (flag->is_ccstr()) { 1834 } else if (flag->is_ccstr()) {
1827 oop str = JNIHandles::resolve_external_guard(new_value.l); 1835 oop str = JNIHandles::resolve_external_guard(new_value.l);
1828 if (str == NULL) { 1836 if (str == NULL) {
1829 THROW(vmSymbols::java_lang_NullPointerException()); 1837 THROW(vmSymbols::java_lang_NullPointerException());
1830 } 1838 }
1831 ccstr svalue = java_lang_String::as_utf8_string(str); 1839 ccstr svalue = java_lang_String::as_utf8_string(str);
1832 succeed = CommandLineFlags::ccstrAtPut(name, &svalue, MANAGEMENT); 1840 succeed = CommandLineFlags::ccstrAtPut(name, &svalue, Flag::MANAGEMENT);
1833 } 1841 }
1834 assert(succeed, "Setting flag should succeed"); 1842 assert(succeed, "Setting flag should succeed");
1835 JVM_END 1843 JVM_END
1836 1844
1837 class ThreadTimesClosure: public ThreadClosure { 1845 class ThreadTimesClosure: public ThreadClosure {