RFR: 8317514: Ensure MemorySegment is initialized before touching NativeMemorySegmentImpl
Jorn Vernee
jvernee at openjdk.org
Fri Oct 13 17:10:14 UTC 2023
On Fri, 13 Oct 2023 15:37:00 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> This PR makes sure that `MemorySegment` is initialized *before* any of its subclasses.
> This is done by centralizing all the memory segment factories in a single implementation class (`SegmentFactories`).
> Doing so addresses a possible deadlock condition when using multiple threads.
Marked as reviewed by jvernee (Reviewer).
src/java.base/share/classes/java/lang/foreign/MemorySegment.java line 1289:
> 1287: * A zero-length native segment modelling the {@code NULL} address.
> 1288: */
> 1289: MemorySegment NULL = MemorySegment.ofAddress(0L);
The old no-arg constructor can now be removed from NativeMemroySegmentImpl as well I believe.
-------------
PR Review: https://git.openjdk.org/jdk/pull/16187#pullrequestreview-1676911705
PR Review Comment: https://git.openjdk.org/jdk/pull/16187#discussion_r1358523909
More information about the nio-dev
mailing list