On Fri, 13 Oct 2023 15:37:00 GMT, Maurizio Cimadamore <mcimadam...@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