[Integrated] [foreign-memaccess] RFR: Move "owner" field and thread-confinement checks to MemoryScope

Peter Levart plevart at openjdk.java.net
Fri May 15 15:09:56 UTC 2020

On Fri, 15 May 2020 08:56:14 GMT, Peter Levart <plevart at openjdk.org> wrote:

> Now MemoryScope is simplified, I re-based this change and am opening this PR on top. Currently MemorySegment is
> encapsulating thread-confinement logic and state (owner field) while MemoryScope is encapsulating temporal-confinement
> logic and state. But the interplay between the two must be very carefully caried out (for example, close() or dup() on
> child scopes may only be called in owner thread). By moving the thread-confinement logic and state to MemoryScope, I
> think we get better encapsulation as all MemoryScope methods become "safe" - some can still be called in owner thread
> only, but failing to do so throws IllegalSateException instead of exhibiting undefined behavior.

This pull request has now been integrated.

Changeset: 928a8af1
Author:    Peter Levart <plevart at openjdk.org>
Committer: Maurizio Cimadamore <mcimadamore at openjdk.org>
URL:       https://git.openjdk.java.net/panama-foreign/commit/928a8af1
Stats:     201 lines in 5 files changed: 26 ins; 90 del; 85 mod

Move "owner" field and thread-confinement checks to MemoryScope

Reviewed-by: mcimadamore


PR: https://git.openjdk.java.net/panama-foreign/pull/167

More information about the panama-dev mailing list