[foreign-preview] RFR: 8281855: Rename ResourceScope to MemorySession [v8]
Jorn Vernee
jvernee at openjdk.java.net
Mon Feb 21 15:25:45 UTC 2022
On Mon, 21 Feb 2022 15:02:49 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> src/java.base/share/classes/jdk/internal/foreign/abi/UpcallStubs.java line 59:
>>
>>> 57: }
>>> 58: });
>>> 59: return new NativeSymbolImpl("upcall:" + Long.toHexString(entry), MemoryAddress.ofLong(entry), ((MemorySessionImpl)session));
>>
>> If I understand correctly, this doesn't use `Scoped.toSessionImpl` since the session doesn't need to be closed in this case?
>
> No: `NativeSymbolImpl` wants a true, closeable MemorySessionImpl. Then, if you look at that class, its `session` method will return a non closeable view of that session. The `toSessionImpl` happens in `AbstractCLinker::upcallStub`.
I see. I think that's fine, but maybe that call should be moved here for clarity? (or maybe just add an `assert session.isClosable()` for documentation).
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/641
More information about the panama-dev
mailing list