Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Test/FFI] Change the alignment of long in JDK17 #16566

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2021, 2022 IBM Corp. and others
* Copyright (c) 2021, 2023 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -859,12 +859,12 @@ public void test_addDoubleAndFloatDoubleFloatFromStructByUpcallMH() throws Throw

@Test
public void test_addDoubleAndIntDoubleLongFromStructByUpcallMH() throws Throwable {
/* The size of [int, double, long] on AIX/PPC 64-bit is 16 bytes without padding by default
/* The size of [int, double, long] on AIX/PPC 64-bit is 20 bytes without padding by default
* while the same struct is 24 bytes with padding on other platforms.
*/
GroupLayout structLayout = isAixOS ? MemoryLayout.structLayout(C_INT.withName("elem1"),
C_DOUBLE.withName("elem2"), longLayout.withName("elem3")) : MemoryLayout.structLayout(C_INT.withName("elem1"),
MemoryLayout.paddingLayout(32), C_DOUBLE.withName("elem2"), longLayout.withName("elem3"));
GroupLayout structLayout = isAixOS ? MemoryLayout.structLayout(C_INT.withName("elem1"), C_DOUBLE.withName("elem2"),
longLayout.withName("elem3").withBitAlignment(32)) : MemoryLayout.structLayout(C_INT.withName("elem1"),
MemoryLayout.paddingLayout(32), C_DOUBLE.withName("elem2"), longLayout.withName("elem3"));
VarHandle elemHandle1 = structLayout.varHandle(int.class, PathElement.groupElement("elem1"));
VarHandle elemHandle2 = structLayout.varHandle(double.class, PathElement.groupElement("elem2"));
VarHandle elemHandle3 = structLayout.varHandle(long.class, PathElement.groupElement("elem3"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2021, 2022 IBM Corp. and others
* Copyright (c) 2021, 2023 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -2585,11 +2585,11 @@ public static double addDoubleAndFloatDoubleFloatFromStruct(double arg1, MemoryS
}

public static double addDoubleAndIntDoubleLongFromStruct(double arg1, MemorySegment arg2) {
/* The size of [int, double, long] on AIX/PPC 64-bit is 16 bytes without padding by default
/* The size of [int, double, long] on AIX/PPC 64-bit is 20 bytes without padding by default
* while the same struct is 24 bytes with padding on other platforms.
*/
GroupLayout structLayout = isAixOS ? MemoryLayout.structLayout(C_INT.withName("elem1"),
C_DOUBLE.withName("elem2"), longLayout.withName("elem3"))
C_DOUBLE.withName("elem2"), longLayout.withName("elem3").withBitAlignment(32))
: MemoryLayout.structLayout(C_INT.withName("elem1"), MemoryLayout.paddingLayout(32),
C_DOUBLE.withName("elem2"), longLayout.withName("elem3"));
VarHandle elemHandle1 = structLayout.varHandle(int.class, PathElement.groupElement("elem1"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2021, 2022 IBM Corp. and others
* Copyright (c) 2021, 2023 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -821,7 +821,7 @@ public void test_addDoubleAndFloatDoubleFloatFromStructByUpcallMH() throws Throw

@Test
public void test_addDoubleAndIntDoubleLongFromStructByUpcallMH() throws Throwable {
/* The size of [int, double, long] on AIX/PPC 64-bit is 16 bytes without padding by default
/* The size of [int, double, long] on AIX/PPC 64-bit is 20 bytes without padding by default
* while the same struct is 24 bytes with padding on other platforms.
*/
GroupLayout structLayout = isAixOS ? MemoryLayout.structLayout(JAVA_INT.withName("elem1"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2021, 2022 IBM Corp. and others
* Copyright (c) 2021, 2023 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -1853,7 +1853,7 @@ public static double addDoubleAndFloatDoubleFloatFromStruct(double arg1, MemoryS

public static double addDoubleAndIntDoubleLongFromStruct(double arg1, MemorySegment arg2) {
int structElem1 = arg2.get(JAVA_INT, 0);
/* The size of [int, double, long] on AIX/PPC 64-bit is 16 bytes without padding by default
/* The size of [int, double, long] on AIX/PPC 64-bit is 20 bytes without padding by default
* while the same struct is 24 bytes with padding on other platforms.
*/
double structElem2 = (isAixOS) ? arg2.get(JAVA_DOUBLE.withBitAlignment(32), 4) : arg2.get(JAVA_DOUBLE, 8);
Expand Down