scopes writeup
Jorn Vernee
jbvernee at xs4all.nl
Wed Jan 23 10:56:43 UTC 2019
Hi Maurizio,
Per the proposal, a Pointer<Integer> from a parent scope can only be
assigned to a Pointer<Pointer<Integer>> from a child scope (but not from
an ancestor scope). How does this work for native function calls in
general?
- What, if any, are the restrictions on the Scopes of Pointers passed to
native library functions?
- You've said before that a Pointer returned from a library call will
get the library's scope, is that sufficient for the case where a library
returns a Pointer that we passed into it from Java? Does this imply you
can only pass pointers to native calls if they have been allocated from
the library's scope (or an ancestor)?
Jorn
Maurizio Cimadamore schreef op 2019-01-22 17:27:
> 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