On Fri, 13 Oct 2023 12:34:53 GMT, Martin Doerr <mdo...@openjdk.org> wrote:

> I guess changing it would probably be better?

Yeah, I think so.

> Note that we will need something which maps to the 8-Byte aligned double. 
> Otherwise we get an Exception when passing a JAVA_DOUBLE as normal argument.

Okay, so it sounds like Java double on AIX is still 8-byte aligned, but the 
native double is 4-byte aligned?

In that case, I'd say that passing `JAVA_DOUBLE` as an argument resulting in an 
exception, is expected behavior. Using `JAVA_DOUBLE` to link native functions 
works more or less by coincidence, since it has the same layout as the native 
`double`, on all other platforms. The AIX issue with double is not dissimilar 
to using JAVA_LONG to link against a function taking a native `long` on 
Windows, in which case the size of the type doesn't match.

The philosophy here is: a client is responsible for passing the right 
FunctionDescriptor/layouts, that matches the native function declaration. On 
AIX, JAVA_DOUBLE is just never the right layout, and the linker detects this 
and throws an exception.

I understand that some tests might be lazy and use JAVA_DOUBLE to link 
functions. It is fine to update those tests, e.g. to use C_DOUBLE defined in 
NativeTestHelper.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16179#discussion_r1358238373

Reply via email to