RFR: 8350617: Improve MethodHandles.tableSwitch and remove intrinsicData

Jorn Vernee jvernee at openjdk.org
Tue Mar 4 14:32:57 UTC 2025


On Tue, 4 Mar 2025 14:10:36 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> Remove the intrinsicData field. We can obtain this from the customized MH when we spin ultra-customized lambda forms. In the long run, we aim to remove this intrinsic if there is no regression for call site sharing.
>> 
>> The existing tableSwitch combinator's LF is unnecessarily complex. This patch also simplifies the tableSwitch combinator.
>> 
>> Note that I was forced to add `@ForceInline` on immutable lists due to regressions in `MethodHandlesTableSwitchRandom` with `sorted == true`, which eliminates the regression. Otherwise, all benchmark results are the same. Tested java/lang/invoke.
>
> src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 7664:
> 
>> 7662:             if (mh.type() != expectedType)
>> 7663:                 throw new IllegalArgumentException(
>> 7664:                     "Some targets do not have the expected type " + expectedType + ": " + caseActions);
> 
> I think we should avoid changing the exception messages here, since it's observable from the outside.
> 
> FWIW, one of the downsides of only printing out a single method handle, is that a user can't tell which method handle in the list was problematic.

At least, please motivate these changes. Why do you think changing the message is needed?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23763#discussion_r1979539878


More information about the core-libs-dev mailing list