RFR: 8350617: Improve MethodHandles.tableSwitch and remove intrinsicData
Jorn Vernee
jvernee at openjdk.org
Tue Mar 4 14:35:54 UTC 2025
On Tue, 4 Mar 2025 14:26:19 GMT, Chen Liang <liach at openjdk.org> wrote:
>> 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?
The root would e.g. have a constant BMH pointing at a _shared_ tableSwitch LF. So, the BMH fields would be seen as constant as well, including the list of cases. The issue is that the bytecode of the tableSwitch BMH will not be using the intrinsic, since it's not customized itself, i.e. it will only have a single call site for all cases.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23763#discussion_r1979585627
More information about the core-libs-dev
mailing list