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

Maurizio Cimadamore mcimadamore at openjdk.java.net
Tue May 5 17:36:10 UTC 2020

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

>> 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.

I think we had a discussion on this; we knew publishing segments was safe (all fields final), but there were some
perplexities that the fences added at the end of the constructor were enough to warrant flushing of writes to the
off-heap memory backing the segment (on all platforms). This effect is not covered (afaik) by the JMM.


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

More information about the panama-dev mailing list