[foreign-memaccess+abi] RFR: 8296417: Make memory session a pure lifetime abstraction
Maurizio Cimadamore
mcimadamore at openjdk.org
Fri Nov 4 18:05:46 UTC 2022
On Fri, 4 Nov 2022 17:14:56 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> Add description
src/java.base/share/classes/java/lang/foreign/SegmentAllocator.java line 349:
> 347:
> 348: /**
> 349: * Returns a segment allocator which responds to allocation requests by returning consecutive slices
Note: `newNativeArena` is now gone, and replaced with a more general "slicing allocator". The reason I did this was two-fold: the arena factory seemed to be fairly specific, and not very useful to build upon (slicing allocator greatly improve on that aspect). The second problem is the name: now that we have a toplevel Arena, I think having an arena allocator factory here would be too confusing. I don't think the loss in functionality is significant (newNativeArena can be trivially implemented in terms of a slicing allocator), but if we really need it, we could always add another Arena subclass (e.g. SlicingArena which does more or less what the old allocator did.
src/java.base/share/classes/jdk/internal/foreign/GlobalSession.java line 10:
> 8: * Acquiring and or releasing a memory session similarly does nothing.
> 9: */
> 10: final class GlobalSession extends MemorySessionImpl {
I've decided to split this (and implicit sessions) up, for better clarity
-------------
PR: https://git.openjdk.org/panama-foreign/pull/750
More information about the panama-dev
mailing list