RFR: 7904115: Fix for AIX test case failures due to incorrect alignment for double and pointer [v5]
Jorn Vernee
jvernee at openjdk.org
Fri Dec 19 17:26:47 UTC 2025
On Fri, 19 Dec 2025 16:43:57 GMT, Varada M <varadam at openjdk.org> wrote:
>> The problem is that the first number here is the actual alignment of the `C_DOUBLE` layout. We [get][4] this from the canonical layout map of the system's native linker. On AIX this is just the layout of JAVA_DOUBLE [[1]], [[2]], which has an alignment of 8 bytes [[3]]. So, the first number here should really be 8, even on AIX.
>>
>> If changing this is making the tests pass, it indicates that there's an issue elsewhere. Is it possible these tests are missing `#pragma align(natural)`?
>>
>> [1]: https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/jdk/internal/foreign/abi/SharedUtils.java#L500
>> [2]: https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/aix/AixPPC64Linker.java#L44
>> [3]: https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/lang/foreign/ValueLayout.java#L460-L464
>> [4]: https://github.com/openjdk/jextract/blob/master/src/main/java/org/openjdk/jextract/impl/HeaderFileBuilder.java#L408
>
> I have tried adding `#pragma align(natural)` to the failing test structs, but still reported 4 byte alignment for subsequent double. Another alternative that fixed the tests is when added __attribute__((aligned(8))) for the double field.
Which tests in particular are failing? Did you look at the Java code generated by jextract?
-------------
PR Review Comment: https://git.openjdk.org/jextract/pull/296#discussion_r2635789867
More information about the jextract-dev
mailing list