RFR(S) : 8038756 : new WB API :: get/setVMFlag
staffan.larsen at oracle.com
Wed Apr 2 10:27:23 UTC 2014
On 1 apr 2014, at 16:25, Lev Priima <lev.priima at oracle.com> wrote:
> sun.tools.* API(as well as all tools.jar) does not present in compact1 profile.
I see, that’s a reason to add this. However, do we really need to test this specifically on compact1? I’m not sure what tests you are planning to use this feature for, but if it is for testing code that we don’t believe is special for compact1, then I’m not sure we need to run the tests on compact1. Maybe a stupid optimization.
One larger problem here is that this introduced yet another way to set the flags. So far we have three other ways: attachListener.cpp, management.cpp, and arguments.cpp. Currently these three all have duplicated code for verifying the consistency of some of the flags. See the calls to Arguments::verify_MinHeapFreeRatio() for example. If we add yet another way, then that code needs to be copied again. I didn’t like the copying in the first place, but allowed it because we were too lazy at that point to refactor the code… At this point, however, I would like to see that duplication taken care of before we add another way to set the flags. I’m sorry that this is going to make this change harder for you, but we really should only have that code in one place.
> On 04/01/2014 05:02 PM, Staffan Larsen wrote:
>> There is already an API for getting / setting flags in sun.tools.attach.HotSpotVirtualMachine. If at all possible, we should reuse that API instead of adding a new one.
>> Typical use:
>> HotSpotVirtualMachine vm = (HotSpotVirtualMachine) VirtualMachine.attach(pid);
>> vm.setFlag(“MyFlag”, “MyValue”);
>> There is also an API in sun.management.HotSpotDiagnostic for setting / getting as well as querying for options in JVM.
>> On 1 apr 2014, at 11:38, Igor Ignatyev <igor.ignatyev at oracle.com> wrote:
>>> adding hotspot-dev alias.
>>> On 03/31/2014 01:07 AM, Igor Ignatyev wrote:
>>>> Hi all,
>>>> Please review the patch which introduces new WhiteBox methods to get and
>>>> set VM flags.
>>>> webrev: http://cr.openjdk.java.net/~iignatyev/8038756/webrev.00/
>>>> jbs: https://bugs.openjdk.java.net/browse/JDK-8038756
>>>> testing: jprt
More information about the hotspot-dev