[foreign-memaccess] Integrated: 8253937: Simplify support for shared memory segment
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Fri Oct 2 18:25:44 UTC 2020
On Fri, 2 Oct 2020 15:40:35 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> This patch removs the dependency between shared memory segment support and VM async exceptions support. This dependency
> has proven to be problematic, since not all the code paths in the VM handle async exceptions correctly (this can also
> be seen by the number of places which have to be touched in the VM code - which are now reverted by this patch).
> Instead, we can adopt a much simpler approach where, if when closing a segment, we detect concurrent access inside the
> handshake, we simply fail on close. I've added extra javadoc to clarify that, if a client sees an exception when
> closing a segment, that should be perceived as a bug in the code (lack of synchronization) rather than be tempted to
> catch the exception and rethrow. Overall, the support requires a lot less from the VM and I think it's a fairly
> reasonable compromise. Note that now shared scopes have three states:
> * ALIVE
> * CLOSING
> * CLOSED
>
> The liveness check upon segment access fails if state != ALIVE; on the other hand, the public API
> `MemorySegment::isAlive` returns true, as long as the state is != CLOSED. This means that clients sees only one
> transition, from `isAlive() == true` to `isAlive() == false`. We will keep experimenting with the async exception
> support in a separate branch, as a future implementation improvement (note that relaxing the semantics of `close` so
> that it will *never* fail, is both source- and binary- compatible with the approach proposed here).
This pull request has now been integrated.
Changeset: 875417e6
Author: Maurizio Cimadamore <mcimadamore at openjdk.org>
URL: https://git.openjdk.java.net/panama-foreign/commit/875417e6
Stats: 251 lines in 16 files changed: 87 ins; 105 del; 59 mod
8253937: Simplify support for shared memory segment
Reviewed-by: psandoz
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/369
More information about the panama-dev
mailing list