RFR: 8310405: Linker.Option.firstVariadicArg should specify which index values are valid

Maurizio Cimadamore mcimadamore at openjdk.org
Tue Jun 20 23:03:07 UTC 2023


On Tue, 20 Jun 2023 22:53:53 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Improve the specification of `Linker.Option.firstVariadicArg`, by specifying more clearly which index values are valid.
>
> src/java.base/share/classes/java/lang/foreign/Linker.java line 650:
> 
>> 648:          *          function descriptor associated with a downcall linkage request}
>> 649:          * <p>
>> 650:          * The {@code index} value must be greater than zero, and less than or equal to the number of argument layouts
> 
> Why > 0 and not >= 0? If the list of argument layout is empty, wouldn't the first vararg be in position 0? E.g. a call to a function `m(...)` with _no_ actual arguments?

E.g. are we making an assumption here that if no arguments are passed, then the calling sequence won't be affected by variadic-ness - is that assumption always true?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14565#discussion_r1235983407


More information about the core-libs-dev mailing list