RFR: 8154096: Extend WhiteBox API with methods which retrieve from VM information about available GC

Dmitry Fazunenko dmitry.fazunenko at oracle.com
Fri Apr 29 11:34:35 UTC 2016


Hello,

To address the offline comments from Igor I completely reimplemented the 
fix.
The main change is introduction a new class sun.hotspot.gc.GC which 
could be used by tests to:
http://cr.openjdk.java.net/~dfazunen/8154096/webrev.02/test/raw_files/new/test/lib/sun/hotspot/gc/GC.java
   - get the currently used GC
   - check if the current GC was selected by ergo or set explicitly
   - get list of supported GC

The new version also minimize the changes to the WhiteBox API

So reviewers are still very welcome!

http://cr.openjdk.java.net/~dfazunen/8154096/webrev.02/
https://bugs.openjdk.java.net/browse/JDK-8154096

Thanks,
Dima


On 26.04.2016 13:52, Dmitry Fazunenko wrote:
> Kirill,
>
> I addressed your offline comments. I agree, the whitebox methods 
> should return exact information received from the VM.
> The logic on special handling the situation when only one GC is 
> available could be implemented in the jtreg plugin setting the 
> @requires properties.
>
> new revision:
> http://cr.openjdk.java.net/~dfazunen/8154096/webrev.01/
>
> the diff:
> http://cr.openjdk.java.net/~dfazunen/8154096/webrev.00vs01/test/
>
> Thanks,
> Dima
>
>
> On 22.04.2016 18:18, Dmitry Fazunenko wrote:
>> Kirill,
>>
>> I will put the following doc on the method:
>>
>> /** * Checks if the current GC was selected by ergonomic among 
>> others. * Note: if VM supports only one GC this method will always 
>> return false. * @returns true if GC was selected by ergonomic, false 
>> if specified by command line flag. */ public boolean 
>> gcSelectedByErgo() {
>>
>>
>> Thanks,
>> Dima
>>
>> On 22.04.2016 17:56, Kirill Zhaldybin wrote:
>>> Dmitry,
>>>
>>> On 22.04.2016 17:39, Dmitry Fazunenko wrote:
>>>> Hi Kirill,
>>>>
>>>> thanks for looking at the code.
>>>>
>>>> On 22.04.2016 17:24, Kirill Zhaldybin wrote:
>>>>> Dmitry,
>>>>>
>>>>> http://cr.openjdk.java.net/~dfazunen/8154096/webrev.00/test/test/lib/sun/hotspot/WhiteBox.java.sdiff.html 
>>>>>
>>>>>
>>>>>
>>>>>  157   // GC
>>>>>  158   /**
>>>>>  159    * @returns true if GC was selected by ergonomic
>>>>>  160    */
>>>>>  161   public boolean gcSelectedByErgo() {
>>>>>  162     if (getSupportedGC().size() < 2) {
>>>>>  163       return false; // nothing to choose from
>>>>>  164     } else {
>>>>>  165       return gcSelectedByErgo0();
>>>>>  166     }
>>>>>  167   }
>>>>>
>>>>>
>>>>> If only one GC is supported why it cannot be selected by ergonomics?
>>>>> My understanding that if jvm is started without gc flag gc is 
>>>>> selected
>>>>> by ergonomics even if there is only one supported gc.
>>>>
>>>> This API will be needed to set @requires properties. If an XXX gc is
>>>> selected by ergo it means it's not specified explicitly by
>>>> -XX:+UseXXXGC, it means -XX:+UseYYYGC could be given without flag
>>>> conflict. If an XXX is the only one GC it could be treated as if XXX
>>>> selected by flag, and no other collectors are allowed.
>>> Thank you for detailed explanation.
>>> Would you mind to add it as a comment to code?
>>> Otherwise looks good.
>>>
>>> Regards, Kirill
>>>
>>>>
>>>> Thanks,
>>>> Dima
>>>
>>>>
>>>>
>>>>
>>>>>
>>>>> Thank you.
>>>>>
>>>>> Regards, Kirill
>>>>>
>>>>> On 13.04.2016 17:54, Dmitry Fazunenko wrote:
>>>>>> Hello,
>>>>>>
>>>>>> I'm looking for a couple of reviews of the change extending the 
>>>>>> WhiteBox
>>>>>> API to retrieve information about
>>>>>> supported collectors and how the collector was selected.
>>>>>>
>>>>>> https://bugs.openjdk.java.net/browse/JDK-8154096
>>>>>> http://cr.openjdk.java.net/~dfazunen/8154096/webrev.00/
>>>>>>
>>>>>> This change is required to improve work of the jtreg @requires. Now
>>>>>> jtreg sets vm.gc property
>>>>>> based on the given flags (matching VM options  for -XX:+Use???GC
>>>>>> pattern).  The extended WhitBox API
>>>>>> will allow us to set properties like:
>>>>>>      vm.supportsSerialGC
>>>>>>      vm.supportsParallelGC
>>>>>>      vm.supportsConcMarkSweeGC
>>>>>>      vm.supportsG1GC
>>>>>>
>>>>>> And use in test more reliable expression:
>>>>>>    @requires vm.supportsG1GC
>>>>>> instead of
>>>>>>    @requires vm.gc == null | vm.gc == "G1"
>>>>>>
>>>>>> The following CRs are blocked by this RFE.
>>>>>> JDK-8151283 <https://bugs.openjdk.java.net/browse/JDK-8151283>:
>>>>>> Implement setting jtreg @requires property vm.isG1Supported.
>>>>>> JDK-8153758 <https://bugs.openjdk.java.net/browse/JDK-8153758> :
>>>>>> @requires should use more accurate GC type parsing.
>>>>>>
>>>>>> Tested locally.
>>>>>>
>>>>>> Thanks,
>>>>>> Dima
>>>>>
>>>>
>>>
>>
>



More information about the hotspot-gc-dev mailing list