RFR: 8350617: Improve MethodHandles.tableSwitch and remove intrinsicData
Hannes Greule
hgreule at openjdk.org
Tue Feb 25 21:53:11 UTC 2025
On Tue, 25 Feb 2025 02:45:46 GMT, Chen Liang <liach 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 7659:
> 7657: if (!(expectedType.parameterCount() >= 1) || expectedType.parameterType(0) != int.class)
> 7658: throw new IllegalArgumentException(
> 7659: "Case actions must have int as leading parameter: " + caseActions);
As you're already touching this: `expectedType` is the default case, but it's not printed here. This can lead to very confusing output if all caseActions have a leading int parameter but the defaultCase hasn't.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23763#discussion_r1969044767
More information about the core-libs-dev
mailing list