On Mon, 26 Feb 2024 13:24:11 GMT, Jorn Vernee <jver...@openjdk.org> wrote:

> This patch changes the alignment for `JAVA_LONG` and `JAVA_DOUBLE` to 8, 
> regardless of the underlying platform. This means that atomic access modes 
> work on memory segments wrapping `long[]` or `double[]`, as they already do 
> when using `MethodHandless::arrayAccessVarHandle`.
> 
> After discussion, we came to the conclusion that it is reasonable for the JDK 
> to require the elements of a `long[]` and `double[]` to be 8 byte aligned. It 
> is ultimately up to the JDK to set these requirements, which are for the VM 
> to implement.
> 
> I was seeing a stack overflow when running 
> test/jdk/java/foreign/stackwalk/TestReentrantUpcalls.java on x86, so I've 
> lowered the recursion to 50 (which is still more than enough I think).
> 
> Testing: `jdk_foreign` on x64 Windows, x64 Windows + fallback linker, and x86 
> Linux (uses fallback linker)

This pull request has now been integrated.

Changeset: 2372aba6
Author:    Jorn Vernee <jver...@openjdk.org>
URL:       
https://git.openjdk.org/jdk/commit/2372aba6a21c569d4d724396e59b9fd1bec90682
Stats:     67 lines in 10 files changed: 18 ins; 23 del; 26 mod

8326172: Dubious claim on long[]/double[] alignment in MemorySegment javadoc

Reviewed-by: mcimadamore

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

PR: https://git.openjdk.org/jdk/pull/18007

Reply via email to