-
Bug
-
Resolution: Unresolved
-
P5
-
21, 22
-
None
-
aarch64
-
os_x
There are a few failing jdk_foreign tests on Mac/AArch64 when using the fallback linker (running the tests with `-Djdk.internal.foreign.CABI=FALLBACK`):
test/jdk/java/foreign/TestUpcallStack.java
test/jdk/java/foreign/arraystructs/TestArrayStructs.java#specialized
test/jdk/java/foreign/arraystructs/TestArrayStructs.java#interpreted
These tests were disabled when running on this configuration as part of: https://bugs.openjdk.org/browse/JDK-8309880
It seems like this is an issue in libffi (version 3.4.2 was used to test). My best guess is that libffi doesn't correctly add padding around structs that are passed on the stack (as opposed to scalars, structs are not 'packed' together in the mac/aarch64 ABI, unless they are HFAs. See how we handle this in the foreign linker impl [1], [2]). This issue might be fixed in a future version of libffi.
[1]: https://github.com/openjdk/jdk/blob/75dcc4ef94d90e4aa7f8ca5eccc97c91492d6eed/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/CallArranger.java#L296
[2]: https://github.com/openjdk/jdk/blob/75dcc4ef94d90e4aa7f8ca5eccc97c91492d6eed/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/CallArranger.java#L329
test/jdk/java/foreign/TestUpcallStack.java
test/jdk/java/foreign/arraystructs/TestArrayStructs.java#specialized
test/jdk/java/foreign/arraystructs/TestArrayStructs.java#interpreted
These tests were disabled when running on this configuration as part of: https://bugs.openjdk.org/browse/JDK-8309880
It seems like this is an issue in libffi (version 3.4.2 was used to test). My best guess is that libffi doesn't correctly add padding around structs that are passed on the stack (as opposed to scalars, structs are not 'packed' together in the mac/aarch64 ABI, unless they are HFAs. See how we handle this in the foreign linker impl [1], [2]). This issue might be fixed in a future version of libffi.
[1]: https://github.com/openjdk/jdk/blob/75dcc4ef94d90e4aa7f8ca5eccc97c91492d6eed/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/CallArranger.java#L296
[2]: https://github.com/openjdk/jdk/blob/75dcc4ef94d90e4aa7f8ca5eccc97c91492d6eed/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/CallArranger.java#L329