mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8287206: Use WrongThreadException for confinement errors
Reviewed-by: alanb, darcy, mchung
This commit is contained in:
parent
e17118aa8a
commit
e1f140d270
12 changed files with 253 additions and 104 deletions
|
@ -127,7 +127,7 @@ import java.lang.invoke.MethodType;
|
|||
* <li>The memory session of {@code R} is {@linkplain MemorySession#isAlive() alive}. Otherwise, the invocation throws
|
||||
* {@link IllegalStateException};</li>
|
||||
* <li>The invocation occurs in same thread as the one {@linkplain MemorySession#ownerThread() owning} the memory session of {@code R},
|
||||
* if said session is confined. Otherwise, the invocation throws {@link IllegalStateException}; and</li>
|
||||
* if said session is confined. Otherwise, the invocation throws {@link WrongThreadException}; and</li>
|
||||
* <li>The memory session of {@code R} is {@linkplain MemorySession#whileAlive(Runnable) kept alive} (and cannot be closed) during the invocation.</li>
|
||||
*</ul>
|
||||
* <p>
|
||||
|
@ -262,8 +262,9 @@ public sealed interface Linker permits AbstractLinker {
|
|||
* @throws IllegalArgumentException if the provided function descriptor is not supported by this linker.
|
||||
* @throws IllegalArgumentException if it is determined that the target method handle can throw an exception, or if the target method handle
|
||||
* has a type that does not match the upcall stub <a href="CLinker.html#upcall-stubs"><em>inferred type</em></a>.
|
||||
* @throws IllegalStateException if {@code session} is not {@linkplain MemorySession#isAlive() alive}, or if access occurs from
|
||||
* a thread other than the thread {@linkplain MemorySession#ownerThread() owning} {@code session}.
|
||||
* @throws IllegalStateException if {@code session} is not {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread
|
||||
* {@linkplain MemorySession#ownerThread() owning} {@code session}.
|
||||
*/
|
||||
MemorySegment upcallStub(MethodHandle target, FunctionDescriptor function, MemorySession session);
|
||||
|
||||
|
|
|
@ -245,7 +245,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* {@return the base memory address associated with this native memory segment}
|
||||
* @throws UnsupportedOperationException if this segment is not a {@linkplain #isNative() native} segment.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
*/
|
||||
@Override
|
||||
MemoryAddress address();
|
||||
|
@ -420,7 +422,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* @param value the value to fill into this segment
|
||||
* @return this memory segment
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws UnsupportedOperationException if this segment is read-only (see {@link #isReadOnly()}).
|
||||
*/
|
||||
MemorySegment fill(byte value);
|
||||
|
@ -437,9 +441,13 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* @param src the source segment.
|
||||
* @throws IndexOutOfBoundsException if {@code src.byteSize() > this.byteSize()}.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with {@code src} is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with {@code src}.
|
||||
* @throws UnsupportedOperationException if this segment is read-only (see {@link #isReadOnly()}).
|
||||
* @return this segment.
|
||||
*/
|
||||
|
@ -467,9 +475,13 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* @return the relative offset, in bytes, of the first mismatch between this
|
||||
* and the given other segment, otherwise -1 if no mismatch
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with {@code other} is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with {@code other}.
|
||||
*/
|
||||
long mismatch(MemorySegment other);
|
||||
|
||||
|
@ -492,7 +504,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* is resident in physical memory
|
||||
*
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws UnsupportedOperationException if this segment is not a mapped memory segment, e.g. if
|
||||
* {@code isMapped() == false}.
|
||||
*/
|
||||
|
@ -507,7 +521,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* occur. </p>
|
||||
*
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws UnsupportedOperationException if this segment is not a mapped memory segment, e.g. if
|
||||
* {@code isMapped() == false}.
|
||||
*/
|
||||
|
@ -522,7 +538,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* occur (as this segment's contents might need to be paged back in). </p>
|
||||
*
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws UnsupportedOperationException if this segment is not a mapped memory segment, e.g. if
|
||||
* {@code isMapped() == false}.
|
||||
*/
|
||||
|
@ -549,7 +567,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* </p>
|
||||
*
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws UnsupportedOperationException if this segment is not a mapped memory segment, e.g. if
|
||||
* {@code isMapped() == false}.
|
||||
* @throws UncheckedIOException if there is an I/O error writing the contents of this segment to the associated storage device
|
||||
|
@ -569,7 +589,10 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* returned if this segment' size is greater than {@link Integer#MAX_VALUE}.
|
||||
* <p>
|
||||
* The life-cycle of the returned buffer will be tied to that of this segment. That is, accessing the returned buffer
|
||||
* after the memory session associated with this segment has been closed (see {@link MemorySession#close()}), will throw an {@link IllegalStateException}.
|
||||
* after the memory session associated with this segment has been closed (see {@link MemorySession#close()}), will
|
||||
* throw an {@link IllegalStateException}. Similarly, accessing the returned buffer from a thread other than
|
||||
* the thread {@linkplain MemorySession#ownerThread() owning} this segment's memory session will throw
|
||||
* a {@link WrongThreadException}.
|
||||
* <p>
|
||||
* If this segment is associated with a confined memory session, calling read/write I/O operations on the resulting buffer
|
||||
* might result in an unspecified exception being thrown. Examples of such problematic operations are
|
||||
|
@ -592,7 +615,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* different from the {@linkplain ByteOrder#nativeOrder native order}, a byte swap operation will be performed on each array element.
|
||||
* @return a new byte array whose contents are copied from this memory segment.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalStateException if this segment's contents cannot be copied into a {@code byte[]} instance,
|
||||
* e.g. its size is greater than {@link Integer#MAX_VALUE}.
|
||||
*/
|
||||
|
@ -604,7 +629,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* different from the {@linkplain ByteOrder#nativeOrder native order}, a byte swap operation will be performed on each array element.
|
||||
* @return a new short array whose contents are copied from this memory segment.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalStateException if this segment's contents cannot be copied into a {@code short[]} instance,
|
||||
* e.g. because {@code byteSize() % 2 != 0}, or {@code byteSize() / 2 > Integer#MAX_VALUE}
|
||||
*/
|
||||
|
@ -616,7 +643,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* different from the {@linkplain ByteOrder#nativeOrder native order}, a byte swap operation will be performed on each array element.
|
||||
* @return a new char array whose contents are copied from this memory segment.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalStateException if this segment's contents cannot be copied into a {@code char[]} instance,
|
||||
* e.g. because {@code byteSize() % 2 != 0}, or {@code byteSize() / 2 > Integer#MAX_VALUE}.
|
||||
*/
|
||||
|
@ -628,7 +657,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* different from the {@linkplain ByteOrder#nativeOrder native order}, a byte swap operation will be performed on each array element.
|
||||
* @return a new int array whose contents are copied from this memory segment.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalStateException if this segment's contents cannot be copied into a {@code int[]} instance,
|
||||
* e.g. because {@code byteSize() % 4 != 0}, or {@code byteSize() / 4 > Integer#MAX_VALUE}.
|
||||
*/
|
||||
|
@ -640,7 +671,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* different from the {@linkplain ByteOrder#nativeOrder native order}, a byte swap operation will be performed on each array element.
|
||||
* @return a new float array whose contents are copied from this memory segment.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalStateException if this segment's contents cannot be copied into a {@code float[]} instance,
|
||||
* e.g. because {@code byteSize() % 4 != 0}, or {@code byteSize() / 4 > Integer#MAX_VALUE}.
|
||||
*/
|
||||
|
@ -652,7 +685,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* different from the {@linkplain ByteOrder#nativeOrder native order}, a byte swap operation will be performed on each array element.
|
||||
* @return a new long array whose contents are copied from this memory segment.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalStateException if this segment's contents cannot be copied into a {@code long[]} instance,
|
||||
* e.g. because {@code byteSize() % 8 != 0}, or {@code byteSize() / 8 > Integer#MAX_VALUE}.
|
||||
*/
|
||||
|
@ -664,7 +699,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* different from the {@linkplain ByteOrder#nativeOrder native order}, a byte swap operation will be performed on each array element.
|
||||
* @return a new double array whose contents are copied from this memory segment.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalStateException if this segment's contents cannot be copied into a {@code double[]} instance,
|
||||
* e.g. because {@code byteSize() % 8 != 0}, or {@code byteSize() / 8 > Integer#MAX_VALUE}.
|
||||
*/
|
||||
|
@ -685,7 +722,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* @throws IndexOutOfBoundsException if {@code S + offset > byteSize()}, where {@code S} is the size of the UTF-8
|
||||
* string (including the terminator character).
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
*/
|
||||
default String getUtf8String(long offset) {
|
||||
return SharedUtils.toJavaStringInternal(this, offset);
|
||||
|
@ -703,7 +742,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* @param str the Java string to be written into this segment.
|
||||
* @throws IndexOutOfBoundsException if {@code str.getBytes().length() + offset >= byteSize()}.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
*/
|
||||
default void setUtf8String(long offset, String str) {
|
||||
Utils.toCString(str.getBytes(StandardCharsets.UTF_8), SegmentAllocator.prefixAllocator(asSlice(offset)));
|
||||
|
@ -830,8 +871,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* @param session the native segment memory session.
|
||||
* @return a native memory segment with the given base address, size and memory session.
|
||||
* @throws IllegalArgumentException if {@code bytesSize < 0}.
|
||||
* @throws IllegalStateException if {@code session} is not {@linkplain MemorySession#isAlive() alive}, or if access occurs from
|
||||
* a thread other than the thread {@linkplain MemorySession#ownerThread() owning} {@code session}.
|
||||
* @throws IllegalStateException if {@code session} is not {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread
|
||||
* {@linkplain MemorySession#ownerThread() owning} {@code session}.
|
||||
* @throws IllegalCallerException if access to this method occurs from a module {@code M} and the command line option
|
||||
* {@code --enable-native-access} is specified, but does not mention the module name {@code M}, or
|
||||
* {@code ALL-UNNAMED} in case {@code M} is an unnamed module.
|
||||
|
@ -862,8 +904,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* @param layout the layout of the off-heap memory block backing the native memory segment.
|
||||
* @param session the segment memory session.
|
||||
* @return a new native memory segment.
|
||||
* @throws IllegalStateException if {@code session} is not {@linkplain MemorySession#isAlive() alive}, or if access occurs from
|
||||
* a thread other than the thread {@linkplain MemorySession#ownerThread() owning} {@code session}.
|
||||
* @throws IllegalStateException if {@code session} is not {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread
|
||||
* {@linkplain MemorySession#ownerThread() owning} {@code session}.
|
||||
*/
|
||||
static MemorySegment allocateNative(MemoryLayout layout, MemorySession session) {
|
||||
Objects.requireNonNull(session);
|
||||
|
@ -887,8 +930,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* @param session the segment temporal bounds.
|
||||
* @return a new native memory segment.
|
||||
* @throws IllegalArgumentException if {@code bytesSize < 0}.
|
||||
* @throws IllegalStateException if {@code session} is not {@linkplain MemorySession#isAlive() alive}, or if access occurs from
|
||||
* a thread other than the thread {@linkplain MemorySession#ownerThread() owning} {@code session}.
|
||||
* @throws IllegalStateException if {@code session} is not {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread
|
||||
* {@linkplain MemorySession#ownerThread() owning} {@code session}.
|
||||
*/
|
||||
static MemorySegment allocateNative(long bytesSize, MemorySession session) {
|
||||
return allocateNative(bytesSize, 1, session);
|
||||
|
@ -907,8 +951,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* @return a new native memory segment.
|
||||
* @throws IllegalArgumentException if {@code bytesSize < 0}, {@code alignmentBytes <= 0}, or if {@code alignmentBytes}
|
||||
* is not a power of 2.
|
||||
* @throws IllegalStateException if {@code session} is not {@linkplain MemorySession#isAlive() alive}, or if access occurs from
|
||||
* a thread other than the thread {@linkplain MemorySession#ownerThread() owning} {@code session}.
|
||||
* @throws IllegalStateException if {@code session} is not {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread
|
||||
* {@linkplain MemorySession#ownerThread() owning} {@code session}.
|
||||
*/
|
||||
static MemorySegment allocateNative(long bytesSize, long alignmentBytes, MemorySession session) {
|
||||
Objects.requireNonNull(session);
|
||||
|
@ -948,9 +993,13 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* @param dstOffset the starting offset, in bytes, of the destination segment.
|
||||
* @param bytes the number of bytes to be copied.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with {@code srcSegment} is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with {@code srcSegment}.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with {@code dstSegment} is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with {@code dstSegment}.
|
||||
* @throws IndexOutOfBoundsException if {@code srcOffset + bytes > srcSegment.byteSize()} or if
|
||||
* {@code dstOffset + bytes > dstSegment.byteSize()}, or if either {@code srcOffset}, {@code dstOffset}
|
||||
* or {@code bytes} are {@code < 0}.
|
||||
|
@ -991,9 +1040,13 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the source
|
||||
* (resp. destination) element layout, or if the source (resp. destination) element layout alignment is greater than its size.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with {@code srcSegment} is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this {@code srcSegment}.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with {@code dstSegment} is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with {@code dstSegment}.
|
||||
* @throws IndexOutOfBoundsException if {@code srcOffset + (elementCount * S) > srcSegment.byteSize()} or if
|
||||
* {@code dstOffset + (elementCount * S) > dstSegment.byteSize()}, where {@code S} is the byte size
|
||||
* of the element layouts, or if either {@code srcOffset}, {@code dstOffset} or {@code elementCount} are {@code < 0}.
|
||||
|
@ -1041,7 +1094,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + offset}.
|
||||
* @return a byte value read from this address.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
|
||||
* @throws IndexOutOfBoundsException when the dereference operation falls outside the <em>spatial bounds</em> of the
|
||||
|
@ -1060,7 +1115,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + offset}.
|
||||
* @param value the byte value to be written.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
|
||||
* @throws IndexOutOfBoundsException when the dereference operation falls outside the <em>spatial bounds</em> of the
|
||||
|
@ -1080,7 +1137,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + offset}.
|
||||
* @return a boolean value read from this address.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
|
||||
* @throws IndexOutOfBoundsException when the dereference operation falls outside the <em>spatial bounds</em> of the
|
||||
|
@ -1099,7 +1158,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + offset}.
|
||||
* @param value the boolean value to be written.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
|
||||
* @throws IndexOutOfBoundsException when the dereference operation falls outside the <em>spatial bounds</em> of the
|
||||
|
@ -1119,7 +1180,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + offset}.
|
||||
* @return a char value read from this address.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
|
||||
* @throws IndexOutOfBoundsException when the dereference operation falls outside the <em>spatial bounds</em> of the
|
||||
|
@ -1138,7 +1201,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + offset}.
|
||||
* @param value the char value to be written.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
|
||||
* @throws IndexOutOfBoundsException when the dereference operation falls outside the <em>spatial bounds</em> of the
|
||||
|
@ -1158,7 +1223,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + offset}.
|
||||
* @return a short value read from this address.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
|
||||
* @throws IndexOutOfBoundsException when the dereference operation falls outside the <em>spatial bounds</em> of the
|
||||
|
@ -1177,7 +1244,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + offset}.
|
||||
* @param value the short value to be written.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
|
||||
* @throws IndexOutOfBoundsException when the dereference operation falls outside the <em>spatial bounds</em> of the
|
||||
|
@ -1197,7 +1266,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + offset}.
|
||||
* @return an int value read from this address.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
|
||||
* @throws IndexOutOfBoundsException when the dereference operation falls outside the <em>spatial bounds</em> of the
|
||||
|
@ -1216,7 +1287,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + offset}.
|
||||
* @param value the int value to be written.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
|
||||
* @throws IndexOutOfBoundsException when the dereference operation falls outside the <em>spatial bounds</em> of the
|
||||
|
@ -1236,7 +1309,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + offset}.
|
||||
* @return a float value read from this address.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
|
||||
* @throws IndexOutOfBoundsException when the dereference operation falls outside the <em>spatial bounds</em> of the
|
||||
|
@ -1255,7 +1330,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + offset}.
|
||||
* @param value the float value to be written.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
|
||||
* @throws IndexOutOfBoundsException when the dereference operation falls outside the <em>spatial bounds</em> of the
|
||||
|
@ -1275,7 +1352,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + offset}.
|
||||
* @return a long value read from this address.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
|
||||
* @throws IndexOutOfBoundsException when the dereference operation falls outside the <em>spatial bounds</em> of the
|
||||
|
@ -1294,7 +1373,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + offset}.
|
||||
* @param value the long value to be written.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
|
||||
* @throws IndexOutOfBoundsException when the dereference operation falls outside the <em>spatial bounds</em> of the
|
||||
|
@ -1314,7 +1395,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + offset}.
|
||||
* @return a double value read from this address.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
|
||||
* @throws IndexOutOfBoundsException when the dereference operation falls outside the <em>spatial bounds</em> of the
|
||||
|
@ -1333,7 +1416,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + offset}.
|
||||
* @param value the double value to be written.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
|
||||
* @throws IndexOutOfBoundsException when the dereference operation falls outside the <em>spatial bounds</em> of the
|
||||
|
@ -1353,7 +1438,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + offset}.
|
||||
* @return an address value read from this address.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
|
||||
* @throws IndexOutOfBoundsException when the dereference operation falls outside the <em>spatial bounds</em> of the
|
||||
|
@ -1372,7 +1459,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + offset}.
|
||||
* @param value the address value to be written.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
|
||||
* @throws IndexOutOfBoundsException when the dereference operation falls outside the <em>spatial bounds</em> of the
|
||||
|
@ -1392,7 +1481,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}.
|
||||
* @return a char value read from this address.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
|
||||
* or if the layout alignment is greater than its size.
|
||||
|
@ -1414,7 +1505,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}.
|
||||
* @param value the char value to be written.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
|
||||
* or if the layout alignment is greater than its size.
|
||||
|
@ -1437,7 +1530,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}.
|
||||
* @return a short value read from this address.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
|
||||
* or if the layout alignment is greater than its size.
|
||||
|
@ -1459,7 +1554,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}.
|
||||
* @param value the short value to be written.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
|
||||
* or if the layout alignment is greater than its size.
|
||||
|
@ -1482,7 +1579,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}.
|
||||
* @return an int value read from this address.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
|
||||
* or if the layout alignment is greater than its size.
|
||||
|
@ -1504,7 +1603,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}.
|
||||
* @param value the int value to be written.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
|
||||
* or if the layout alignment is greater than its size.
|
||||
|
@ -1527,7 +1628,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}.
|
||||
* @return a float value read from this address.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
|
||||
* or if the layout alignment is greater than its size.
|
||||
|
@ -1549,7 +1652,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}.
|
||||
* @param value the float value to be written.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
|
||||
* or if the layout alignment is greater than its size.
|
||||
|
@ -1572,7 +1677,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}.
|
||||
* @return a long value read from this address.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
|
||||
* or if the layout alignment is greater than its size.
|
||||
|
@ -1594,7 +1701,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}.
|
||||
* @param value the long value to be written.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
|
||||
* or if the layout alignment is greater than its size.
|
||||
|
@ -1617,7 +1726,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}.
|
||||
* @return a double value read from this address.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
|
||||
* or if the layout alignment is greater than its size.
|
||||
|
@ -1639,7 +1750,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}.
|
||||
* @param value the double value to be written.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
|
||||
* or if the layout alignment is greater than its size.
|
||||
|
@ -1662,7 +1775,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}.
|
||||
* @return an address value read from this address.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
|
||||
* or if the layout alignment is greater than its size.
|
||||
|
@ -1684,7 +1799,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}.
|
||||
* @param value the address value to be written.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this segment.
|
||||
* @throws IllegalArgumentException if the dereference operation is
|
||||
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
|
||||
* or if the layout alignment is greater than its size.
|
||||
|
@ -1743,7 +1860,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* @param dstIndex the starting index of the destination array.
|
||||
* @param elementCount the number of array elements to be copied.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with {@code srcSegment} is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with {@code srcSegment}.
|
||||
* @throws IllegalArgumentException if {@code dstArray} is not an array, or if it is an array but whose type is not supported,
|
||||
* if the destination array component type does not match the carrier of the source element layout, if the source
|
||||
* segment/offset are <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the source element layout,
|
||||
|
@ -1793,7 +1912,9 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
|
|||
* @param dstOffset the starting offset, in bytes, of the destination segment.
|
||||
* @param elementCount the number of array elements to be copied.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with {@code dstSegment} is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with {@code dstSegment}.
|
||||
* @throws IllegalArgumentException if {@code srcArray} is not an array, or if it is an array but whose type is not supported,
|
||||
* if the source array component type does not match the carrier of the destination element layout, if the destination
|
||||
* segment/offset are <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the destination element layout,
|
||||
|
|
|
@ -60,7 +60,7 @@ import jdk.internal.javac.PreviewFeature;
|
|||
* they are assigned an {@linkplain #ownerThread() owner thread}, typically the thread which initiated the creation operation.
|
||||
* After creating a confined memory session, only the owner thread will be allowed to directly manipulate the resources
|
||||
* associated with this memory session. Any attempt to perform resource access from a thread other than the
|
||||
* owner thread will fail with {@link IllegalStateException}.
|
||||
* owner thread will fail with {@link WrongThreadException}.
|
||||
* <p>
|
||||
* Shared memory sessions, on the other hand, have no owner thread; as such, resources associated with shared memory sessions
|
||||
* can be accessed by multiple threads. This might be useful when multiple threads need to access the same resource concurrently
|
||||
|
@ -157,8 +157,9 @@ public sealed interface MemorySession extends AutoCloseable, SegmentAllocator pe
|
|||
* @apiNote The provided action should not keep a strong reference to this memory session, so that implicitly
|
||||
* closed sessions can be handled correctly by a {@link Cleaner} instance.
|
||||
* @param runnable the custom cleanup action to be associated with this memory session.
|
||||
* @throws IllegalStateException if this memory session is not {@linkplain #isAlive() alive}, or if access occurs from
|
||||
* a thread other than the thread {@linkplain #ownerThread() owning} this memory session.
|
||||
* @throws IllegalStateException if this memory session is not {@linkplain #isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread
|
||||
* {@linkplain #ownerThread() owning} this memory session.
|
||||
*/
|
||||
void addCloseAction(Runnable runnable);
|
||||
|
||||
|
@ -174,9 +175,10 @@ public sealed interface MemorySession extends AutoCloseable, SegmentAllocator pe
|
|||
*
|
||||
* @see MemorySession#isAlive()
|
||||
*
|
||||
* @throws IllegalStateException if this memory session is not {@linkplain #isAlive() alive}, or if access occurs from
|
||||
* a thread other than the thread {@linkplain #ownerThread() owning} this memory session.
|
||||
* @throws IllegalStateException if this memory session is not {@linkplain #isAlive() alive}.
|
||||
* @throws IllegalStateException if this session is {@linkplain #whileAlive(Runnable) kept alive} by another client.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread
|
||||
* {@linkplain #ownerThread() owning} this memory session.
|
||||
* @throws UnsupportedOperationException if this memory session is not {@linkplain #isCloseable() closeable}.
|
||||
*/
|
||||
void close();
|
||||
|
@ -215,8 +217,9 @@ public sealed interface MemorySession extends AutoCloseable, SegmentAllocator pe
|
|||
* MemorySegment.allocateNative(size, align, this);
|
||||
* }
|
||||
*
|
||||
* @throws IllegalStateException if this memory session is not {@linkplain #isAlive() alive}, or if access occurs from
|
||||
* a thread other than the thread {@linkplain #ownerThread() owning} this memory session.
|
||||
* @throws IllegalStateException if this memory session is not {@linkplain #isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread
|
||||
* {@linkplain #ownerThread() owning} this memory session.
|
||||
* @return a new native segment, associated with this session.
|
||||
*/
|
||||
@Override
|
||||
|
|
|
@ -346,8 +346,9 @@ public interface SegmentAllocator {
|
|||
*
|
||||
* @param session the memory session associated with the segments allocated by the arena-based allocator.
|
||||
* @return a new unbounded arena-based allocator
|
||||
* @throws IllegalStateException if {@code session} is not {@linkplain MemorySession#isAlive() alive}, or if access occurs from
|
||||
* a thread other than the thread {@linkplain MemorySession#ownerThread() owning} {@code session}.
|
||||
* @throws IllegalStateException if {@code session} is not {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread
|
||||
* {@linkplain MemorySession#ownerThread() owning} {@code session}.
|
||||
*/
|
||||
static SegmentAllocator newNativeArena(MemorySession session) {
|
||||
return newNativeArena(Long.MAX_VALUE, ArenaAllocator.DEFAULT_BLOCK_SIZE, session);
|
||||
|
@ -365,8 +366,9 @@ public interface SegmentAllocator {
|
|||
* @param session the memory session associated with the segments allocated by the arena-based allocator.
|
||||
* @return a new unbounded arena-based allocator
|
||||
* @throws IllegalArgumentException if {@code arenaSize <= 0}.
|
||||
* @throws IllegalStateException if {@code session} is not {@linkplain MemorySession#isAlive() alive}, or if access occurs from
|
||||
* a thread other than the thread {@linkplain MemorySession#ownerThread() owning} {@code session}.
|
||||
* @throws IllegalStateException if {@code session} is not {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread
|
||||
* {@linkplain MemorySession#ownerThread() owning} {@code session}.
|
||||
*/
|
||||
static SegmentAllocator newNativeArena(long arenaSize, MemorySession session) {
|
||||
return newNativeArena(arenaSize, arenaSize, session);
|
||||
|
@ -401,8 +403,9 @@ public interface SegmentAllocator {
|
|||
* @param session the memory session associated with the segments returned by the arena-based allocator.
|
||||
* @return a new unbounded arena-based allocator
|
||||
* @throws IllegalArgumentException if {@code blockSize <= 0}, if {@code arenaSize <= 0} or if {@code arenaSize < blockSize}.
|
||||
* @throws IllegalStateException if {@code session} is not {@linkplain MemorySession#isAlive() alive}, or if access occurs from
|
||||
* a thread other than the thread {@linkplain MemorySession#ownerThread() owning} {@code session}.
|
||||
* @throws IllegalStateException if {@code session} is not {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread
|
||||
* {@linkplain MemorySession#ownerThread() owning} {@code session}.
|
||||
*/
|
||||
static SegmentAllocator newNativeArena(long arenaSize, long blockSize, MemorySession session) {
|
||||
Objects.requireNonNull(session);
|
||||
|
|
|
@ -71,7 +71,9 @@ sealed public interface VaList extends Addressable permits WinVaList, SysVVaList
|
|||
* @param layout the layout of the value to be read.
|
||||
* @return the {@code int} value read from this variable argument list.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this variable argument list is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this variable argument list.
|
||||
*/
|
||||
int nextVarg(ValueLayout.OfInt layout);
|
||||
|
||||
|
@ -82,7 +84,9 @@ sealed public interface VaList extends Addressable permits WinVaList, SysVVaList
|
|||
* @param layout the layout of the value to be read.
|
||||
* @return the {@code long} value read from this variable argument list.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this variable argument list is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this variable argument list.
|
||||
*/
|
||||
long nextVarg(ValueLayout.OfLong layout);
|
||||
|
||||
|
@ -93,7 +97,9 @@ sealed public interface VaList extends Addressable permits WinVaList, SysVVaList
|
|||
* @param layout the layout of the value
|
||||
* @return the {@code double} value read from this variable argument list.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this variable argument list is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this variable argument list.
|
||||
*/
|
||||
double nextVarg(ValueLayout.OfDouble layout);
|
||||
|
||||
|
@ -104,7 +110,9 @@ sealed public interface VaList extends Addressable permits WinVaList, SysVVaList
|
|||
* @param layout the layout of the value to be read.
|
||||
* @return the {@code MemoryAddress} value read from this variable argument list.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this variable argument list is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this variable argument list.
|
||||
*/
|
||||
MemoryAddress nextVarg(ValueLayout.OfAddress layout);
|
||||
|
||||
|
@ -124,7 +132,9 @@ sealed public interface VaList extends Addressable permits WinVaList, SysVVaList
|
|||
* will be copied.
|
||||
* @return the {@code MemorySegment} value read from this variable argument list.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this variable argument list is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this variable argument list.
|
||||
*/
|
||||
MemorySegment nextVarg(GroupLayout layout, SegmentAllocator allocator);
|
||||
|
||||
|
@ -133,7 +143,9 @@ sealed public interface VaList extends Addressable permits WinVaList, SysVVaList
|
|||
*
|
||||
* @param layouts the layouts of the values to be skipped.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this variable argument list is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this variable argument list.
|
||||
*/
|
||||
void skip(MemoryLayout... layouts);
|
||||
|
||||
|
@ -148,14 +160,18 @@ sealed public interface VaList extends Addressable permits WinVaList, SysVVaList
|
|||
*
|
||||
* @return a copy of this variable argument list.
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this variable argument list is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this variable argument list.
|
||||
*/
|
||||
VaList copy();
|
||||
|
||||
/**
|
||||
* {@return the {@linkplain MemoryAddress memory address} associated with this variable argument list}
|
||||
* @throws IllegalStateException if the {@linkplain #session() session} associated with this variable argument list is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs from a thread other than the thread owning that session.
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread owning
|
||||
* the {@linkplain #session() session} associated with this variable argument list.
|
||||
*/
|
||||
@Override
|
||||
MemoryAddress address();
|
||||
|
@ -172,8 +188,9 @@ sealed public interface VaList extends Addressable permits WinVaList, SysVVaList
|
|||
* @param address a memory address pointing to an existing variable argument list.
|
||||
* @param session the memory session to be associated with the returned variable argument list.
|
||||
* @return a new variable argument list backed by the memory region at {@code address}.
|
||||
* @throws IllegalStateException if {@code session} is not {@linkplain MemorySession#isAlive() alive}, or if access occurs from
|
||||
* a thread other than the thread {@linkplain MemorySession#ownerThread() owning} {@code session}.
|
||||
* @throws IllegalStateException if {@code session} is not {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread
|
||||
* {@linkplain MemorySession#ownerThread() owning} {@code session}.
|
||||
* @throws UnsupportedOperationException if the underlying native platform is not supported.
|
||||
* @throws IllegalCallerException if access to this method occurs from a module {@code M} and the command line option
|
||||
* {@code --enable-native-access} is specified, but does not mention the module name {@code M}, or
|
||||
|
@ -202,8 +219,9 @@ sealed public interface VaList extends Addressable permits WinVaList, SysVVaList
|
|||
* @param session the memory session to be associated with the new variable arity list.
|
||||
* @return a new variable argument list.
|
||||
* @throws UnsupportedOperationException if the underlying native platform is not supported.
|
||||
* @throws IllegalStateException if {@code session} is not {@linkplain MemorySession#isAlive() alive}, or if access occurs from
|
||||
* a thread other than the thread {@linkplain MemorySession#ownerThread() owning} {@code session}.
|
||||
* @throws IllegalStateException if {@code session} is not {@linkplain MemorySession#isAlive() alive}.
|
||||
* @throws WrongThreadException if this method is called from a thread other than the thread
|
||||
* {@linkplain MemorySession#ownerThread() owning} {@code session}.
|
||||
*/
|
||||
static VaList make(Consumer<Builder> actions, MemorySession session) {
|
||||
Objects.requireNonNull(actions);
|
||||
|
|
|
@ -1022,8 +1022,10 @@ public abstract class FileChannel
|
|||
*
|
||||
* @throws IllegalStateException
|
||||
* If the {@code session} is not
|
||||
* {@linkplain MemorySession#isAlive() alive}, or if access occurs
|
||||
* from a thread other than the thread
|
||||
* {@linkplain MemorySession#isAlive() alive}.
|
||||
*
|
||||
* @throws WrongThreadException
|
||||
* If this method is called from a thread other than the thread
|
||||
* {@linkplain MemorySession#ownerThread() owning} the
|
||||
* {@code session}.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue