[foreign-memaccess] [Rev 01] RFR: Alternative scalable MemoryScope

Peter Levart plevart at openjdk.java.net
Tue May 5 10:10:11 UTC 2020


On Tue, 5 May 2020 10:09:28 GMT, Peter Levart <plevart at openjdk.org> wrote:

>> This is an alternative MemoryScope which is more scalable when used in a scenario where child scope is frequently
>> acquired and closed concurrently from multiple threads (for example in parallel Stream.findAny())
>
> Peter Levart has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Don't re-use acquires/releases LongAdder(s) fot duped scope

src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java line 188:

> 187:             return dup(0L, length, mask, newOwner, scope.dup());
> 188:         }
> 189:     }

Maybe you're asking why did I remove this fullFence() call? I don't think it is needed. I checked all implementations
of MemorySegment and they all contain just final fields. It is therefore safe to publish such instances via data races
and no explicit fences are needed.

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

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


More information about the panama-dev mailing list