Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8139457 Relax alignment of array elements
  3. JDK-8325944

Release Note: Relax Alignment of Array Elements

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Delivered
    • Icon: P4 P4
    • 23
    • 23
    • hotspot

      Array element bases are no longer unconditionally aligned to eight bytes. Instead, they are now aligned to their element type size. This improves the footprint in some JVM modes. As Java array element alignment is not exposed to users, there is no impact on regular Java code that accesses individual elements.

      There are implications for bulk access methods. Unsafe accesses to arrays could now be unaligned. For example, `Unsafe.getLong(byteArray, BYTE_ARRAY_BASE_OFFSET + 0)` is not guaranteed to work on platforms that do not allow unaligned accesses. A workaround is the `Unsafe.{get, put}Unaligned*` family of methods. The `ByteBuffer` and `VarHandle` APIs that allow views of `byte[]` are updated to reflect this change (JDK-8318966). Arrays that are acquired via `GetPrimitiveArrayCritical` should not be operated upon under the assumption of a particular array base alignment.

            rkennke Roman Kennke
            rkennke Roman Kennke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: