|
416 | 416 | * The native linker only supports linking the specialized form of a variadic function. A variadic function in its specialized
|
417 | 417 | * form can be linked using a function descriptor describing the specialized form. Additionally, the
|
418 | 418 | * {@link Linker.Option#firstVariadicArg(int)} linker option must be provided to indicate the first variadic parameter in
|
419 |
| - * the parameter list. The corresponding argument layout, and all following argument layouts in the specialized function |
420 |
| - * descriptor, are called <em>variadic argument layouts</em>. For a prototype-less function, the index passed to |
| 419 | + * the parameter list. The corresponding argument layout (if any), and all following argument layouts in the specialized |
| 420 | + * function descriptor, are called <em>variadic argument layouts</em>. For a prototype-less function, the index passed to |
421 | 421 | * {@link Linker.Option#firstVariadicArg(int)} should always be {@code 0}.
|
422 | 422 | * <p>
|
423 | 423 | * The native linker will reject an attempt to link a specialized function descriptor with any variadic argument layouts
|
@@ -644,8 +644,23 @@ sealed interface Option
|
644 | 644 | permits LinkerOptions.LinkerOptionImpl {
|
645 | 645 |
|
646 | 646 | /**
|
647 |
| - * {@return a linker option used to denote the index of the first variadic argument layout in the |
648 |
| - * function descriptor associated with a downcall linkage request} |
| 647 | + * {@return a linker option used to denote the index indicating the start of the variadic arguments passed to the |
| 648 | + * function described by the function descriptor associated with a downcall linkage request} |
| 649 | + * <p> |
| 650 | + * The {@code index} value must conform to {@code 0 <= index <= N}, where {@code N} is the number of argument |
| 651 | + * layouts of the function descriptor used in conjunction with this linker option. When the {@code index} is: |
| 652 | + * <ul> |
| 653 | + * <li>{@code 0}, all arguments passed to the function are passed as variadic arguments</li> |
| 654 | + * <li>{@code N}, none of the arguments passed to the function are passed as variadic arguments</li> |
| 655 | + * <li>{@code n}, where {@code 0 < m < N}, the arguments {@code m..N} are passed as variadic arguments</li> |
| 656 | + * </ul> |
| 657 | + * It is important to always use this linker option when linking a <a href=Linker.html#variadic-funcs>variadic |
| 658 | + * function</a>, even if no variadic argument is passed (the second case in the list |
| 659 | + * above), as this might still affect the calling convention on certain platforms. |
| 660 | + * |
| 661 | + * @implNote The index value is validated when making a linkage request, which is when the function descriptor |
| 662 | + * against which the index is validated is available. |
| 663 | + * |
649 | 664 | * @param index the index of the first variadic argument layout in the function descriptor associated
|
650 | 665 | * with a downcall linkage request.
|
651 | 666 | */
|
|
0 commit comments