Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8307181

MemoryLayout.structLayout uses undocumented strict alignment constraints

    XMLWordPrintable

Details

    Description

      Any combination of structure members that have a "small" element before a "longer" element causes IAE:

      jshell> var ml = MemoryLayout.structLayout(ValueLayout.JAVA_LONG, ValueLayout.JAVA_BYTE, ValueLayout.JAVA_INT);
      | Exception java.lang.IllegalArgumentException: Invalid alignment constraint for member layout: i32
      | at StructLayoutImpl.of (StructLayoutImpl.java:49)
      | at MemoryLayout.lambda$structLayout$1 (MemoryLayout.java:746)
      | at MemoryLayout.wrapOverflow (MemoryLayout.java:766)
      | at MemoryLayout.structLayout (MemoryLayout.java:745)
      | at do_it$Aux (#10:1)
      | at (#10:1)

      jshell> var ml = MemoryLayout.structLayout(ValueLayout.JAVA_BYTE, ValueLayout.JAVA_SHORT);
      | Exception java.lang.IllegalArgumentException: Invalid alignment constraint for member layout: s16
      | at StructLayoutImpl.of (StructLayoutImpl.java:49)
      | at MemoryLayout.lambda$structLayout$1 (MemoryLayout.java:746)
      | at MemoryLayout.wrapOverflow (MemoryLayout.java:766)
      | at MemoryLayout.structLayout (MemoryLayout.java:745)
      | at do_it$Aux (#3:1)
      | at (#3:1)

      Attachments

        Issue Links

          Activity

            People

              mcimadamore Maurizio Cimadamore
              lkuskov Leonid Kuskov
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: