Re: RFR: 8318966: Some methods make promises about Java array element alignment that are too strong [v3]

2024-02-13 Thread Jorn Vernee
> See the JBS issue for an extended problem description. > > This patch changes the specification and implementation of > `MethodHandles::byteArrayViewVarHandle`, > `MethodHandles::byteBufferViewVarHandle`, `ByteBuffer::alignedSlice`, and > `ByteBuffer::alignmentOffset` to weaken the guarantees

Re: RFR: 8318966: Some methods make promises about Java array element alignment that are too strong [v2]

2024-02-13 Thread Jorn Vernee
On Thu, 1 Feb 2024 20:10:29 GMT, Jorn Vernee wrote: >> See the JBS issue for an extended problem description. >> >> This patch changes the specification and implementation of >> `MethodHandles::byteArrayViewVarHandle`, >> `MethodHandles::byteBufferViewVarHandle`, `ByteBuffer::alignedSlice`, an

Re: RFR: 8318966: Some methods make promises about Java array element alignment that are too strong [v2]

2024-02-01 Thread Maurizio Cimadamore
On Thu, 1 Feb 2024 20:10:29 GMT, Jorn Vernee wrote: >> See the JBS issue for an extended problem description. >> >> This patch changes the specification and implementation of >> `MethodHandles::byteArrayViewVarHandle`, >> `MethodHandles::byteBufferViewVarHandle`, `ByteBuffer::alignedSlice`, an

Re: RFR: 8318966: Some methods make promises about Java array element alignment that are too strong [v2]

2024-02-01 Thread Jorn Vernee
> See the JBS issue for an extended problem description. > > This patch changes the specification and implementation of > `MethodHandles::byteArrayViewVarHandle`, > `MethodHandles::byteBufferViewVarHandle`, `ByteBuffer::alignedSlice`, and > `ByteBuffer::alignmentOffset` to weaken the guarantees

Re: RFR: 8318966: Some methods make promises about Java array element alignment that are too strong

2024-02-01 Thread Paul Sandoz
On Wed, 15 Nov 2023 22:46:03 GMT, Jorn Vernee wrote: > See the JBS issue for an extended problem description. > > This patch changes the specification and implementation of > `MethodHandles::byteArrayViewVarHandle`, > `MethodHandles::byteBufferViewVarHandle`, `ByteBuffer::alignedSlice`, and >

Re: RFR: 8318966: Some methods make promises about Java array element alignment that are too strong

2024-01-23 Thread Chen Liang
On Tue, 23 Jan 2024 18:24:59 GMT, Jorn Vernee wrote: >> Should we make these unaligned access modes throw ISE like before, when the >> given index is unaligned? > > You mean `get` and `set`? They should never throw, as unaligned access is > fine. For other access modes, we can never guarantee t

Re: RFR: 8318966: Some methods make promises about Java array element alignment that are too strong

2024-01-23 Thread Jorn Vernee
On Tue, 23 Jan 2024 14:43:24 GMT, Chen Liang wrote: > Also curious, is there any documentation (like JVMS) that allows JVMs to make > no offset into byte arrays aligned for larger access? Would be helpful if we > can have a reference here. There is simply no guarantee in the JVMS that array el

Re: RFR: 8318966: Some methods make promises about Java array element alignment that are too strong

2024-01-23 Thread Jorn Vernee
On Tue, 23 Jan 2024 14:30:08 GMT, Chen Liang wrote: >> Good idea. Thanks > > Should we make these unaligned access modes throw ISE like before, when the > given index is unaligned? You mean `get` and `set`? They should never throw, as unaligned access is fine. For other access modes, we can ne

Re: RFR: 8318966: Some methods make promises about Java array element alignment that are too strong

