This commit is contained in:
Jesper Wilhelmsson 2022-07-20 07:39:01 +00:00
commit a3e07d950a
10 changed files with 510 additions and 73 deletions

View file

@ -197,7 +197,9 @@ static void set_serialized(const T* ptr) {
assert(ptr != NULL, "invariant"); assert(ptr != NULL, "invariant");
SET_SERIALIZED(ptr); SET_SERIALIZED(ptr);
assert(IS_SERIALIZED(ptr), "invariant"); assert(IS_SERIALIZED(ptr), "invariant");
CLEAR_THIS_EPOCH_CLEARED_BIT(ptr); if (current_epoch()) {
CLEAR_THIS_EPOCH_CLEARED_BIT(ptr);
}
} }
/* /*
@ -775,7 +777,9 @@ void set_serialized<Method>(MethodPtr method) {
assert(method != NULL, "invariant"); assert(method != NULL, "invariant");
SET_METHOD_SERIALIZED(method); SET_METHOD_SERIALIZED(method);
assert(IS_METHOD_SERIALIZED(method), "invariant"); assert(IS_METHOD_SERIALIZED(method), "invariant");
CLEAR_THIS_EPOCH_METHOD_CLEARED_BIT(method); if (current_epoch()) {
CLEAR_THIS_EPOCH_METHOD_CLEARED_BIT(method);
}
} }
static int write_method(JfrCheckpointWriter* writer, MethodPtr method, bool leakp) { static int write_method(JfrCheckpointWriter* writer, MethodPtr method, bool leakp) {

View file

@ -101,8 +101,8 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* restricted methods, and use safe and supported functionalities, where possible. * restricted methods, and use safe and supported functionalities, where possible.
* *
* @param offset offset in bytes (relative to this address). Might be negative. * @param offset offset in bytes (relative to this address). Might be negative.
* The final address of this read operation can be expressed as {@code toRowLongValue() + offset}. * The final address of this read operation can be expressed as {@code toRawLongValue() + offset}.
* @return a Java string constructed from the bytes read from the given starting address ({@code toRowLongValue() + offset}) * @return a Java string constructed from the bytes read from the given starting address ({@code toRawLongValue() + offset})
* up to (but not including) the first {@code '\0'} terminator character (assuming one is found). * up to (but not including) the first {@code '\0'} terminator character (assuming one is found).
* @throws IllegalArgumentException if the size of the UTF-8 string is greater than the largest string supported by the platform. * @throws IllegalArgumentException if the size of the UTF-8 string is greater than the largest string supported by the platform.
* @throws IllegalCallerException if access to this method occurs from a module {@code M} and the command line option * @throws IllegalCallerException if access to this method occurs from a module {@code M} and the command line option
@ -125,7 +125,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* the JVM or, worse, silently result in memory corruption. Thus, clients should refrain from depending on * the JVM or, worse, silently result in memory corruption. Thus, clients should refrain from depending on
* restricted methods, and use safe and supported functionalities, where possible. * restricted methods, and use safe and supported functionalities, where possible.
* @param offset offset in bytes (relative to this address). Might be negative. * @param offset offset in bytes (relative to this address). Might be negative.
* The final address of this read operation can be expressed as {@code toRowLongValue() + offset}. * The final address of this read operation can be expressed as {@code toRawLongValue() + offset}.
* @param str the Java string to be written at this address. * @param str the Java string to be written at this address.
* @throws IllegalCallerException if access to this method occurs from a module {@code M} and the command line option * @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 --enable-native-access} is specified, but does not mention the module name {@code M}, or
@ -176,7 +176,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param offset offset in bytes (relative to this address). Might be negative. * @param offset offset in bytes (relative to this address). Might be negative.
* The final address of this read operation can be expressed as {@code toRowLongValue() + offset}. * The final address of this read operation can be expressed as {@code toRawLongValue() + offset}.
* @return a byte value read from this address. * @return a byte value read from this address.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout. * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
@ -197,7 +197,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param offset offset in bytes (relative to this address). Might be negative. * @param offset offset in bytes (relative to this address). Might be negative.
* The final address of this write operation can be expressed as {@code toRowLongValue() + offset}. * The final address of this write operation can be expressed as {@code toRawLongValue() + offset}.
* @param value the byte value to be written. * @param value the byte value to be written.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout. * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
@ -218,7 +218,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param offset offset in bytes (relative to this address). Might be negative. * @param offset offset in bytes (relative to this address). Might be negative.
* The final address of this read operation can be expressed as {@code toRowLongValue() + offset}. * The final address of this read operation can be expressed as {@code toRawLongValue() + offset}.
* @return a boolean value read from this address. * @return a boolean value read from this address.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout. * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
@ -239,7 +239,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param offset offset in bytes (relative to this address). Might be negative. * @param offset offset in bytes (relative to this address). Might be negative.
* The final address of this write operation can be expressed as {@code toRowLongValue() + offset}. * The final address of this write operation can be expressed as {@code toRawLongValue() + offset}.
* @param value the boolean value to be written. * @param value the boolean value to be written.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout. * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
@ -260,7 +260,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param offset offset in bytes (relative to this address). Might be negative. * @param offset offset in bytes (relative to this address). Might be negative.
* The final address of this read operation can be expressed as {@code toRowLongValue() + offset}. * The final address of this read operation can be expressed as {@code toRawLongValue() + offset}.
* @return a char value read from this address. * @return a char value read from this address.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout. * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
@ -281,7 +281,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param offset offset in bytes (relative to this address). Might be negative. * @param offset offset in bytes (relative to this address). Might be negative.
* The final address of this write operation can be expressed as {@code toRowLongValue() + offset}. * The final address of this write operation can be expressed as {@code toRawLongValue() + offset}.
* @param value the char value to be written. * @param value the char value to be written.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout. * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
@ -302,7 +302,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param offset offset in bytes (relative to this address). Might be negative. * @param offset offset in bytes (relative to this address). Might be negative.
* The final address of this read operation can be expressed as {@code toRowLongValue() + offset}. * The final address of this read operation can be expressed as {@code toRawLongValue() + offset}.
* @return a short value read from this address. * @return a short value read from this address.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout. * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
@ -323,7 +323,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param offset offset in bytes (relative to this address). Might be negative. * @param offset offset in bytes (relative to this address). Might be negative.
* The final address of this write operation can be expressed as {@code toRowLongValue() + offset}. * The final address of this write operation can be expressed as {@code toRawLongValue() + offset}.
* @param value the short value to be written. * @param value the short value to be written.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout. * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
@ -344,7 +344,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param offset offset in bytes (relative to this address). Might be negative. * @param offset offset in bytes (relative to this address). Might be negative.
* The final address of this read operation can be expressed as {@code toRowLongValue() + offset}. * The final address of this read operation can be expressed as {@code toRawLongValue() + offset}.
* @return an int value read from this address. * @return an int value read from this address.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout. * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
@ -365,7 +365,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param offset offset in bytes (relative to this address). Might be negative. * @param offset offset in bytes (relative to this address). Might be negative.
* The final address of this write operation can be expressed as {@code toRowLongValue() + offset}. * The final address of this write operation can be expressed as {@code toRawLongValue() + offset}.
* @param value the int value to be written. * @param value the int value to be written.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout. * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
@ -386,7 +386,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param offset offset in bytes (relative to this address). Might be negative. * @param offset offset in bytes (relative to this address). Might be negative.
* The final address of this read operation can be expressed as {@code toRowLongValue() + offset}. * The final address of this read operation can be expressed as {@code toRawLongValue() + offset}.
* @return a float value read from this address. * @return a float value read from this address.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout. * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
@ -407,7 +407,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param offset offset in bytes (relative to this address). Might be negative. * @param offset offset in bytes (relative to this address). Might be negative.
* The final address of this write operation can be expressed as {@code toRowLongValue() + offset}. * The final address of this write operation can be expressed as {@code toRawLongValue() + offset}.
* @param value the float value to be written. * @param value the float value to be written.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout. * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
@ -428,7 +428,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param offset offset in bytes (relative to this address). Might be negative. * @param offset offset in bytes (relative to this address). Might be negative.
* The final address of this read operation can be expressed as {@code toRowLongValue() + offset}. * The final address of this read operation can be expressed as {@code toRawLongValue() + offset}.
* @return a long value read from this address. * @return a long value read from this address.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout. * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
@ -449,7 +449,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param offset offset in bytes (relative to this address). Might be negative. * @param offset offset in bytes (relative to this address). Might be negative.
* The final address of this write operation can be expressed as {@code toRowLongValue() + offset}. * The final address of this write operation can be expressed as {@code toRawLongValue() + offset}.
* @param value the long value to be written. * @param value the long value to be written.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout. * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
@ -470,7 +470,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param offset offset in bytes (relative to this address). Might be negative. * @param offset offset in bytes (relative to this address). Might be negative.
* The final address of this read operation can be expressed as {@code toRowLongValue() + offset}. * The final address of this read operation can be expressed as {@code toRawLongValue() + offset}.
* @return a double value read from this address. * @return a double value read from this address.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout. * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
@ -491,7 +491,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param offset offset in bytes (relative to this address). Might be negative. * @param offset offset in bytes (relative to this address). Might be negative.
* The final address of this write operation can be expressed as {@code toRowLongValue() + offset}. * The final address of this write operation can be expressed as {@code toRawLongValue() + offset}.
* @param value the double value to be written. * @param value the double value to be written.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout. * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
@ -512,7 +512,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param offset offset in bytes (relative to this address). Might be negative. * @param offset offset in bytes (relative to this address). Might be negative.
* The final address of this read operation can be expressed as {@code toRowLongValue() + offset}. * The final address of this read operation can be expressed as {@code toRawLongValue() + offset}.
* @return an address value read from this address. * @return an address value read from this address.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout. * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
@ -533,7 +533,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param offset offset in bytes (relative to this address). Might be negative. * @param offset offset in bytes (relative to this address). Might be negative.
* The final address of this write operation can be expressed as {@code toRowLongValue() + offset}. * The final address of this write operation can be expressed as {@code toRawLongValue() + offset}.
* @param value the address value to be written. * @param value the address value to be written.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout. * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout.
@ -554,7 +554,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param index index in bytes (relative to this address). Might be negative. * @param index index in bytes (relative to this address). Might be negative.
* The final address of this read operation can be expressed as {@code toRowLongValue() + (index * layout.byteSize())}. * The final address of this read operation can be expressed as {@code toRawLongValue() + (index * layout.byteSize())}.
* @return a char value read from this address. * @return a char value read from this address.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout, * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
@ -576,7 +576,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param index index in bytes (relative to this address). Might be negative. * @param index index in bytes (relative to this address). Might be negative.
* The final address of this write operation can be expressed as {@code toRowLongValue() + (index * layout.byteSize())}. * The final address of this write operation can be expressed as {@code toRawLongValue() + (index * layout.byteSize())}.
* @param value the char value to be written. * @param value the char value to be written.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout, * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
@ -598,7 +598,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param index index in bytes (relative to this address). Might be negative. * @param index index in bytes (relative to this address). Might be negative.
* The final address of this read operation can be expressed as {@code toRowLongValue() + (index * layout.byteSize())}. * The final address of this read operation can be expressed as {@code toRawLongValue() + (index * layout.byteSize())}.
* @return a short value read from this address. * @return a short value read from this address.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout, * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
@ -620,7 +620,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param index index in bytes (relative to this address). Might be negative. * @param index index in bytes (relative to this address). Might be negative.
* The final address of this write operation can be expressed as {@code toRowLongValue() + (index * layout.byteSize())}. * The final address of this write operation can be expressed as {@code toRawLongValue() + (index * layout.byteSize())}.
* @param value the short value to be written. * @param value the short value to be written.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout, * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
@ -642,7 +642,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param index index in bytes (relative to this address). Might be negative. * @param index index in bytes (relative to this address). Might be negative.
* The final address of this read operation can be expressed as {@code toRowLongValue() + (index * layout.byteSize())}. * The final address of this read operation can be expressed as {@code toRawLongValue() + (index * layout.byteSize())}.
* @return an int value read from this address. * @return an int value read from this address.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout, * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
@ -664,7 +664,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param index index in bytes (relative to this address). Might be negative. * @param index index in bytes (relative to this address). Might be negative.
* The final address of this write operation can be expressed as {@code toRowLongValue() + (index * layout.byteSize())}. * The final address of this write operation can be expressed as {@code toRawLongValue() + (index * layout.byteSize())}.
* @param value the int value to be written. * @param value the int value to be written.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout, * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
@ -686,7 +686,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param index index in bytes (relative to this address). Might be negative. * @param index index in bytes (relative to this address). Might be negative.
* The final address of this read operation can be expressed as {@code toRowLongValue() + (index * layout.byteSize())}. * The final address of this read operation can be expressed as {@code toRawLongValue() + (index * layout.byteSize())}.
* @return a float value read from this address. * @return a float value read from this address.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout, * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
@ -708,7 +708,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param index index in bytes (relative to this address). Might be negative. * @param index index in bytes (relative to this address). Might be negative.
* The final address of this write operation can be expressed as {@code toRowLongValue() + (index * layout.byteSize())}. * The final address of this write operation can be expressed as {@code toRawLongValue() + (index * layout.byteSize())}.
* @param value the float value to be written. * @param value the float value to be written.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout, * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
@ -730,7 +730,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param index index in bytes (relative to this address). Might be negative. * @param index index in bytes (relative to this address). Might be negative.
* The final address of this read operation can be expressed as {@code toRowLongValue() + (index * layout.byteSize())}. * The final address of this read operation can be expressed as {@code toRawLongValue() + (index * layout.byteSize())}.
* @return a long value read from this address. * @return a long value read from this address.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout, * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
@ -752,7 +752,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param index index in bytes (relative to this address). Might be negative. * @param index index in bytes (relative to this address). Might be negative.
* The final address of this write operation can be expressed as {@code toRowLongValue() + (index * layout.byteSize())}. * The final address of this write operation can be expressed as {@code toRawLongValue() + (index * layout.byteSize())}.
* @param value the long value to be written. * @param value the long value to be written.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout, * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
@ -774,7 +774,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param index index in bytes (relative to this address). Might be negative. * @param index index in bytes (relative to this address). Might be negative.
* The final address of this read operation can be expressed as {@code toRowLongValue() + (index * layout.byteSize())}. * The final address of this read operation can be expressed as {@code toRawLongValue() + (index * layout.byteSize())}.
* @return a double value read from this address. * @return a double value read from this address.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout, * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
@ -796,7 +796,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param index index in bytes (relative to this address). Might be negative. * @param index index in bytes (relative to this address). Might be negative.
* The final address of this write operation can be expressed as {@code toRowLongValue() + (index * layout.byteSize())}. * The final address of this write operation can be expressed as {@code toRawLongValue() + (index * layout.byteSize())}.
* @param value the double value to be written. * @param value the double value to be written.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout, * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
@ -818,7 +818,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param index index in bytes (relative to this address). Might be negative. * @param index index in bytes (relative to this address). Might be negative.
* The final address of this read operation can be expressed as {@code toRowLongValue() + (index * layout.byteSize())}. * The final address of this read operation can be expressed as {@code toRawLongValue() + (index * layout.byteSize())}.
* @return an address value read from this address. * @return an address value read from this address.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout, * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,
@ -840,7 +840,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param index index in bytes (relative to this address). Might be negative. * @param index index in bytes (relative to this address). Might be negative.
* The final address of this write operation can be expressed as {@code toRowLongValue() + (index * layout.byteSize())}. * The final address of this write operation can be expressed as {@code toRawLongValue() + (index * layout.byteSize())}.
* @param value the address value to be written. * @param value the address value to be written.
* @throws IllegalArgumentException if the dereference operation is * @throws IllegalArgumentException if the dereference operation is
* <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout, * <a href="MemorySegment.html#segment-alignment">incompatible with the alignment constraints</a> in the provided layout,

View file

@ -715,7 +715,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* java.nio.charset.CharsetDecoder} class should be used when more control * java.nio.charset.CharsetDecoder} class should be used when more control
* over the decoding process is required. * over the decoding process is required.
* @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + offset}. * the final address of this read operation can be expressed as {@code address().toRawLongValue() + offset}.
* @return a Java string constructed from the bytes read from the given starting address up to (but not including) * @return a Java string constructed from the bytes read from the given starting address up to (but not including)
* the first {@code '\0'} terminator character (assuming one is found). * the first {@code '\0'} terminator character (assuming one is found).
* @throws IllegalArgumentException if the size of the UTF-8 string is greater than the largest string supported by the platform. * @throws IllegalArgumentException if the size of the UTF-8 string is greater than the largest string supported by the platform.
@ -744,7 +744,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* will appear truncated when read again. * will appear truncated when read again.
* *
* @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + offset}. * the final address of this write operation can be expressed as {@code address().toRawLongValue() + offset}.
* @param str the Java string to be written into this segment. * @param str the Java string to be written into this segment.
* @throws IndexOutOfBoundsException if {@code str.getBytes().length() + offset >= byteSize()}. * @throws IndexOutOfBoundsException if {@code str.getBytes().length() + offset >= byteSize()}.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
@ -1087,7 +1087,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + offset}. * the final address of this read operation can be expressed as {@code address().toRawLongValue() + offset}.
* @return a byte value read from this address. * @return a byte value read from this address.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1108,7 +1108,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + offset}. * the final address of this write operation can be expressed as {@code address().toRawLongValue() + offset}.
* @param value the byte value to be written. * @param value the byte value to be written.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1130,7 +1130,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + offset}. * the final address of this read operation can be expressed as {@code address().toRawLongValue() + offset}.
* @return a boolean value read from this address. * @return a boolean value read from this address.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1151,7 +1151,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + offset}. * the final address of this write operation can be expressed as {@code address().toRawLongValue() + offset}.
* @param value the boolean value to be written. * @param value the boolean value to be written.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1173,7 +1173,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + offset}. * the final address of this read operation can be expressed as {@code address().toRawLongValue() + offset}.
* @return a char value read from this address. * @return a char value read from this address.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1194,7 +1194,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + offset}. * the final address of this write operation can be expressed as {@code address().toRawLongValue() + offset}.
* @param value the char value to be written. * @param value the char value to be written.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1216,7 +1216,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + offset}. * the final address of this read operation can be expressed as {@code address().toRawLongValue() + offset}.
* @return a short value read from this address. * @return a short value read from this address.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1237,7 +1237,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + offset}. * the final address of this write operation can be expressed as {@code address().toRawLongValue() + offset}.
* @param value the short value to be written. * @param value the short value to be written.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1259,7 +1259,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + offset}. * the final address of this read operation can be expressed as {@code address().toRawLongValue() + offset}.
* @return an int value read from this address. * @return an int value read from this address.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1280,7 +1280,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + offset}. * the final address of this write operation can be expressed as {@code address().toRawLongValue() + offset}.
* @param value the int value to be written. * @param value the int value to be written.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1302,7 +1302,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + offset}. * the final address of this read operation can be expressed as {@code address().toRawLongValue() + offset}.
* @return a float value read from this address. * @return a float value read from this address.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1323,7 +1323,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + offset}. * the final address of this write operation can be expressed as {@code address().toRawLongValue() + offset}.
* @param value the float value to be written. * @param value the float value to be written.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1345,7 +1345,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + offset}. * the final address of this read operation can be expressed as {@code address().toRawLongValue() + offset}.
* @return a long value read from this address. * @return a long value read from this address.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1366,7 +1366,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + offset}. * the final address of this write operation can be expressed as {@code address().toRawLongValue() + offset}.
* @param value the long value to be written. * @param value the long value to be written.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1388,7 +1388,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + offset}. * the final address of this read operation can be expressed as {@code address().toRawLongValue() + offset}.
* @return a double value read from this address. * @return a double value read from this address.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1409,7 +1409,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + offset}. * the final address of this write operation can be expressed as {@code address().toRawLongValue() + offset}.
* @param value the double value to be written. * @param value the double value to be written.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1431,7 +1431,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + offset}. * the final address of this read operation can be expressed as {@code address().toRawLongValue() + offset}.
* @return an address value read from this address. * @return an address value read from this address.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1452,7 +1452,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param offset offset in bytes (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + offset}. * the final address of this write operation can be expressed as {@code address().toRawLongValue() + offset}.
* @param value the address value to be written. * @param value the address value to be written.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1474,7 +1474,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}. * the final address of this read operation can be expressed as {@code address().toRawLongValue() + (index * layout.byteSize())}.
* @return a char value read from this address. * @return a char value read from this address.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1498,7 +1498,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}. * the final address of this write operation can be expressed as {@code address().toRawLongValue() + (index * layout.byteSize())}.
* @param value the char value to be written. * @param value the char value to be written.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1523,7 +1523,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}. * the final address of this read operation can be expressed as {@code address().toRawLongValue() + (index * layout.byteSize())}.
* @return a short value read from this address. * @return a short value read from this address.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1547,7 +1547,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}. * the final address of this write operation can be expressed as {@code address().toRawLongValue() + (index * layout.byteSize())}.
* @param value the short value to be written. * @param value the short value to be written.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1572,7 +1572,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}. * the final address of this read operation can be expressed as {@code address().toRawLongValue() + (index * layout.byteSize())}.
* @return an int value read from this address. * @return an int value read from this address.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1596,7 +1596,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}. * the final address of this write operation can be expressed as {@code address().toRawLongValue() + (index * layout.byteSize())}.
* @param value the int value to be written. * @param value the int value to be written.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1621,7 +1621,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}. * the final address of this read operation can be expressed as {@code address().toRawLongValue() + (index * layout.byteSize())}.
* @return a float value read from this address. * @return a float value read from this address.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1645,7 +1645,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}. * the final address of this write operation can be expressed as {@code address().toRawLongValue() + (index * layout.byteSize())}.
* @param value the float value to be written. * @param value the float value to be written.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1670,7 +1670,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}. * the final address of this read operation can be expressed as {@code address().toRawLongValue() + (index * layout.byteSize())}.
* @return a long value read from this address. * @return a long value read from this address.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1694,7 +1694,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}. * the final address of this write operation can be expressed as {@code address().toRawLongValue() + (index * layout.byteSize())}.
* @param value the long value to be written. * @param value the long value to be written.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1719,7 +1719,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}. * the final address of this read operation can be expressed as {@code address().toRawLongValue() + (index * layout.byteSize())}.
* @return a double value read from this address. * @return a double value read from this address.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1743,7 +1743,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}. * the final address of this write operation can be expressed as {@code address().toRawLongValue() + (index * layout.byteSize())}.
* @param value the double value to be written. * @param value the double value to be written.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1768,7 +1768,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be read. * @param layout the layout of the memory region to be read.
* @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this read operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}. * the final address of this read operation can be expressed as {@code address().toRawLongValue() + (index * layout.byteSize())}.
* @return an address value read from this address. * @return an address value read from this address.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.
@ -1792,7 +1792,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory
* *
* @param layout the layout of the memory region to be written. * @param layout the layout of the memory region to be written.
* @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment, * @param index index (relative to this segment). For instance, if this segment is a {@linkplain #isNative() native} segment,
* the final address of this write operation can be expressed as {@code address().toRowLongValue() + (index * layout.byteSize())}. * the final address of this write operation can be expressed as {@code address().toRawLongValue() + (index * layout.byteSize())}.
* @param value the address value to be written. * @param value the address value to be written.
* @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not * @throws IllegalStateException if the {@linkplain #session() session} associated with this segment is not
* {@linkplain MemorySession#isAlive() alive}. * {@linkplain MemorySession#isAlive() alive}.

View file

@ -260,8 +260,8 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
* registers the lambda proxy class for including into the CDS archive. * registers the lambda proxy class for including into the CDS archive.
*/ */
private Class<?> spinInnerClass() throws LambdaConversionException { private Class<?> spinInnerClass() throws LambdaConversionException {
// CDS does not handle disableEagerInitialization. // CDS does not handle disableEagerInitialization or useImplMethodHandle
if (!disableEagerInitialization) { if (!disableEagerInitialization && !useImplMethodHandle) {
// include lambda proxy class in CDS archive at dump time // include lambda proxy class in CDS archive at dump time
if (CDS.isDumpingArchive()) { if (CDS.isDumpingArchive()) {
Class<?> innerClass = generateInnerClass(); Class<?> innerClass = generateInnerClass();

View file

@ -436,6 +436,7 @@ hotspot_appcds_dynamic = \
-runtime/cds/appcds/LambdaProxyClasslist.java \ -runtime/cds/appcds/LambdaProxyClasslist.java \
-runtime/cds/appcds/LambdaVerificationFailedDuringDump.java \ -runtime/cds/appcds/LambdaVerificationFailedDuringDump.java \
-runtime/cds/appcds/LambdaWithJavaAgent.java \ -runtime/cds/appcds/LambdaWithJavaAgent.java \
-runtime/cds/appcds/LambdaWithUseImplMethodHandle.java \
-runtime/cds/appcds/LambdaWithOldClass.java \ -runtime/cds/appcds/LambdaWithOldClass.java \
-runtime/cds/appcds/LongClassListPath.java \ -runtime/cds/appcds/LongClassListPath.java \
-runtime/cds/appcds/LotsOfClasses.java \ -runtime/cds/appcds/LotsOfClasses.java \

View file

@ -0,0 +1,71 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/*
* @test
* @bug 8290417
* @summary CDS cannot archive lambda proxy with useImplMethodHandle
* @requires vm.cds
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds /test/hotspot/jtreg/runtime/cds/appcds/test-classes
* @build pkg1.BaseWithProtectedMethod
* @build pkg2.Child
* @build LambdaWithUseImplMethodHandleApp
* @run driver jdk.test.lib.helpers.ClassFileInstaller -jar test.jar pkg1.BaseWithProtectedMethod pkg2.Child LambdaWithUseImplMethodHandleApp
* @run driver LambdaWithUseImplMethodHandle
*/
import jdk.test.lib.cds.CDSOptions;
import jdk.test.lib.cds.CDSTestUtils;
import jdk.test.lib.helpers.ClassFileInstaller;
public class LambdaWithUseImplMethodHandle {
// See pkg2/Child.jcod for details about the condition that triggers JDK-8290417
public static void main(String[] args) throws Exception {
String appJar = ClassFileInstaller.getJarPath("test.jar");
String mainClass = "LambdaWithUseImplMethodHandleApp";
String expectedMsg = "Called BaseWithProtectedMethod::protectedMethod";
String classList = "LambdaWithUseImplMethodHandle.list";
String archiveName = TestCommon.getNewArchiveName();
// dump class list
CDSTestUtils.dumpClassList(classList, "-cp", appJar, mainClass);
// create archive with the class list
CDSOptions opts = (new CDSOptions())
.addPrefix("-XX:ExtraSharedClassListFile=" + classList,
"-cp", appJar)
.setArchiveName(archiveName);
CDSTestUtils.createArchiveAndCheck(opts);
// run with archive
CDSOptions runOpts = (new CDSOptions())
.addPrefix("-cp", appJar)
.setArchiveName(archiveName)
.setUseVersion(false)
.addSuffix(mainClass);
CDSTestUtils.run(runOpts)
.assertNormalExit(expectedMsg);
}
}

View file

@ -0,0 +1,71 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/*
* @test
* @bug 8290417
* @summary CDS cannot archive lambda proxy with useImplMethodHandle
* @requires vm.cds
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds /test/hotspot/jtreg/runtime/cds/appcds/test-classes
* @build pkg1.BaseWithProtectedMethod
* @build pkg2.Child
* @build LambdaWithUseImplMethodHandleApp
* @build sun.hotspot.WhiteBox
* @run driver jdk.test.lib.helpers.ClassFileInstaller -jar test.jar pkg1.BaseWithProtectedMethod pkg2.Child LambdaWithUseImplMethodHandleApp
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. DynamicLambdaWithUseImplMethodHandle
*/
import jdk.test.lib.helpers.ClassFileInstaller;
public class DynamicLambdaWithUseImplMethodHandle extends DynamicArchiveTestBase {
// See pkg2/Child.jcod for details about the condition that triggers JDK-8290417
public static void main(String[] args) throws Exception {
runTest(DynamicLambdaWithUseImplMethodHandle::test);
}
static void test() throws Exception {
String topArchiveName = getNewArchiveName("top");
String appJar = ClassFileInstaller.getJarPath("test.jar");
String mainClass = "LambdaWithUseImplMethodHandleApp";
String expectedMsg = "Called BaseWithProtectedMethod::protectedMethod";
dump(topArchiveName,
"-Xlog:cds",
"-Xlog:cds+dynamic=debug",
"-cp", appJar, mainClass)
.assertNormalExit(output -> {
output.shouldContain(expectedMsg);
});
run(topArchiveName,
"-Xlog:cds+dynamic=debug,cds=debug",
"-cp", appJar, mainClass)
.assertNormalExit(output -> {
output.shouldContain(expectedMsg)
.shouldHaveExitValue(0);
});
}
}

View file

@ -0,0 +1,34 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
import java.util.Optional;
import pkg2.Child;
public class LambdaWithUseImplMethodHandleApp {
public static void main(String args[]) {
String name = "foo";
Optional<String> opt = Optional.of(name);
(new Child()).test(opt);
}
}

View file

@ -0,0 +1,32 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package pkg1;
public class BaseWithProtectedMethod {
protected void protectedMethod(String s) {
Thread.dumpStack();
System.out.println("Called BaseWithProtectedMethod::protectedMethod(" + s + ")");
}
}

View file

@ -0,0 +1,224 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/*
The following jcod code is generated by
cd hotspot/jtreg/runtime/cds/appcds
cat > test-classes/pkg2/Child.java << EOF
package pkg2;
import java.util.Optional;
import pkg1.BaseWithProtectedMethod;
public class Child extends BaseWithProtectedMethod {
public void test(Optional<String> opt) {
opt.ifPresent(this::protectedMethod);
}
}
EOF
mkdir -p tmp
javac8 -g:none -d tmp test-classes/pkg1/BaseWithProtectedMethod.java test-classes/pkg2/Child.java
java -jar ${ASMTOOL} jdec tmp/pkg2/Child.class >> test-classes/pkg2/Child.jcod
rm -f test-classes/pkg2/Child.java
*/
// NOTES about JDK-8290417
//
// The above Java source file (Child.java) must be compiled with JDK 8 or JDK 11
// in order to trigger JDK-8290417
//
// Javac in JDK 17 generates a public method for accessing the protected method
// in the base class. As a result, InnerClassLambdaMetafactory will not generate
// the proxy class in useImplMethodHandle mode.
//
// public class pkg2.Child extends pkg1.BaseWithProtectedMethod {
// public pkg2.Child();
// Code:
// 0: aload_0
// 1: invokespecial #1 // Method pkg1/BaseWithProtectedMethod."<init>":()V
// 4: return
//
// public void test(java.util.Optional<java.lang.String>);
// Code:
// 0: aload_1
// 1: aload_0
// 2: invokedynamic #7, 0 // InvokeDynamic #0:accept:(Lpkg2/Child;)Ljava/util/function/Consumer;
// 7: invokevirtual #11 // Method java/util/Optional.ifPresent:(Ljava/util/function/Consumer;)V
// 10: return
//
// private static void lambda$test$0(pkg2.Child, java.lang.String);
// Code:
// 0: aload_0
// 1: aload_1
// 2: invokevirtual #17 // Method protectedMethod:(Ljava/lang/String;)V
// 5: return
// }
//
// $ java17 -XX:+UnlockDiagnosticVMOptions -XX:+ShowHiddenFrames -cp test-classes LambdaWithUseImplMethodHandleApp
// java.lang.Exception: Stack trace
// at java.base/java.lang.Thread.dumpStack(Thread.java:1380)
// at pkg1.BaseWithProtectedMethod.protectedMethod(BaseWithProtectedMethod.java:29)
// at pkg2.Child.lambda$test$0(Child.java:8)
// at pkg2.Child$$Lambda$1/0x0000000800c01000.accept(Unknown Source)
// at java.base/java.util.Optional.ifPresent(Optional.java:178)
// at pkg2.Child.test(Child.java:8)
// at LambdaWithUseImplMethodHandleApp.main(LambdaWithUseImplMethodHandleApp.java:32)
class pkg2/Child {
0xCAFEBABE;
0; // minor version
52; // version
[] { // Constant Pool
; // first element is empty
Method #5 #13; // #1
InvokeDynamic 0s #19; // #2
Method #20 #21; // #3
class #22; // #4
class #23; // #5
Utf8 "<init>"; // #6
Utf8 "()V"; // #7
Utf8 "Code"; // #8
Utf8 "test"; // #9
Utf8 "(Ljava/util/Optional;)V"; // #10
Utf8 "Signature"; // #11
Utf8 "(Ljava/util/Optional<Ljava/lang/String;>;)V"; // #12
NameAndType #6 #7; // #13
Utf8 "BootstrapMethods"; // #14
MethodHandle 6b #24; // #15
MethodType #25; // #16
MethodHandle 5b #26; // #17
MethodType #27; // #18
NameAndType #28 #29; // #19
class #30; // #20
NameAndType #31 #32; // #21
Utf8 "pkg2/Child"; // #22
Utf8 "pkg1/BaseWithProtectedMethod"; // #23
Method #33 #34; // #24
Utf8 "(Ljava/lang/Object;)V"; // #25
Method #5 #35; // #26
Utf8 "(Ljava/lang/String;)V"; // #27
Utf8 "accept"; // #28
Utf8 "(Lpkg2/Child;)Ljava/util/function/Consumer;"; // #29
Utf8 "java/util/Optional"; // #30
Utf8 "ifPresent"; // #31
Utf8 "(Ljava/util/function/Consumer;)V"; // #32
class #36; // #33
NameAndType #37 #41; // #34
NameAndType #42 #27; // #35
Utf8 "java/lang/invoke/LambdaMetafactory"; // #36
Utf8 "metafactory"; // #37
class #44; // #38
Utf8 "Lookup"; // #39
Utf8 "InnerClasses"; // #40
Utf8 "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;"; // #41
Utf8 "protectedMethod"; // #42
class #45; // #43
Utf8 "java/lang/invoke/MethodHandles$Lookup"; // #44
Utf8 "java/lang/invoke/MethodHandles"; // #45
} // Constant Pool
0x0021; // access
#4;// this_cpx
#5;// super_cpx
[] { // Interfaces
} // Interfaces
[] { // Fields
} // Fields
[] { // Methods
{ // method
0x0001; // access
#6; // name_index
#7; // descriptor_index
[] { // Attributes
Attr(#8) { // Code
1; // max_stack
1; // max_locals
Bytes[]{
0x2AB70001B1;
}
[] { // Traps
} // end Traps
[] { // Attributes
} // Attributes
} // end Code
} // Attributes
}
;
{ // method
0x0001; // access
#9; // name_index
#10; // descriptor_index
[] { // Attributes
Attr(#8) { // Code
2; // max_stack
2; // max_locals
Bytes[]{
0x2B2ABA00020000B6;
0x0003B1;
}
[] { // Traps
} // end Traps
[] { // Attributes
} // Attributes
} // end Code
;
Attr(#11) { // Signature
#12;
} // end Signature
} // Attributes
}
} // Methods
[] { // Attributes
Attr(#40) { // InnerClasses
[] { // classes
#38 #43 #39 25;
}
} // end InnerClasses
;
Attr(#14) { // BootstrapMethods
[] { // bootstrap_methods
{ // bootstrap_method
#15; // bootstrap_method_ref
[] { // bootstrap_arguments
#16;
#17;
#18;
} // bootstrap_arguments
} // bootstrap_method
}
} // end BootstrapMethods
} // Attributes
} // end class pkg2/Child