On Thu, 16 Nov 2023 18:52:03 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 4610: >> >>> 4608: * {@link Double#doubleToRawLongBits}, respectively). >>> 4609: * <p> >>> 4610: * Access to heap byte buffers is always unaligned. >> >> I recommend merging that sentence into the paragraph on heap byte buffers >> e.g.: >>> For direct buffers, access of the bytes at an index is always misaligned. >>> As a result only the plain... > > But... surely if I'm just accessing bytes the access cannot possibly be > mis-aligned? Right. I think there is a difference between 'unaligned' and 'misaligned'. Unaligned means there is no effort made to align the access (so it _may_ be misaligned). Misaligned means _definitely not_ aligned. At least, that is my interpretation. This is what I wrote in the latest version: * For heap byte buffers, access is always unaligned. As a result, only the plain * {@linkplain VarHandle.AccessMode#GET get} * and {@linkplain VarHandle.AccessMode#SET set} access modes are supported by the * returned var handle. For all other access modes, an {@link IllegalStateException} * will be thrown. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16681#discussion_r1396215821