[foreign-memaccess+abi] RFR: Improve NIO channel support for buffer views over segments [v3]
Chris Hegarty
chegar at openjdk.java.net
Thu Apr 22 13:34:34 UTC 2021
On Thu, 22 Apr 2021 11:36:32 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> Chris Hegarty has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Resolve outstanding TODO in MemoryScope spec
>
> src/java.base/share/classes/java/nio/Buffer.java line 828:
>
>> 826: public Scope.Handle acquireScope(Buffer buffer, boolean async) {
>> 827: var scope = buffer.scope();
>> 828: if (scope == null || scope.isImplicit()) {
>
> do you still need the null handling (both here and in IOUtil) ? We just return a singleton now for implicit scope, so I think you can make the code more regular w/o losing any performance.
The null check is still needed - for "regular" buffers (that do not have a scope).
The `isImplicit` check can probably be removed. It is an unproven mirco-optimization to avoid the bloat of chaining unnecessary handles. It could be removed, and dropped altogether or pushed into the IOUtil code that does the chaining ( do not create a new Releaser for a handle that we've seen before, I assume handles can be compared by identity? ) Maybe I'll just drop this, and revisit later when benchmarking.
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/512
More information about the panama-dev
mailing list