RFR: 8308031: Linkers should promote variadic arguments [v6]

Jorn Vernee jvernee at openjdk.org
Fri Jun 2 16:22:45 UTC 2023


On Fri, 2 Jun 2023 15:52:06 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Jorn Vernee has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 11 additional commits since the last revision:
>> 
>>  - Merge branch 'master' into VAFixes
>>  - undo spurious whitespace changes
>>  - automatically apply variadic promotions
>>  - move prototype-less name
>>  - Rework javadoc
>>  - review comments
>>  - fix word order
>>  - adjust whitespace
>>  - simplify test changes
>>  - reject invalid variadic layouts
>>  - ... and 1 more: https://git.openjdk.org/jdk/compare/16267ba7...9daadbfc
>
> src/java.base/share/classes/jdk/internal/foreign/abi/AbstractLinker.java line 261:
> 
>> 259:     // and float is promoted to double
>> 260:     // See: https://en.cppreference.com/w/c/language/conversion#Default_argument_promotions
>> 261:     private static FunctionDescriptor promoteVariadicArgs(FunctionDescriptor function, int firstVariadicArgIndex) {
> 
> Maybe it's unneeded optimization, but we're scanning the list of layouts once, and then once again to determine the resulting method type. Should we try to do both in one pass?

I considered keeping track of the promoted args in a boolean[], but I figured it was simpler to just scan the layouts again. And this is not really performance critical code.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14225#discussion_r1214570923


More information about the core-libs-dev mailing list