Re: RFR: 8307181: MemoryLayout.structLayout uses undocumented strict alignment constraints [v2]

2023-05-03 Thread Maurizio Cimadamore
> This patch adds documentation for the behavior of the > `MemoryLayout::structLayout` factory. > > This factory throws an `IllegalArgumentException` if one of the member > layouts passed to it occurs at an offset within the struct that is not > aligned. > > As part of this patch, I've also

Re: RFR: 8307181: MemoryLayout.structLayout uses undocumented strict alignment constraints

2023-05-03 Thread Maurizio Cimadamore
On Wed, 3 May 2023 14:54:26 GMT, Maurizio Cimadamore wrote: > Actually, now that I look at it, it seems that the exception we raise is not > correct. I think we need to throw if the element size is not a multiple of > the alignment. That is, the size determines the stride, so that has to be a

Re: RFR: 8307181: MemoryLayout.structLayout uses undocumented strict alignment constraints

2023-05-03 Thread Maurizio Cimadamore
On Wed, 3 May 2023 14:26:03 GMT, Jorn Vernee wrote: > > Actually, now that I look at it, it seems that the exception we raise is > > not correct. I think we need to throw if the element size is not a multiple > > of the alignment. That is, the size determines the stride, so that has to > > be

Re: RFR: 8307181: MemoryLayout.structLayout uses undocumented strict alignment constraints

2023-05-03 Thread Jorn Vernee
On Wed, 3 May 2023 14:20:22 GMT, Maurizio Cimadamore wrote: > Actually, now that I look at it, it seems that the exception we raise is not > correct. I think we need to throw if the element size is not a multiple of > the alignment. That is, the size determines the stride, so that has to be a

Re: RFR: 8307181: MemoryLayout.structLayout uses undocumented strict alignment constraints

2023-05-03 Thread Maurizio Cimadamore
On Wed, 3 May 2023 14:17:02 GMT, Maurizio Cimadamore wrote: > > Isn't this true also for sequence layouts where, for example, the second > > element might be misaligned for `sequenceLayout(2, structLayout(JAVA_INT, > > JAVA_SHORT))`? Or, is this already covered? > > That case already has

Re: RFR: 8307181: MemoryLayout.structLayout uses undocumented strict alignment constraints

2023-05-03 Thread Jorn Vernee
On Wed, 3 May 2023 08:31:34 GMT, Maurizio Cimadamore wrote: > This patch adds documentation for the behavior of the > `MemoryLayout::structLayout` factory. > > This factory throws an `IllegalArgumentException` if one of the member > layouts passed to it occurs at an offset within the struct

Re: RFR: 8307181: MemoryLayout.structLayout uses undocumented strict alignment constraints

2023-05-03 Thread Maurizio Cimadamore
On Wed, 3 May 2023 13:48:11 GMT, Per Minborg wrote: > Isn't this true also for sequence layouts where, for example, the second > element might be misaligned for `sequenceLayout(2, structLayout(JAVA_INT, > JAVA_SHORT))`? Or, is this already covered? That case already has some javadoc text:

Re: RFR: 8307181: MemoryLayout.structLayout uses undocumented strict alignment constraints

2023-05-03 Thread Per Minborg
On Wed, 3 May 2023 08:31:34 GMT, Maurizio Cimadamore wrote: > This patch adds documentation for the behavior of the > `MemoryLayout::structLayout` factory. > > This factory throws an `IllegalArgumentException` if one of the member > layouts passed to it occurs at an offset within the struct

RFR: 8307181: MemoryLayout.structLayout uses undocumented strict alignment constraints

2023-05-03 Thread Maurizio Cimadamore
This patch adds documentation for the behavior of the `MemoryLayout::structLayout` factory. This factory throws an `IllegalArgumentException` if one of the member layouts passed to it occurs at an offset within the struct that is not aligned. As part of this patch, I've also added some api