[foreign-memaccess+abi] RFR: 8312615: Ensure jdk_foreign tests pass on linux-x86

Jorn Vernee jvernee at openjdk.org
Mon Jul 24 16:45:35 UTC 2023


On Mon, 24 Jul 2023 15:46:09 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

> Ensure that the jdk_foreign tests pass on linux-x86.
> 
> This is useful to ensure that there are no hard to fix issues (that would require API changes) when trying to use the linker API on a 32-bit platform. This is a good indication that the FFM API is ready for finalization.

make/conf/jib-profiles.js line 436:

> 434:                 "--enable-libffi-bundling",
> 435:                 "--enable-fallback-linker"
> 436:             ])

Here I'm adding the libffi dependency and enabling the fallback linker on linux-x86 (in our CI)

test/jdk/java/foreign/NativeTestHelper.java line 144:

> 142:             C_INT.withName("p2"));
> 143:         default -> throw new UnsupportedOperationException("Unsupported address size");
> 144:     };

Both TestUpcallHighArity and TestUpcallStructScope use this layout. I've moved it here to avoid declaring it twice.

test/jdk/java/foreign/TestAddressDereference.java line 189:

> 187:         }
> 188: 
> 189:         private static final Pattern LAYOUT_PATTERN = Pattern.compile("^(?<align>\\d+%)?(?<char>[azcsifjdAZCSIFJD])\\d+$");

On 32-bit platforms, the string representation of e.g. `long` is `4%j8`. This pattern helps to filter out the `4%`.

test/jdk/java/foreign/TestSegments.java line 29:

> 27:  * @requires jdk.foreign.linker != "UNSUPPORTED"
> 28:  * @requires vm.bits == 64
> 29:  * @run testng/othervm -Xmx4G -XX:MaxDirectMemorySize=1M --enable-native-access=ALL-UNNAMED TestSegments

This test fails on 32-bit platforms due to the `-Xmx4G` flag. I've disabled it there.

-------------

PR Review Comment: https://git.openjdk.org/panama-foreign/pull/849#discussion_r1272483784
PR Review Comment: https://git.openjdk.org/panama-foreign/pull/849#discussion_r1272504017
PR Review Comment: https://git.openjdk.org/panama-foreign/pull/849#discussion_r1272484877
PR Review Comment: https://git.openjdk.org/panama-foreign/pull/849#discussion_r1272485765


More information about the panama-dev mailing list