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

Add a way to create an unbound group element var handle

    XMLWordPrintable

Details

    Description

      Consider this layouts:

      static final GroupLayout POINT = MemoryLayout.structLayout(
                  ValueLayout.JAVA_INT.withName("x"),
                  ValueLayout.JAVA_INT.withName("y")
      );

      static final GroupLayout LINE = MemoryLayout.structLayout(
                  POINT.withName("p1"),
                  POINT.withName("p2")
      );

      There should be some way to obtain a var handle which can dereference a Point::x in both p1, p2, using an index that is provided dynamically.

      A possible way to do this, would be to add a new PathElement factory:

      PathElement.groupElements(String... elems)

      Where the invariants are:

      * all the names in elems must be defined in the layout
      * all the layouts corresponding to elems must equals (modulo outer layout name)

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: