MemoryLayout api

John Rose john.r.rose at oracle.com
Wed Jan 22 06:28:36 UTC 2020


On Jan 21, 2020, at 5:43 PM, Michael Zucchi <notzed at gmail.com> wrote:
> 
> And how that is interpreted is entirely up to the implementation: could be a specific length from some preceding integer, some calculated length (from anywhere), or often a sentinel-terminated sequence.  Are you going to support all those possibilities?

This might seem unimaginably difficult at first glance,
but progress can be made by factoring the problem correctly.
First, reify the bound as an argument to an indexed VH.
Second, define a way to combine a computation function
with the VH (to compute the dimension on the fly).
Third, find a reasonable set of such computation functions.
Maybe not full Turing machines, but at least (a) constants
and (b) some sort of “peek at the header” computation.
Fourth, make sure that the stuff optimizes.  After all,
the hardwired “peek at the header” that the JVM does
for its own arrays is well-optimized, and the techniques
can be replicated to other data structures, given the
right conditions.

An early attempt to account for variable-length data,
in the context of a layout algebra, is here:
  http://cr.openjdk.java.net/~jrose/panama/minimal-ldl.html#count

— John


More information about the panama-dev mailing list