scopes writeup

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Tue Jan 22 16:27:09 UTC 2019


Hi,
at the end of last year I tried coming up with a proposal [1] which 
aimed at finding the basic concepts behind Panama scopes - I've been 
iterating (with the help of some internal feedback) on that proposal, 
and put it back together in a different form which, all things 
considered, it's not too far off from where we are now.

https://cr.openjdk.java.net/~mcimadamore/panama/scopes.html

That is, we still have a Scope abstraction - memory regions are still 
hidden under Scopes, and not part of the public API (in an attempt to 
limit the number of concepts exposed by the API - at least for now). 
Pointer is an immutable cursor into a memory region. Resources are just 
things with a scope (turns out, a native library is another such thing, 
since a native library needs a library-wide scope for allocating its own 
globals, etc.).

On top of what we have now, this writeup pushes forward an improved 
ownership model, as well as some discussions concerning 
thread-confinement of scopes.

I think this tweaked API proposal has the potential of fixing the 
current lifecycle issues, w/o making the API too complex to use. 
Additional abstraction (such as MemoryRegion) can be added back to the 
public API on a by need basis (e.g. provided relevant use cases).

An experimental patch implementing the proposed approach can be found here:

http://cr.openjdk.java.net/~mcimadamore/panama/scope-ownership_v2/

Comments welcome!

Maurizio

[1] - 
https://mail.openjdk.java.net/pipermail/panama-dev/2018-December/003605.html



More information about the panama-dev mailing list