[foreign-memaccess+abi] RFR: 8296417: Make memory session a pure lifetime abstraction [v2]

Jorn Vernee jvernee at openjdk.org
Fri Nov 4 20:09:23 UTC 2022


On Fri, 4 Nov 2022 18:30:28 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Add description
>
> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Tweak javadoc for VaList

src/java.base/share/classes/java/lang/foreign/MemorySession.java line 33:

> 31: 
> 32: /**
> 33:  * A memory session manages the lifecycle of memory segments.

Since close() is now gone, and since sessions can also be confined. Maybe more accurate would be something like:
Suggestion:

 * A memory session gates the access to memory segments.

(Javadoc touch-ups can be done as part of the JEP as well, I think)

src/java.base/share/classes/java/lang/foreign/MemorySession.java line 48:

> 46:  * <em>after</em> the session has been closed. The costs associated with maintaining this safety invariant can vary greatly,
> 47:  * depending on how many threads have access to the memory segment associated to a memory session. For instance,
> 48:  * if a memory session is created and closed by one thread, and the segments it creates are only ever accessed by that very same

Suggestion:

 * if a memory session is created and closed by one thread, and the segments attached to it are only ever accessed by that very same

src/java.base/share/classes/java/lang/foreign/MemorySession.java line 52:

> 50:  * associated session is being closed.
> 51:  * <p>
> 52:  * Conversely, if a session creates segments that can be accessed by multiple threads, or if the session can be

Suggestion:

 * Conversely, if a session has attached segments that can be accessed by multiple threads, or if the session can be

src/java.base/share/classes/java/lang/foreign/SegmentAllocator.java line 356:

> 354:      * segment with the requested size cannot be found, {@link MemorySegment#NULL} is returned instead.
> 355:      *
> 356:      * @param segment the segment from which the returned allocator should slice from.

Suggestion:

     * @param segment the segment which the returned allocator should slice from.

-------------

PR: https://git.openjdk.org/panama-foreign/pull/750


More information about the panama-dev mailing list