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

Jorn Vernee jvernee at openjdk.org
Mon Feb 26 16:05:51 UTC 2024


> 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)

Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision:

  review comments

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/18007/files
  - new: https://git.openjdk.org/jdk/pull/18007/files/787e32bb..b145a58b

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=18007&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=18007&range=00-01

  Stats: 3 lines in 1 file changed: 0 ins; 1 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/18007.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18007/head:pull/18007

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


More information about the core-libs-dev mailing list