JDK-8315131 : Clarify VarHandle set/get access on 32-bit platforms
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Affected Version: 24
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-08-28
  • Updated: 2025-07-25
  • Resolved: 2025-07-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 25 JDK 26
25Fixed 26 b08Fixed
Related Reports
CSR :  
Relates :  
Relates :  
Description
The VarHandle methods on MethodHandles, byteArrayViewVarHandle, byteBufferViewVarHandle state:

     * If access is aligned then following access modes are supported and are
     * guaranteed to support atomic access:
     * <ul>
     * <li>read write access modes for all {@code T}, with the exception of
     *     access modes {@code get} and {@code set} for {@code long} and
     *     {@code double} on 32-bit platforms.

This is misleading, aligned access for modes get/set is supported on 32-bit systems but access is not guaranteed to be atomic and therefore may lead to word tearing.

Note: This is already fixed in MemoryLayout::varHandle.


Comments
A pull request was submitted for review. Branch: jdk25 URL: https://git.openjdk.org/jdk/pull/26438 Date: 2025-07-23 04:04:46 +0000
23-07-2025

Changeset: ea6674fe Branch: master Author: Chen Liang <liach@openjdk.org> Date: 2025-07-22 17:25:00 +0000 URL: https://git.openjdk.org/jdk/commit/ea6674fec8702eea481afa7ca7e522cbacd53841
22-07-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/26258 Date: 2025-07-10 23:40:15 +0000
10-07-2025

This still applies to byteBufferViewVarHandle.
08-07-2025