On Tue, 25 Feb 2025 21:38:58 GMT, Claes Redestad <[email protected]> wrote:
>> Chen Liang has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> We no longer load DelegateMH as we no longer rebind
>
> src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java line 2241:
>
>> 2239: var form = constantForm(basicType);
>> 2240:
>> 2241: if (type.isPrimitive()) {
>
> I think you could simplify this using `Wrapper.forBasicType`; all variants
> should be able to use `wrapper.convert`
The cast is not performed if the `type` is an interface; this is a behavioral
disparity with the old `value = ptype.cast(value);` in `insertArguments`.
> src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 4874:
>
>> 4872: Objects.requireNonNull(type);
>> 4873: return type.isPrimitive() ?
>> primitiveZero(Wrapper.forPrimitiveType(type))
>> 4874: : MethodHandleImpl.makeConstantReturning(type, null);
>
> Not sure if it's important but the existing impl would cache
> `zero(Object.class)` while this new impl won't. Behaviorally neutral for any
> other reference type, though.
`type == Object.class` can use the primitive path, but I am too lazy to add
another of this check.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23706#discussion_r1970611614
PR Review Comment: https://git.openjdk.org/jdk/pull/23706#discussion_r1970616917