[foreign-memaccess] RFR 8224614: Cleanup MemoryScope and its implementation

Jorn Vernee jbvernee at xs4all.nl
Thu May 23 14:42:18 UTC 2019


Looks good!

Cheers,
Jorn

Maurizio Cimadamore schreef op 2019-05-22 19:40:
> Hi,
> this patch implements the approach described in [1].
> 
> I've refactored MemoryScopeImpl into an abstract class
> (AbstractMemoryScopeImpl) and two concrete subclasses:
> 
> * GlobalMemoryScopeImpl - for global scopes (roots of scope 
> hierarchies)
> * ConfinedMemoryScopeImpl - for 'local' scopes (created using fork)
> 
> The former is shared across multiple threads, but there's no need for
> synchronization as there's no mutable state (as global scopes can't be
> closed).
> 
> The latter is thread-confined - which means only the thread owner
> (which is established at scope-creation time) can do scope operations
> such as fork/allocate/merge/close.
> 
> I've also cleaned up the various characteristics flags in MemoryScope;
> some of those made no longer sense, since we decided against having
> VarHandle for reading/writing addresses directly. I kept the
> following:
> 
> * PINNED - used to mark scopes that cannot be closed; it's a property
> of global scopes and cannot be set w/o super-user powers
> 
> * IMMUTABLE - means that the underlying memory cannot be written to
> 
> * UNALIGNED - means that we allow memory writes when addresses do not
> conform to the alignment requirements of the layout from which the
> VarHandle was created
> 
> * CONFINED - means that memory associated with the scope can be
> accessed only within the owning thread
> 
> All characteristics are disabled by default - and it's up to the
> client to set them. There's no 'inheritance' of characteristics either
> from parents to children.
> 
> Webrev:
> 
> http://cr.openjdk.java.net/~mcimadamore/panama/8224614/
> 
> Cheers
> Maurizio
> 
> [1] - 
> https://mail.openjdk.java.net/pipermail/panama-dev/2019-May/005494.html


More information about the panama-dev mailing list