On Fri, 13 Oct 2023 15:39:06 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> wrote:
>> This PR is based on a port of: openjdk/panama-foreign#898 >> >> Some additional changes are contained in this PR: >> >> * instead of using a different "always alive" scope for zero-length memory >> segments, we now use the global scope >> * the javadoc for `MemorySegment::ofArray`, `MemorySegment::ofBuffer` and >> `SymbolLookup::loaderLookup` is tweaked to say that the scope associated to >> the returned segments is an automatic scope >> * the javadoc for `MemorySegment.Scope` defines the concepts of global and >> automatic scope, which are then referenced in the `Arena` javadoc. > > Maurizio Cimadamore has updated the pull request incrementally with one > additional commit since the last revision: > > Add test Marked as reviewed by jvernee (Reviewer). src/java.base/share/classes/java/lang/foreign/Arena.java line 47: > 45: * The simplest arena is the {@linkplain Arena#global() global arena}. > The global arena > 46: * features an <em>unbounded lifetime</em>. The scope of the global arena > is the global scope. > 47: * As such, native segments allocated with the global arena are > associated are always accessible and their backing regions Typo? Suggestion: * As such, native segments allocated with the global arena are always accessible and their backing regions src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 463: > 461: * <p> > 462: * If the selected layout is an {@linkplain AddressLayout address > layout}, calling {@link VarHandle#get(Object...)} > 463: * on the returned var handle will return a new memory segment. The > segment is associated with a scope that is Should this say 'global scope' as well? src/java.base/share/classes/java/lang/foreign/MemorySegment.java line 2367: > 2365: * A scope models the <em>lifetime</em> of all the memory segments > associated with it. That is, a memory segment > 2366: * cannot be accessed if its associated scope is not {@linkplain > #isAlive() alive}. Scope instances can be compared > 2367: * for equality. That is, two scopes are considered {@linkplain > #equals(Object)} if they denote the same lifetime. missing plain text in the link tag ------------- PR Review: https://git.openjdk.org/jdk/pull/16183#pullrequestreview-1676868842 PR Review Comment: https://git.openjdk.org/jdk/pull/16183#discussion_r1358496679 PR Review Comment: https://git.openjdk.org/jdk/pull/16183#discussion_r1358498568 PR Review Comment: https://git.openjdk.org/jdk/pull/16183#discussion_r1358500044