On Tue, 4 Mar 2025 14:09:03 GMT, Chen Liang <[email protected]> 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