JDK-8038756 : new WB API :: get/setVMFlag
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2014-03-30
  • Updated: 2016-02-04
  • Resolved: 2014-05-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u40Fixed 9 b20Fixed
Related Reports
Blocks :  
Blocks :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
some bundles doesn't have JMX, at the same time to get more reliable testing we need to get value of vm flags to adjust test's behavior.

the initial idea was to have testSet method, but since some flags can be reread in runtime, it's unsafe to use testSet to get value.
Comments
[~lpriima], backported -- JDK-8054552
08-08-2014

please backport to 8u
07-08-2014

suggested fix for testSet*: template <typename T> bool SetVMFlag(JavaThread* thread, JNIEnv* env, jstring name, T* value, bool (*TAtPut)(const char*, T*, Flag::Flags)) { if (name == NULL) { return false; } ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI const char* flag_name = env->GetStringUTFChars(name, NULL); bool result = (*TAtPut)(flag_name, value, Flag::INTERNAL); env->ReleaseStringUTFChars(name, flag_name); return result; } WB_ENTRY(jboolean, WB_TestSetBooleanVMFlag(JNIEnv* env, jobject o, jstring name, jboolean value)) bool result = value; SetVMFlag <bool> (thread, env, name, &result, &CommandLineFlags::boolAtPut); return result; WB_END
30-03-2014