[foreign-memaccess] on scopes (again)

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Mon Jun 17 12:40:22 UTC 2019


Hi,
it occurred to me that the decision as to whether having Scopes or not 
was a false dichotomy, as there's no reason why we couldn't implement 
multiple memory segments sharing the same scope/lifecycle under the 
current API. To do this we just have to expose the internal scope 
abstraction, and let user create them. Then we can have a simple 
unshared scope, which is basically only ever used by a single segment; 
or we can have a more complex shared scope, which can handle multiple 
segments at a time.

Now, I don't think something like this is necessary, as I like the API 
the way it is - but, if at some point we'd like to add more finer-level 
granularity to the scope story, we can go down this path.

Webrev:

http://cr.openjdk.java.net/~mcimadamore/panama/shared-segments/

 From an API perspective, it is going to be challenging to manage all 
the points in the design space { single-segment, multi-segment } x { 
static confined, dynamic confined, shared access } w/o introducing a 
combinatorial explosion of MemorySegment public API types, so, if we 
ever go down this path, we need to thread carefully.

Cheers
Maurizio



More information about the panama-dev mailing list