-
Enhancement
-
Resolution: Fixed
-
P4
-
None
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)
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)