On Fri, 13 Oct 2023 10:12:24 GMT, Martin Doerr <[email protected]> wrote:
> The AIX linker has a few minor diffs to the linux ABIv1 linker. In addition,
> double values have only 4 Byte alignment. This PR is based on JDK22 version
> of the FFI.
src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/aix/AixPPC64Linker.java
line 48:
> 46: static {
> 47: HashMap<String, MemoryLayout> layouts = new HashMap<>();
> 48:
> layouts.putAll(SharedUtils.canonicalLayouts(ValueLayout.JAVA_LONG,
> ValueLayout.JAVA_LONG, ValueLayout.JAVA_INT));
You may also add an extra parameter for the double layout to
SharedUtils::canonicalLayouts.
Also, what about `jdouble`? It seems to be defined to a native `double` on AIX
as well? (see src/java.base/share/native/include/jni.h)
test/micro/org/openjdk/bench/java/lang/foreign/CLayouts.java line 68:
> 66: * The layout for the {@code double} C type
> 67: */
> 68: public static final ValueLayout.OfDouble C_DOUBLE =
> ValueLayout.JAVA_DOUBLE.withByteAlignment(IS_AIX ? 4 : 8);
Would prefer if this used `Linker.canonicalLayouts`
Suggestion:
public static final ValueLayout.OfDouble C_DOUBLE = (ValueLayout.OfDouble)
LINKER.canonicalLayouts().get("double");
test/micro/org/openjdk/bench/java/lang/foreign/pointers/NativeType.java line 67:
> 65: @Override
> 66: public ValueLayout.OfDouble layout() {
> 67: return ValueLayout.JAVA_DOUBLE.withByteAlignment(IS_AIX ? 4 :
> 8);
Same here.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16179#discussion_r1358079923
PR Review Comment: https://git.openjdk.org/jdk/pull/16179#discussion_r1358076295
PR Review Comment: https://git.openjdk.org/jdk/pull/16179#discussion_r1358076261