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

Native linker allows MemoryLayout consisting of only PaddingLayout

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 24
    • core-libs
    • None
    • behavioral
    • minimal
    • Disallowing this likely infrequent corner case is expected to have little or no impact to most applications. Unlikely use will, however, now cause an exception to be thrown.
    • SE

      Summary

      The linker should disallow sequences of a padding layout. The spec should reflect, that the linker only accepts a single padding layout before a non-padding layout and just one trailing padding layout in struct layouts.

      Problem

      It is possible, via a series of embedding constructs, to provide a sequence of only a padding layout to the Linker. This is problematic as various ABIs do not specify how such layouts should be handled. In C, it is not possible to declare a sequence of padding either, even though the FFM API should in theory be language agnostic.

      The linker does not allow group layouts consisting of only padding layouts. This should be clarified in the documentation.

      Solution

      Explicitly disallow sequences of embedded padding elements and throw IllegalArgumentException. GroupLayouts containing only padding layout are already rejected by the linker but this should be clarified in the documentation.

      Specification

      See attachment.

            pminborg Per-Ake Minborg
            webbuggrp Webbug Group
            Jorn Vernee
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: