On Wed, 15 Nov 2023 09:27:45 GMT, Jaikiran Pai <[email protected]> wrote:
>> This PR proposes to fix a failing test on big endian architectures like AIX.
>
> test/jdk/java/foreign/TestLayouts.java line 223:
>
>> 221: public void testSequenceLayoutWithZeroLength() {
>> 222: SequenceLayout layout = MemoryLayout.sequenceLayout(0,
>> JAVA_INT);
>> 223: assertEquals(layout.toString().toLowerCase(Locale.ROOT),
>> "[0:i4]");
>
> Hello Per, I don't yet have experience with these APIs; do you think the
> implementation of `toString()` itself should perhaps be changed to return a
> consistent value that doesn't depend on the endianness? Or is it intentional
> that there is a dependency?
I have seen this question several times in the past and it is indeed a valid
one. It is like this by design and unfortunately, there will always be
differences across platforms due to byte ordering, and mappings between C types
and Java types. As FFM acts like a glue between the native and Java worlds,
there is always going to be a risk that one gets glue on one's fingers...
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16672#discussion_r1393947108