[foreign-preview] RFR: 8281855: Rename ResourceScope to MemorySession [v2]

Paul Sandoz psandoz at openjdk.java.net
Fri Feb 18 19:29:12 UTC 2022


On Fri, 18 Feb 2022 11:21:49 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> This patch implements some of the changes described in [1] and [2]. More specifically, the `ResourceScope` abstraction is renamed into `MemorySession`, and the session accessors in `MemorySegment`, `NativeSymbol` and `VaList` are tweaked to return *non-closeable* session views. To counteract this change, `MemorySession` now supports `equals` and `hashCode`, so that sessions views can be compared to each other in ways that are not identity-sensitive.
>> 
>> [1] - https://mail.openjdk.java.net/pipermail/panama-dev/2022-February/016152.html
>> [2] - https://mail.openjdk.java.net/pipermail/panama-dev/2022-February/016254.html
>
> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix more spurious usages of ResourceScope

Marked as reviewed by psandoz (Committer).

src/java.base/share/classes/java/lang/ClassLoader.java line 2470:

> 2468: 
> 2469:     // A resource scope which keeps this loader reachable. Useful when returning
> 2470:     // native symbols associated with libraries loaded by this loader.

Suggestion:

    // A memory session which keeps this loader reachable. Useful when returning
    // native symbols associated with libraries loaded by this loader.

src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template line 303:

> 301: 
> 302:     public long address() {
> 303:         MemorySession scope = session();

Suggestion:

        MemorySession session = session();

src/java.base/share/classes/jdk/internal/access/JavaNioAccess.java line 94:

> 92:      * acquiring is not required to guarantee safety.
> 93:      */
> 94:     Runnable acquireSession(Buffer buffer, boolean async);

In JavaDoc s/resource scope/memory session

-------------

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


More information about the panama-dev mailing list