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

Investigate ways to simplify MemorySegment::ofBuffer

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 24
    • None
    • core-libs

      MemorySegment::ofBuffer is a rather complex factory. It needs to check the type of the array underneath the MS, to then select the appropriate ByteBuffer implementation. This complex logic results in a very big method which fails to inline:

      https://mail.openjdk.org/pipermail/panama-dev/2024-October/020702.html

      We should investigate ways to make this a bit better. In the short term, perhaps, by forcing inlining of the factory. In the longer term by moving the construction logic in a virtual method in the ByteBuffer hierarchy (since each buffer would know how to do the mapping correctly).

            pminborg Per-Ake Minborg
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: