RFR: 7903585: Revisit variadic support

Jorn Vernee jvernee at openjdk.org
Fri Dec 1 14:12:45 UTC 2023


On Fri, 1 Dec 2023 14:05:34 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> src/main/java/org/openjdk/jextract/impl/HeaderFileBuilder.java line 185:
>> 
>>> 183:                 public static \{invokerName} \{invokerFactoryName}(MemoryLayout... layouts) {
>>> 184:                     class Holder {
>>> 185:                         static final FunctionDescriptor BASE_DESC = \{descriptorString(2, descriptor)};
>> 
>> Why is the descriptor inside the holder class but the MH is not?
>
> Ugh - because the method handle depends on the layout parameter. But if that's the case, what's the benefit of the holder class? I'd thought that to get maximum performance, the specialized method handle had to be a constant.

We re-link the MH every time, so it is not a constant. Note that it depends on `layouts`.

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

PR Review Comment: https://git.openjdk.org/jextract/pull/149#discussion_r1412144218


More information about the jextract-dev mailing list