RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v6]
Jorn Vernee
jvernee at openjdk.org
Thu Apr 6 18:12:28 UTC 2023
On Thu, 6 Apr 2023 18:03:09 GMT, Chen Liang <liach at openjdk.org> wrote:
>> test/micro/org/openjdk/bench/java/lang/invoke/MethodHandleProxiesAsIFInstanceCall.java line 176:
>>
>>> 174: public void constantLambda() {
>>> 175: i = constantLambda.doWork(i);
>>> 176: }
>>
>> I think setting the result into an instance field like this can work, but it's imo better to let JMH handle it. So, these methods should just return the value instead of writing it to the `i` field.
>
> I think the point here is to make sure work is done by ensuring the VM cannot figure out the input value to doWork, isn't it? To make that more clear, I decide to initialize i to a random value from identity hash code instead.
That too. But I'm talking about the value that is assigned to the field after calling `doWork`. That value should be 'consumed' as well. IMO it's better to do that the conventional way, by returning the value (or using a Blackhole). i.e. let JMH handle it. (IIRC writing the value to a field like this has some issue with it as well)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13197#discussion_r1160109421
More information about the core-libs-dev
mailing list