RFR: 8350617: Improve MethodHandles.tableSwitch and remove intrinsicData
Chen Liang
liach at openjdk.org
Tue Mar 4 14:32:56 UTC 2025
On Tue, 4 Mar 2025 13:42:16 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/InvokerBytecodeGenerator.java line 628:
>
>> 626: continue;
>> 627: }
>> 628: break; // Only inline target MHs if this is customized
>
> I think this could be problematic, as we typically only customize the root method handle in a chain. So, if a table switch handle is used with another combinator, we will never benefit from the intrinsic.
In that case, won't the root form be customized and the table switch names be inlined into the root form?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23763#discussion_r1979571760
More information about the core-libs-dev
mailing list