On Thu, 8 Dec 2022 14:11:29 GMT, Per Minborg <[email protected]> wrote:
> This PR proposes changing variable names and text from "session" to "scope".
> The proposed changes are only for the FFM API and not other parts like the
> Vector API and test classes.
src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java
line 157:
> 155: * Mismatch over long lengths.
> 156: */
> 157: public static long vectorizedMismatchLargeForBytes(MemorySessionImpl
> aScope, MemorySessionImpl bScope,
this seems unnecessary - note that the type is `MemorySessionImpl`
src/java.base/share/classes/jdk/internal/foreign/ConfinedSession.java line 35:
> 33:
> 34: /**
> 35: * A confined scope, which features an owner thread. The liveness check
> features an additional
This should be left as session (since we have not changed the name of the class)
src/java.base/share/classes/jdk/internal/foreign/ConfinedSession.java line 36:
> 34: /**
> 35: * A confined scope, which features an owner thread. The liveness check
> features an additional
> 36: * confinement check - that is, calling any operation on this scope from
> a thread other than the
Same here
src/java.base/share/classes/jdk/internal/foreign/GlobalSession.java line 31:
> 29:
> 30: /**
> 31: * The global, non-closeable, shared scope. Similar to a shared scope,
> but its {@link #close()} method throws unconditionally.
And here.
src/java.base/share/classes/jdk/internal/foreign/ImplicitSession.java line 34:
> 32:
> 33: /**
> 34: * This is an implicit, GC-backed memory scope. Implicit scopes cannot be
> closed explicitly.
These should not be changed.
src/java.base/share/classes/jdk/internal/foreign/MemorySessionImpl.java line 42:
> 40: /**
> 41: * This class manages the temporal bounds associated with a memory
> segment as well
> 42: * as thread confinement. A scope has a liveness bit, which is updated
> when the scope is closed
Probably all the usages of `session` here should be left as is
src/java.base/share/classes/jdk/internal/foreign/MemorySessionImpl.java line
178:
> 176: }
> 177:
> 178: public static boolean sameOwnerThread(SegmentScope scope1,
> SegmentScope scope2) {
This renaming is the only one that should survive
src/java.base/share/classes/jdk/internal/foreign/MemorySessionImpl.java line
320:
> 318:
> 319: static UnsupportedOperationException nonCloseable() {
> 320: return new UnsupportedOperationException("Attempted to close a
> non-closeable scope");
I wonder how much we still need this - e.g. through the API is no longer
possible to get there?
src/java.base/share/classes/jdk/internal/foreign/SharedSession.java line 35:
> 33:
> 34: /**
> 35: * A shared scope, which can be shared across multiple threads. Closing a
> shared scope has to ensure that
These should not be changed
src/java.base/share/classes/jdk/internal/foreign/abi/Binding.java line 255:
> 253: * the context's allocator is accessed.
> 254: */
> 255: public static Context ofScope() {
I think `ofArena` seems more apt here?
-------------
PR: https://git.openjdk.org/jdk/pull/11593