[foreign] RFR Add sizeof method to Struct type

John Rose john.r.rose at oracle.com
Thu Jul 26 22:28:06 UTC 2018


On Jul 26, 2018, at 2:41 PM, Samuel Audet <samuel.audet at gmail.com> wrote:
> 
> BTW, how memory gets allocated isn't limited to alignment. With CUDA…

And there is also Intel XPoint memory, and lots of other kinds.  Assuming they
are linearly addressed we can use pointers and layouts on all kinds of memory.

We plan that the Scope API will handle any kind of closeable resource,
which requires the kind of API you describe.  Right now it favors slices
of vanilla native memory by having a methods for creating such slices.
But those should be understood as convenience methods.  The correct
API will be something like a static resource-factory object, which has
kind-specific allocateInScope methods, and a handshake with the owner
scope for managing lifetime.

I described one aspect of this "future Scope" earlier this month:

http://mail.openjdk.java.net/pipermail/panama-dev/2018-July/002317.html

That message talks about "variables" and "objects"; we take it as given
that many of these variables will be vanilla native memory, but some won't.
The inter-scope handoff APIs are not designed yet, but will abstract across
kinds of variables, allowing things like shared memory segments and exotic
memory.  Scopes should also handle to external resources like open files,
channels.

We may well end up with Scope (perhaps renamed to Block) being
a convenience class on top of a ResourceExtent API that manages
all kinds of resources.  And any number of ResourceFactory
implementations would hang their products on various ResourceExtents.

— John



More information about the panama-dev mailing list