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

Maurizio Cimadamore mcimadamore at openjdk.org
Wed May 3 14:20:16 UTC 2023


On Wed, 3 May 2023 13:48:11 GMT, Per Minborg <pminborg at openjdk.org> 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:

https://cr.openjdk.org/~pminborg/panama/21/v2/javadoc/api/java.base/java/lang/foreign/MemoryLayout.html#sequenceLayout(long,java.lang.foreign.MemoryLayout)

(both factories throw if the alignment of the element layout is bigger than its size). It seems like I only forgot to add extra doc for structs.

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

PR Comment: https://git.openjdk.org/jdk/pull/13770#issuecomment-1533109597


More information about the core-libs-dev mailing list