2024-01-23 Thread Chen Liang
On Thu, 16 Nov 2023 18:10:28 GMT, Jorn Vernee wrote: >> src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 4518: >> >>> 4516: * Only plain {@linkplain VarHandle.AccessMode#GET get} and >>> {@linkplain VarHandle.AccessMode#SET set} >>> 4517: * access modes are support

Re: RFR: 8318966: Some methods make promises about Java array element alignment that are too strong

2024-01-23 Thread Chen Liang
On Wed, 15 Nov 2023 22:46:03 GMT, Jorn Vernee wrote: > See the JBS issue for an extended problem description. > > This patch changes the specification and implementation of > `MethodHandles::byteArrayViewVarHandle`, > `MethodHandles::byteBufferViewVarHandle`, `ByteBuffer::alignedSlice`, and >

Re: RFR: 8318966: Some methods make promises about Java array element alignment that are too strong

2023-11-29 Thread Jorn Vernee
On Wed, 15 Nov 2023 22:46:03 GMT, Jorn Vernee wrote: > See the JBS issue for an extended problem description. > > This patch changes the specification and implementation of > `MethodHandles::byteArrayViewVarHandle`, > `MethodHandles::byteBufferViewVarHandle`, `ByteBuffer::alignedSlice`, and >

Re: RFR: 8318966: Some methods make promises about Java array element alignment that are too strong

2023-11-16 Thread Jorn Vernee
On Thu, 16 Nov 2023 06:29:20 GMT, Alan Bateman wrote: >> See the JBS issue for an extended problem description. >> >> This patch changes the specification and implementation of >> `MethodHandles::byteArrayViewVarHandle`, >> `MethodHandles::byteBufferViewVarHandle`, `ByteBuffer::alignedSlice`,

RFR: 8318966: Some methods make promises about Java array element alignment that are too strong

2023-11-16 Thread Jorn Vernee
See the JBS issue for an extended problem description. This patch changes the specification and implementation of `MethodHandles::byteArrayViewVarHandle`, `MethodHandles::byteBufferViewVarHandle`, `ByteBuffer::alignedSlice`, and `ByteBuffer::alignmentOffset` to weaken the guarantees they make a

Re: RFR: 8318966: Some methods make promises about Java array element alignment that are too strong

2023-11-16 Thread Alan Bateman
On Wed, 15 Nov 2023 22:46:03 GMT, Jorn Vernee wrote: > See the JBS issue for an extended problem description. > > This patch changes the specification and implementation of > `MethodHandles::byteArrayViewVarHandle`, > `MethodHandles::byteBufferViewVarHandle`, `ByteBuffer::alignedSlice`, and >

Re: RFR: 8318966: Some methods make promises about Java array element alignment that are too strong

2023-11-16 Thread Maurizio Cimadamore
On Thu, 16 Nov 2023 17:34:40 GMT, Paul Sandoz wrote: >> See the JBS issue for an extended problem description. >> >> This patch changes the specification and implementation of >> `MethodHandles::byteArrayViewVarHandle`, >> `MethodHandles::byteBufferViewVarHandle`, `ByteBuffer::alignedSlice`, a

Re: RFR: 8318966: Some methods make promises about Java array element alignment that are too strong

2023-11-16 Thread Maurizio Cimadamore
On Thu, 16 Nov 2023 19:15:25 GMT, Jorn Vernee wrote: >> 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 _ma

Re: RFR: 8318966: Some methods make promises about Java array element alignment that are too strong

2023-11-16 Thread Jorn Vernee
On Thu, 16 Nov 2023 17:31:46 GMT, Paul Sandoz wrote: >> See the JBS issue for an extended problem description. >> >> This patch changes the specification and implementation of >> `MethodHandles::byteArrayViewVarHandle`, >> `MethodHandles::byteBufferViewVarHandle`, `ByteBuffer::alignedSlice`, a

Re: RFR: 8318966: Some methods make promises about Java array element alignment that are too strong

2023-11-16 Thread Jorn Vernee
On Thu, 16 Nov 2023 18:52:03 GMT, Maurizio Cimadamore wrote: >> src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 4610: >> >>> 4608: * {@link Double#doubleToRawLongBits}, respectively). >>> 4609: * >>> 4610: * Access to heap byte buffers is always unaligned. >

Re: RFR: 8318966: Some methods make promises about Java array element alignment that are too strong

2023-11-16 Thread Jorn Vernee
On Wed, 15 Nov 2023 22:46:03 GMT, Jorn Vernee wrote: > See the JBS issue for an extended problem description. > > This patch changes the specification and implementation of > `MethodHandles::byteArrayViewVarHandle`, > `MethodHandles::byteBufferViewVarHandle`, `ByteBuffer::alignedSlice`, and >

Re: RFR: 8318966: Some methods make promises about Java array element alignment that are too strong

2023-11-16 Thread Paul Sandoz
On Wed, 15 Nov 2023 22:46:03 GMT, Jorn Vernee wrote: > See the JBS issue for an extended problem description. > > This patch changes the specification and implementation of > `MethodHandles::byteArrayViewVarHandle`, > `MethodHandles::byteBufferViewVarHandle`, `ByteBuffer::alignedSlice`, and >