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

Alignment of heap segments is not enforced correctly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 18
    • 18
    • core-libs
    • None
    • b30

        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

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

                Created:
                Updated:
                Resolved: