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

Fix for JDK-8361447 breaks the alignment requirements for GuardedMemory

XMLWordPrintable

    • b10

        The fix for JDK-8361447 added a new field to the GuardHeader, not realizing that the size of the GuardHeader must be such that the address of the user-data has the strictest necessary alignment (16-byte).

        We need to restore the alignment. Releases able to use C++11 can use `alignas(16)` to achieve this. Earlier releases can add a dummy 8-byte field for padding.

        This is not generally a problem as since JDK 19 (JDK-8277822) the only use of `GuardedMemory` is for -Xcheck:jni, but Java arrays only have 8-byte alignment to begin with so are unaffected in normal use.

        Prior to JDK 19 VM code only used GuardedMemory in debug builds, and no such usage had such a strict alignment requirement since some ZGC code in JDK 17 (it used movaps to process data).

              dholmes David Holmes
              dholmes David Holmes
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: