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

Alignment of heap segments is not enforced correctly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 18
    • Fix Version/s: 18
    • Component/s: core-libs
    • Labels:
      None
    • Resolved In Build:
      b30

      Backports

        Description

        When accessing an off-heap memory segment, we can always ensure that access conforms to some alignment constraint, as there is always some physical address value (e.g. a long) to look at.

        For heap segments, no machine address exists (as heap addresses are virtualized). The implementation of the Foreign Memory Access falls back to check the _offset_ in the segment at which the access occurs - but doing so can lead to behavior that is ultimately platform-dependent: the offset of the first element in a heap segment depends on how big the header-size of an array object is. More specifically, while on 64-bit platforms, all arrays will have their first element aligned at 64-bit - the same is not true for 32-bit platforms. Because of this, copying aligned long values on a memory segment backed by a byte[] might fail depending on the platform.

        For a more detailed description of this issue, please refer to:
        https://mail.openjdk.java.net/pipermail/panama-dev/2021-November/015852.html

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                mcimadamore Maurizio Cimadamore
                Reporter:
                mcimadamore Maurizio Cimadamore
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: