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

Peter Levart plevart at openjdk.java.net
Tue May 5 18:04:54 UTC 2020

On Tue, 5 May 2020 17:32:45 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

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

Ah, I see. Will revert that back then.


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

More information about the panama-dev mailing list