From b7ae2473a29c1d93e08d8fbce2eee1acc92cc1d9 Mon Sep 17 00:00:00 2001 From: TheRealMDoerr Date: Thu, 5 Oct 2023 16:01:39 +0200 Subject: [PATCH] Change double alignment to 4 in tests. --- test/jdk/java/foreign/NativeTestHelper.java | 4 +++- .../java/foreign/callarranger/platform/PlatformLayouts.java | 3 ++- test/micro/org/openjdk/bench/java/lang/foreign/CLayouts.java | 4 +++- .../openjdk/bench/java/lang/foreign/pointers/NativeType.java | 3 ++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/test/jdk/java/foreign/NativeTestHelper.java b/test/jdk/java/foreign/NativeTestHelper.java index a161d687643b7..d74cefe6114cb 100644 --- a/test/jdk/java/foreign/NativeTestHelper.java +++ b/test/jdk/java/foreign/NativeTestHelper.java @@ -54,6 +54,7 @@ public class NativeTestHelper { + public static final boolean IS_AIX = System.getProperty("os.name").startsWith("AIX"); public static final boolean IS_WINDOWS = System.getProperty("os.name").startsWith("Windows"); private static final MethodHandle MH_SAVER; @@ -116,7 +117,8 @@ public static boolean isPointer(MemoryLayout layout) { /** * The layout for the {@code double} C type */ - public static final ValueLayout.OfDouble C_DOUBLE = ValueLayout.JAVA_DOUBLE; + public static final ValueLayout.OfDouble C_DOUBLE = ValueLayout.JAVA_DOUBLE.withByteAlignment(IS_AIX ? 4 : 8); + /** * The {@code T*} native type. */ diff --git a/test/jdk/java/foreign/callarranger/platform/PlatformLayouts.java b/test/jdk/java/foreign/callarranger/platform/PlatformLayouts.java index 48ca23befef2c..1871edc2c5d55 100644 --- a/test/jdk/java/foreign/callarranger/platform/PlatformLayouts.java +++ b/test/jdk/java/foreign/callarranger/platform/PlatformLayouts.java @@ -201,6 +201,7 @@ private AArch64() {} * This class defines layout constants modelling standard primitive types supported by the PPC64 ABI. */ public static final class PPC64 { + public static final boolean IS_AIX = System.getProperty("os.name").startsWith("AIX"); private PPC64() { //just the one @@ -244,7 +245,7 @@ private PPC64() { /** * The {@code double} native type. */ - public static final ValueLayout.OfDouble C_DOUBLE = ValueLayout.JAVA_DOUBLE; + public static final ValueLayout.OfDouble C_DOUBLE = ValueLayout.JAVA_DOUBLE.withByteAlignment(IS_AIX ? 4 : 8); /** * The {@code T*} native type. diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/CLayouts.java b/test/micro/org/openjdk/bench/java/lang/foreign/CLayouts.java index 7085f7af5305d..d4627f8dad18e 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/CLayouts.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/CLayouts.java @@ -33,6 +33,7 @@ import java.lang.invoke.MethodHandle; public class CLayouts { + private static final boolean IS_AIX = System.getProperty("os.name").startsWith("AIX"); // the constants below are useful aliases for C types. The type/carrier association is only valid for 64-bit platforms. @@ -64,7 +65,8 @@ public class CLayouts { /** * The layout for the {@code double} C type */ - public static final ValueLayout.OfDouble C_DOUBLE = ValueLayout.JAVA_DOUBLE; + public static final ValueLayout.OfDouble C_DOUBLE = ValueLayout.JAVA_DOUBLE.withByteAlignment(IS_AIX ? 4 : 8); + /** * The {@code T*} native type. */ diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/pointers/NativeType.java b/test/micro/org/openjdk/bench/java/lang/foreign/pointers/NativeType.java index 9f1307f94a944..47b9f50dd59f9 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/pointers/NativeType.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/pointers/NativeType.java @@ -29,6 +29,7 @@ import java.lang.foreign.ValueLayout; public sealed abstract class NativeType { + private static final boolean IS_AIX = System.getProperty("os.name").startsWith("AIX"); public abstract MemoryLayout layout(); @@ -63,7 +64,7 @@ public ValueLayout.OfInt layout() { public static final OfDouble C_DOUBLE = new OfDouble<>() { @Override public ValueLayout.OfDouble layout() { - return ValueLayout.JAVA_DOUBLE; + return ValueLayout.JAVA_DOUBLE.withByteAlignment(IS_AIX ? 4 : 8); } };