[foreign-memaccess] RFR: JDK-8252757: Add support for shared segments (followup)
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Thu Sep 10 14:48:48 UTC 2020
I realized there's a small issue in the API code for shared segment support: the liveness test is always performed
inside MemoryScope (e.g. on share(), confineTo() and close()). While this is ok, there is an usability issue, in that
the `checkValidState` method inside MemoryScope throws raw scoped exceptions (as this routine is really meant only to
be used during memory access).
A better solution is to move the liveness check outside the scope implementation for these operations, and do the check
in AbstractMemorySegment, which correctly wraps the exception.
I've added a comprehensive test which checks that no raw exceptions are leaked from the segment API.
-------------
Commit messages:
- Fix raw access exception leaking from segment API
Changes: https://git.openjdk.java.net/panama-foreign/pull/318/files
Webrev: https://webrevs.openjdk.java.net/?repo=panama-foreign&pr=318&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8252757
Stats: 26 lines in 3 files changed: 19 ins; 7 del; 0 mod
Patch: https://git.openjdk.java.net/panama-foreign/pull/318.diff
Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/318/head:pull/318
PR: https://git.openjdk.java.net/panama-foreign/pull/318
More information about the panama-dev
mailing list