On Mon, 16 Oct 2023 16:20:49 GMT, Martin Doerr <mdo...@openjdk.org> wrote:
>> The AIX linker has a few minor diffs to the linux ABIv1 linker. In addition, >> double values have only 4 Byte alignment within structures. This PR is based >> on JDK22 version of the FFI. > > Martin Doerr has updated the pull request incrementally with one additional > commit since the last revision: > > Revert changes to PlatformLayouts.java src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/aix/AixPPC64Linker.java line 64: > 62: // Note: It is possible to enforce 8-byte alignment by #pragma > align (natural) > 63: // Therefore, we use normal checks if we are already 8-byte > aligned. > 64: if ((offset % 8 != 0) && (member instanceof ValueLayout vl && > vl.carrier() == double.class)) { I think you should check for the correct byte order as well at some point, for this special case test/micro/org/openjdk/bench/java/lang/foreign/pointers/NativeType.java line 61: > 59: @Override > 60: public ValueLayout.OfInt layout() { > 61: return (ValueLayout.OfInt) > LINKER.canonicalLayouts().get("int"); For this benchmark, we rely on constant folding through these layouts. So, we shouldn't go through `canonicalLayouts` here. We can store the layout in a `static final` field, and then return it here instead. test/micro/org/openjdk/bench/java/lang/foreign/pointers/NativeType.java line 68: > 66: @Override > 67: public ValueLayout.OfDouble layout() { > 68: return (ValueLayout.OfDouble) > LINKER.canonicalLayouts().get("double"); Same here ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16179#discussion_r1361340368 PR Review Comment: https://git.openjdk.org/jdk/pull/16179#discussion_r1361338651 PR Review Comment: https://git.openjdk.org/jdk/pull/16179#discussion_r1361338681