[foreign-memaccess+abi] RFR: 8292047: Consider ways to add linkage parameters to downcall handles [v2]

Jorn Vernee jvernee at openjdk.org
Thu Sep 22 14:56:29 UTC 2022


On Thu, 22 Sep 2022 14:52:32 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> This patch implements a linker option interface, that can be using to indicate additional linkage requirements to the linker.
>> 
>> The variadic function descriptor support is dropped in favor of using a linker option to indicate the first variadic argument index. I think the switch turned out to be straight forward for users of this feature as well, though a bit more verbose.
>> 
>> I also experimented with putting linker options on FunctionDescriptor directly, but it increases the complexity of the combinators of FunctionDescriptor. For instance, if an argument layout is inserted somewhere, should the variadic index option also be updated? (a similar issue arises if we support other linker options that include parameter list indexes). As a result of that, it seemed simpler to just move the linker options as an additional argument to a link request, since at that point we know  the descriptor won't change anymore.
>> 
>> Another design decision is to only allow a single instance of a linker option of a certain type (and they are stored internally in a `Map<Class<?>, Option>` as well). This makes it easier to determine whether a combination of linker options is valid.
>> 
>> Other option kinds that could be added in the future are listed in the JBS issue, but not part of this patch.
>
> Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision:
> 
>   characteristic -> option

src/java.base/share/classes/java/lang/foreign/Linker.java line 299:

> 297: 
> 298:         /**
> 299:          * {@return A linker characteristic used to denote the index of the first variadic argument layout in a

Suggestion:

         * {@return A linker option used to denote the index of the first variadic argument layout in a

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

PR: https://git.openjdk.org/panama-foreign/pull/734


More information about the panama-dev mailing list