1592 // Exclude the locked (diagnostic, experimental) flags
1593 if ((flag->is_unlocked() || flag->is_unlocker()) &&
1594 add_global_entry(env, null_h, &globals[num_entries], flag, THREAD)) {
1595 num_entries++;
1596 }
1597 }
1598 return num_entries;
1599 }
1600 JVM_END
1601
1602 JVM_ENTRY(void, jmm_SetVMGlobal(JNIEnv *env, jstring flag_name, jvalue new_value))
1603 ResourceMark rm(THREAD);
1604
1605 oop fn = JNIHandles::resolve_external_guard(flag_name);
1606 if (fn == NULL) {
1607 THROW_MSG(vmSymbols::java_lang_NullPointerException(),
1608 "The flag name cannot be null.");
1609 }
1610 char* name = java_lang_String::as_utf8_string(fn);
1611
1612 FormatBuffer<80> err_msg("%s", "");
1613 int succeed = WriteableFlags::set_flag(name, new_value, Flag::MANAGEMENT, err_msg);
1614
1615 if (succeed != Flag::SUCCESS) {
1616 if (succeed == Flag::MISSING_VALUE) {
1617 // missing value causes NPE to be thrown
1618 THROW(vmSymbols::java_lang_NullPointerException());
1619 } else {
1620 // all the other errors are reported as IAE with the appropriate error message
1621 THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
1622 err_msg.buffer());
1623 }
1624 }
1625 assert(succeed == Flag::SUCCESS, "Setting flag should succeed");
1626 JVM_END
1627
1628 class ThreadTimesClosure: public ThreadClosure {
1629 private:
1630 objArrayHandle _names_strings;
1631 char **_names_chars;
1632 typeArrayHandle _times;
1633 int _names_len;
1634 int _times_len;
1635 int _count;
1636
1637 public:
1638 ThreadTimesClosure(objArrayHandle names, typeArrayHandle times);
1639 ~ThreadTimesClosure();
1640 virtual void do_thread(Thread* thread);
1641 void do_unlocked();
1642 int count() { return _count; }
|
1592 // Exclude the locked (diagnostic, experimental) flags
1593 if ((flag->is_unlocked() || flag->is_unlocker()) &&
1594 add_global_entry(env, null_h, &globals[num_entries], flag, THREAD)) {
1595 num_entries++;
1596 }
1597 }
1598 return num_entries;
1599 }
1600 JVM_END
1601
1602 JVM_ENTRY(void, jmm_SetVMGlobal(JNIEnv *env, jstring flag_name, jvalue new_value))
1603 ResourceMark rm(THREAD);
1604
1605 oop fn = JNIHandles::resolve_external_guard(flag_name);
1606 if (fn == NULL) {
1607 THROW_MSG(vmSymbols::java_lang_NullPointerException(),
1608 "The flag name cannot be null.");
1609 }
1610 char* name = java_lang_String::as_utf8_string(fn);
1611
1612 FormatBuffer<80> error_msg("%s", "");
1613 int succeed = WriteableFlags::set_flag(name, new_value, Flag::MANAGEMENT, error_msg);
1614
1615 if (succeed != Flag::SUCCESS) {
1616 if (succeed == Flag::MISSING_VALUE) {
1617 // missing value causes NPE to be thrown
1618 THROW(vmSymbols::java_lang_NullPointerException());
1619 } else {
1620 // all the other errors are reported as IAE with the appropriate error message
1621 THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
1622 error_msg.buffer());
1623 }
1624 }
1625 assert(succeed == Flag::SUCCESS, "Setting flag should succeed");
1626 JVM_END
1627
1628 class ThreadTimesClosure: public ThreadClosure {
1629 private:
1630 objArrayHandle _names_strings;
1631 char **_names_chars;
1632 typeArrayHandle _times;
1633 int _names_len;
1634 int _times_len;
1635 int _count;
1636
1637 public:
1638 ThreadTimesClosure(objArrayHandle names, typeArrayHandle times);
1639 ~ThreadTimesClosure();
1640 virtual void do_thread(Thread* thread);
1641 void do_unlocked();
1642 int count() { return _count; }
|