RFR: 8350607: Consolidate MethodHandles::zero into MethodHandles::constant [v2]
Jorn Vernee
jvernee at openjdk.org
Tue Mar 4 14:46:56 UTC 2025
On Tue, 4 Mar 2025 14:09:03 GMT, Chen Liang <liach at openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/invoke/LambdaForm.java line 1658:
>>
>>> 1656: var carrier = argument(0, L_TYPE).withConstraint(species); // BMH bound with data
>>> 1657: Name[] constNames = new Name[] { carrier, new Name(species.getterFunction(0), carrier) };
>>> 1658: return LF_constant[type.ordinal()] = create(1, constNames, Kind.CONSTANT);
>>
>> I think this caching logic should be in `constantForm`, which also does the cache lookup.
>
> Putting the field write in the `create` method is to help reduce the code that JIT needs to compile by reducing the getter's code size.
Fair enough.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23706#discussion_r1979606038
More information about the core-libs-dev
mailing list