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

Vector access on heap MemorySegments only works for byte[]

    XMLWordPrintable

Details

    • b23
    • Verified

    Description

      Vector access of `MemorySegment`s was added in JDK 19. For heap segments access was restricted to `byte[]`. This was a conservative approach, aligning with that of ByteBuffer support.

      As a result it is not possible to uniformly use memory segments for vector access, wrapping say a `float[]` in a segment, then accessing using `Vector<Float>`.

      The FFM API allows for more general access to heap segments for any primitive array type if the value layout is appropriately unaligned.

      We can update the specification and implementation of the vector access of memory segments methods to operate on any heap array for any given species. The species + byte order is a proxy for an unaligned value layout of the species element type with that byte order.

      Attachments

        Issue Links

          Activity

            People

              pminborg Per-Ake Minborg
              psandoz Paul Sandoz
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: