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

Jorn Vernee jvernee at openjdk.org
Tue Jul 25 00:59:02 UTC 2023


On Tue, 25 Jul 2023 00:53:33 GMT, Maurizio Cimadamore <mcimadamore 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.
>
> test/jdk/java/foreign/NativeTestHelper.java line 129:
> 
>> 127:      * The layout for the {@code size_t} C type
>> 128:      */
>> 129:     public static final ValueLayout C_SIZE_T = ValueLayout.ADDRESS.byteSize() == 8 ? C_LONG_LONG : C_INT;
> 
> Can't you set SIZE_T using the canonical layout API?

True. We could change the other layouts in this file over to that too.

> test/jdk/java/foreign/NativeTestHelper.java line 133:
> 
>> 131:     // Common layout shared by some tests
>> 132:     // struct S_PDI { void* p0; double p1; int p2; };
>> 133:     public static final MemoryLayout S_PDI_LAYOUT = switch ((int) ValueLayout.ADDRESS.byteSize()) {
> 
> I don't see differences between the two layouts created in the two cases?

The first one has 4 extra bytes of padding

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

PR Review Comment: https://git.openjdk.org/panama-foreign/pull/849#discussion_r1272889204
PR Review Comment: https://git.openjdk.org/panama-foreign/pull/849#discussion_r1272889007


More information about the panama-dev mailing list