8138969: G1CollectorPolicy should use const for applicable methods

Mikael Gerdin mikael.gerdin at oracle.com
Tue Oct 6 15:41:24 UTC 2015


On 2015-10-06 17:37, Erik Helin wrote:
> On 2015-10-06, Mikael Gerdin wrote:
>> Hi Erik,
>>
>> On 2015-10-06 17:06, Erik Helin wrote:
>>> Hi all,
>>>
>>> this patch adds the keyword const to a lot of methods in
>>> G1CollectorPolicy. This makes it easier to reason about these methods
>>> since they no longer can cause mischief by updating fields in
>>> unpredicted ways.
>>>
>>> Enhancement:
>>> https://bugs.openjdk.java.net/browse/JDK-8138969
>>>
>>> Webrev:
>>> http://cr.openjdk.java.net/~ehelin/8138969/webrev.00/
>>
>> This is really nice to have!
>> I like the const overload of the collector state object as well, so that if
>> we are in a const method we cannot mutate the collector state.
>>
>> Could you look into doing a similar const overload of the mmu_tracker
>> acessor?
>
> Good idea! Please see new webrevs:
>
> Full:
> http://cr.openjdk.java.net/~ehelin/8138969/webrev.01/
>
> Incremental:
> http://cr.openjdk.java.net/~ehelin/8138969/webrev.00-01/

Great!

Reviewed.
/Mikael

>
> Thanks,
> Erik
>
>> /Mikael
>>
>>>
>>> Testing:
>>> JPRT
>>>
>>> Thanks,
>>> Erik
>>>
>>




More information about the hotspot-gc-dev mailing list