diff --git a/src/java.base/share/classes/java/lang/Thread.java b/src/java.base/share/classes/java/lang/Thread.java index f7462193efb..f591bb6104e 100644 --- a/src/java.base/share/classes/java/lang/Thread.java +++ b/src/java.base/share/classes/java/lang/Thread.java @@ -170,13 +170,13 @@ import static java.util.concurrent.TimeUnit.NANOSECONDS; *

Platform threads inherit the daemon status, thread priority, and when not * provided (or not selected by a security manager), the thread group. * - *

Inherited Access Control Context: - * Creating a platform thread {@linkplain AccessController#getContext() captures} the + *

Creating a platform thread {@linkplain AccessController#getContext() captures} the * {@linkplain AccessControlContext caller context} to limit the {@linkplain Permission - * permissions} of {@linkplain AccessController#doPrivileged(PrivilegedAction) privileged - * actions} performed by code in the thread. Creating a virtual thread does not capture - * the caller context; virtual threads have no permissions when executing code that - * performs privileged actions. + * permissions} of the new thread when it executes code that performs a {@linkplain + * AccessController#doPrivileged(PrivilegedAction) privileged action}. The captured + * caller context is the new thread's "Inherited {@link AccessControlContext}". Creating + * a virtual thread does not capture the caller context; virtual threads have no + * permissions when executing code that performs a privileged action. * *

Unless otherwise specified, passing a {@code null} argument to a constructor * or method in this class will cause a {@link NullPointerException} to be thrown. diff --git a/src/java.base/share/classes/java/lang/foreign/MemoryAddress.java b/src/java.base/share/classes/java/lang/foreign/MemoryAddress.java index 8b12bef671e..8633eb45898 100644 --- a/src/java.base/share/classes/java/lang/foreign/MemoryAddress.java +++ b/src/java.base/share/classes/java/lang/foreign/MemoryAddress.java @@ -167,7 +167,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI } /** - * Reads a byte at the given offset from this address, with the given layout. + * Reads a byte from this address at the given offset, with the given layout. *

* This method is restricted. * Restricted methods are unsafe, and, if used incorrectly, their use might crash @@ -188,7 +188,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI byte get(ValueLayout.OfByte layout, long offset); /** - * Writes a byte at the given offset from this address, with the given layout. + * Writes a byte into this address at the given offset, with the given layout. *

* This method is restricted. * Restricted methods are unsafe, and, if used incorrectly, their use might crash @@ -209,7 +209,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI void set(ValueLayout.OfByte layout, long offset, byte value); /** - * Reads a boolean at the given offset from this address, with the given layout. + * Reads a boolean from this address at the given offset, with the given layout. *

* This method is restricted. * Restricted methods are unsafe, and, if used incorrectly, their use might crash @@ -230,7 +230,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI boolean get(ValueLayout.OfBoolean layout, long offset); /** - * Writes a boolean at the given offset from this address, with the given layout. + * Writes a boolean into this address at the given offset, with the given layout. *

* This method is restricted. * Restricted methods are unsafe, and, if used incorrectly, their use might crash @@ -251,7 +251,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI void set(ValueLayout.OfBoolean layout, long offset, boolean value); /** - * Reads a char at the given offset from this address, with the given layout. + * Reads a char from this address at the given offset, with the given layout. *

* This method is restricted. * Restricted methods are unsafe, and, if used incorrectly, their use might crash @@ -272,7 +272,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI char get(ValueLayout.OfChar layout, long offset); /** - * Writes a char at the given offset from this address, with the given layout. + * Writes a char into this address at the given offset, with the given layout. *

* This method is restricted. * Restricted methods are unsafe, and, if used incorrectly, their use might crash @@ -293,7 +293,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI void set(ValueLayout.OfChar layout, long offset, char value); /** - * Reads a short at the given offset from this address, with the given layout. + * Reads a short from this address at the given offset, with the given layout. *

* This method is restricted. * Restricted methods are unsafe, and, if used incorrectly, their use might crash @@ -314,7 +314,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI short get(ValueLayout.OfShort layout, long offset); /** - * Writes a short at the given offset from this address, with the given layout. + * Writes a short into this address at the given offset, with the given layout. *

* This method is restricted. * Restricted methods are unsafe, and, if used incorrectly, their use might crash @@ -335,7 +335,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI void set(ValueLayout.OfShort layout, long offset, short value); /** - * Reads an int at the given offset from this address, with the given layout. + * Reads an int from this address at the given offset, with the given layout. *

* This method is restricted. * Restricted methods are unsafe, and, if used incorrectly, their use might crash @@ -356,7 +356,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI int get(ValueLayout.OfInt layout, long offset); /** - * Writes an int at the given offset from this address, with the given layout. + * Writes an int into this address at the given offset, with the given layout. *

* This method is restricted. * Restricted methods are unsafe, and, if used incorrectly, their use might crash @@ -377,7 +377,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI void set(ValueLayout.OfInt layout, long offset, int value); /** - * Reads a float at the given offset from this address, with the given layout. + * Reads a float from this address at the given offset, with the given layout. *

* This method is restricted. * Restricted methods are unsafe, and, if used incorrectly, their use might crash @@ -398,7 +398,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI float get(ValueLayout.OfFloat layout, long offset); /** - * Writes a float at the given offset from this address, with the given layout. + * Writes a float into this address at the given offset, with the given layout. *

* This method is restricted. * Restricted methods are unsafe, and, if used incorrectly, their use might crash @@ -419,7 +419,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI void set(ValueLayout.OfFloat layout, long offset, float value); /** - * Reads a long at the given offset from this address, with the given layout. + * Reads a long from this address at the given offset, with the given layout. *

* This method is restricted. * Restricted methods are unsafe, and, if used incorrectly, their use might crash @@ -440,7 +440,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI long get(ValueLayout.OfLong layout, long offset); /** - * Writes a long at the given offset from this address, with the given layout. + * Writes a long into this address at the given offset, with the given layout. *

* This method is restricted. * Restricted methods are unsafe, and, if used incorrectly, their use might crash @@ -461,7 +461,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI void set(ValueLayout.OfLong layout, long offset, long value); /** - * Reads a double at the given offset from this address, with the given layout. + * Reads a double from this address at the given offset, with the given layout. *

* This method is restricted. * Restricted methods are unsafe, and, if used incorrectly, their use might crash @@ -482,7 +482,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI double get(ValueLayout.OfDouble layout, long offset); /** - * Writes a double at the given offset from this address, with the given layout. + * Writes a double into this address at the given offset, with the given layout. *

* This method is restricted. * Restricted methods are unsafe, and, if used incorrectly, their use might crash @@ -503,7 +503,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI void set(ValueLayout.OfDouble layout, long offset, double value); /** - * Reads an address at the given offset from this address, with the given layout. + * Reads an address from this address at the given offset, with the given layout. *

* This method is restricted. * Restricted methods are unsafe, and, if used incorrectly, their use might crash @@ -524,7 +524,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI MemoryAddress get(ValueLayout.OfAddress layout, long offset); /** - * Writes an address at the given offset from this address, with the given layout. + * Writes an address into this address at the given offset, with the given layout. *

* This method is restricted. * Restricted methods are unsafe, and, if used incorrectly, their use might crash @@ -567,7 +567,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI char getAtIndex(ValueLayout.OfChar layout, long index); /** - * Writes a char to this address at the given index, scaled by the given layout size. + * Writes a char into this address at the given index, scaled by the given layout size. *

* This method is restricted. * Restricted methods are unsafe, and, if used incorrectly, their use might crash @@ -611,7 +611,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI short getAtIndex(ValueLayout.OfShort layout, long index); /** - * Writes a short to this address at the given index, scaled by the given layout size. + * Writes a short into this address at the given index, scaled by the given layout size. *

* This method is restricted. * Restricted methods are unsafe, and, if used incorrectly, their use might crash @@ -655,7 +655,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI int getAtIndex(ValueLayout.OfInt layout, long index); /** - * Writes an int to this address at the given index, scaled by the given layout size. + * Writes an int into this address at the given index, scaled by the given layout size. *

* This method is restricted. * Restricted methods are unsafe, and, if used incorrectly, their use might crash @@ -699,7 +699,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI float getAtIndex(ValueLayout.OfFloat layout, long index); /** - * Writes a float to this address at the given index, scaled by the given layout size. + * Writes a float into this address at the given index, scaled by the given layout size. *

* This method is restricted. * Restricted methods are unsafe, and, if used incorrectly, their use might crash @@ -743,7 +743,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI long getAtIndex(ValueLayout.OfLong layout, long index); /** - * Writes a long to this address at the given index, scaled by the given layout size. + * Writes a long into this address at the given index, scaled by the given layout size. *

* This method is restricted. * Restricted methods are unsafe, and, if used incorrectly, their use might crash @@ -787,7 +787,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI double getAtIndex(ValueLayout.OfDouble layout, long index); /** - * Writes a double to this address at the given index, scaled by the given layout size. + * Writes a double into this address at the given index, scaled by the given layout size. *

* This method is restricted. * Restricted methods are unsafe, and, if used incorrectly, their use might crash @@ -831,7 +831,7 @@ public sealed interface MemoryAddress extends Addressable permits MemoryAddressI MemoryAddress getAtIndex(ValueLayout.OfAddress layout, long index); /** - * Writes an address to this address at the given index, scaled by the given layout size. + * Writes an address into this address at the given index, scaled by the given layout size. *

* This method is restricted. * Restricted methods are unsafe, and, if used incorrectly, their use might crash diff --git a/src/java.base/share/classes/java/lang/foreign/MemorySegment.java b/src/java.base/share/classes/java/lang/foreign/MemorySegment.java index f2ebc4c278c..f865148ce92 100644 --- a/src/java.base/share/classes/java/lang/foreign/MemorySegment.java +++ b/src/java.base/share/classes/java/lang/foreign/MemorySegment.java @@ -1083,7 +1083,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory } /** - * Reads a byte at the given offset from this segment, with the given layout. + * Reads a byte from this segment at the given offset, with the given layout. * * @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, @@ -1104,7 +1104,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory } /** - * Writes a byte at the given offset from this segment, with the given layout. + * Writes a byte into this segment at the given offset, with the given layout. * * @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, @@ -1126,7 +1126,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory } /** - * Reads a boolean at the given offset from this segment, with the given layout. + * Reads a boolean from this segment at the given offset, with the given layout. * * @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, @@ -1147,7 +1147,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory } /** - * Writes a boolean at the given offset from this segment, with the given layout. + * Writes a boolean into this segment at the given offset, with the given layout. * * @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, @@ -1169,7 +1169,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory } /** - * Reads a char at the given offset from this segment, with the given layout. + * Reads a char from this segment at the given offset, with the given layout. * * @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, @@ -1190,7 +1190,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory } /** - * Writes a char at the given offset from this segment, with the given layout. + * Writes a char into this segment at the given offset, with the given layout. * * @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, @@ -1212,7 +1212,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory } /** - * Reads a short at the given offset from this segment, with the given layout. + * Reads a short from this segment at the given offset, with the given layout. * * @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, @@ -1233,7 +1233,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory } /** - * Writes a short at the given offset from this segment, with the given layout. + * Writes a short into this segment at the given offset, with the given layout. * * @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, @@ -1255,7 +1255,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory } /** - * Reads an int at the given offset from this segment, with the given layout. + * Reads an int from this segment at the given offset, with the given layout. * * @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, @@ -1276,7 +1276,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory } /** - * Writes an int at the given offset from this segment, with the given layout. + * Writes an int into this segment at the given offset, with the given layout. * * @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, @@ -1298,7 +1298,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory } /** - * Reads a float at the given offset from this segment, with the given layout. + * Reads a float from this segment at the given offset, with the given layout. * * @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, @@ -1319,7 +1319,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory } /** - * Writes a float at the given offset from this segment, with the given layout. + * Writes a float into this segment at the given offset, with the given layout. * * @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, @@ -1341,7 +1341,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory } /** - * Reads a long at the given offset from this segment, with the given layout. + * Reads a long from this segment at the given offset, with the given layout. * * @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, @@ -1362,7 +1362,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory } /** - * Writes a long at the given offset from this segment, with the given layout. + * Writes a long into this segment at the given offset, with the given layout. * * @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, @@ -1384,7 +1384,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory } /** - * Reads a double at the given offset from this segment, with the given layout. + * Reads a double from this segment at the given offset, with the given layout. * * @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, @@ -1405,7 +1405,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory } /** - * Writes a double at the given offset from this segment, with the given layout. + * Writes a double into this segment at the given offset, with the given layout. * * @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, @@ -1427,7 +1427,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory } /** - * Reads an address at the given offset from this segment, with the given layout. + * Reads an address from this segment at the given offset, with the given layout. * * @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, @@ -1448,7 +1448,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory } /** - * Writes an address at the given offset from this segment, with the given layout. + * Writes an address into this segment at the given offset, with the given layout. * * @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, @@ -1494,7 +1494,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory } /** - * Writes a char to this segment at the given index, scaled by the given layout size. + * Writes a char into this segment at the given index, scaled by the given layout size. * * @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, @@ -1543,7 +1543,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory } /** - * Writes a short to this segment at the given index, scaled by the given layout size. + * Writes a short into this segment at the given index, scaled by the given layout size. * * @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, @@ -1592,7 +1592,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory } /** - * Writes an int to this segment at the given index, scaled by the given layout size. + * Writes an int into this segment at the given index, scaled by the given layout size. * * @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, @@ -1641,7 +1641,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory } /** - * Writes a float to this segment at the given index, scaled by the given layout size. + * Writes a float into this segment at the given index, scaled by the given layout size. * * @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, @@ -1690,7 +1690,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory } /** - * Writes a long to this segment at the given index, scaled by the given layout size. + * Writes a long into this segment at the given index, scaled by the given layout size. * * @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, @@ -1739,7 +1739,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory } /** - * Writes a double to this segment at the given index, scaled by the given layout size. + * Writes a double into this segment at the given index, scaled by the given layout size. * * @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, @@ -1788,7 +1788,7 @@ public sealed interface MemorySegment extends Addressable permits AbstractMemory } /** - * Writes an address to this segment at the given index, scaled by the given layout size. + * Writes an address into this segment at the given index, scaled by the given layout size. * * @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, diff --git a/src/java.base/share/classes/java/lang/foreign/SegmentAllocator.java b/src/java.base/share/classes/java/lang/foreign/SegmentAllocator.java index 6687936d48c..57bd9e704da 100644 --- a/src/java.base/share/classes/java/lang/foreign/SegmentAllocator.java +++ b/src/java.base/share/classes/java/lang/foreign/SegmentAllocator.java @@ -319,6 +319,9 @@ public interface SegmentAllocator { */ default MemorySegment allocateArray(MemoryLayout elementLayout, long count) { Objects.requireNonNull(elementLayout); + if (count < 0) { + throw new IllegalArgumentException("Negative array size"); + } return allocate(MemoryLayout.sequenceLayout(count, elementLayout)); } diff --git a/src/java.base/share/classes/jdk/internal/foreign/ArenaAllocator.java b/src/java.base/share/classes/jdk/internal/foreign/ArenaAllocator.java index 2a1a10648d8..0ae38e3dc39 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/ArenaAllocator.java +++ b/src/java.base/share/classes/jdk/internal/foreign/ArenaAllocator.java @@ -78,7 +78,9 @@ public final class ArenaAllocator implements SegmentAllocator { return slice; } else { long maxPossibleAllocationSize = bytesSize + bytesAlignment - 1; - if (maxPossibleAllocationSize > blockSize) { + if (maxPossibleAllocationSize < 0) { + throw new OutOfMemoryError(); + } else if (maxPossibleAllocationSize > blockSize) { // too big return newSegment(bytesSize, bytesAlignment); } else { diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 6e8a4be75b8..dc8e0f0f1aa 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -148,6 +148,7 @@ vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/TestDescription.ja vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/TestDescription.java 8219652 aix-ppc64 vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/TestDescription.java 8219652 aix-ppc64 vmTestbase/nsk/jvmti/AttachOnDemand/attach002a/TestDescription.java 8277812 generic-all +vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/TestDescription.java 8073470 linux-all vmTestbase/gc/lock/jni/jnilock002/TestDescription.java 8192647 generic-all diff --git a/test/jdk/ProblemList-svc-vthread.txt b/test/jdk/ProblemList-svc-vthread.txt index a8537f61a91..7c495d0d677 100644 --- a/test/jdk/ProblemList-svc-vthread.txt +++ b/test/jdk/ProblemList-svc-vthread.txt @@ -1,3 +1,25 @@ +# +# 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. +# com/sun/jdi/EATests.java#id0 8264699 generic-all @@ -33,6 +55,8 @@ com/sun/jdi/StepTest.java 8285422 generic-all com/sun/jdi/redefine/RedefineTest.java 8285422 generic-all com/sun/jdi/redefineMethod/RedefineTest.java 8285422 generic-all +com/sun/jdi/InvokeHangTest.java 8290200 macosx-x64 + #### # JDI SDE Tests # Use custom classpath @@ -42,5 +66,3 @@ com/sun/jdi/sde/MangleTest.java 8285423 generic-all com/sun/jdi/sde/MangleStepTest.java 8285423 generic-all com/sun/jdi/sde/TemperatureTableTest.java 8285423 generic-all com/sun/jdi/sde/SourceDebugExtensionTest.java 8285423 generic-all - -com/sun/jdi/EATests.java#id0 8264699 generic-all diff --git a/test/jdk/java/foreign/TestSegmentAllocators.java b/test/jdk/java/foreign/TestSegmentAllocators.java index 1bbb7014cc4..a5cca846dc5 100644 --- a/test/jdk/java/foreign/TestSegmentAllocators.java +++ b/test/jdk/java/foreign/TestSegmentAllocators.java @@ -160,6 +160,17 @@ public class TestSegmentAllocators { allocator.allocate(1, 3); } + @Test(dataProvider = "allocators", expectedExceptions = IllegalArgumentException.class) + public void testBadAllocationArrayNegSize(SegmentAllocator allocator) { + allocator.allocateArray(ValueLayout.JAVA_BYTE, -1); + } + + @Test(expectedExceptions = OutOfMemoryError.class) + public void testBadArenaNullReturn() { + SegmentAllocator segmentAllocator = SegmentAllocator.newNativeArena(MemorySession.openImplicit()); + segmentAllocator.allocate(Long.MAX_VALUE, 2); + } + @Test public void testArrayAllocateDelegation() { AtomicInteger calls = new AtomicInteger(); diff --git a/test/jdk/java/nio/channels/FileChannel/largeMemory/LargeGatheringWrite.java b/test/jdk/java/nio/channels/FileChannel/largeMemory/LargeGatheringWrite.java index f9663359cbe..49a8ca1e0c5 100644 --- a/test/jdk/java/nio/channels/FileChannel/largeMemory/LargeGatheringWrite.java +++ b/test/jdk/java/nio/channels/FileChannel/largeMemory/LargeGatheringWrite.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 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 @@ -29,7 +29,7 @@ * @library .. * @library /test/lib * @build jdk.test.lib.RandomFactory - * @run main/othervm/timeout=240 -Xmx4G LargeGatheringWrite + * @run main/othervm/timeout=480 -Xmx4G LargeGatheringWrite * @key randomness */ import java.io.IOException; @@ -51,7 +51,17 @@ public class LargeGatheringWrite { private static final Random RND = RandomFactory.getRandom(); + private static long t0; + + private static void printTime(String msg) { + System.out.printf("TIMESTAMP: %-16s: %f seconds%n", msg, + (System.nanoTime() - t0)/1000000000.0); + } + public static void main(String[] args) throws IOException { + t0 = System.nanoTime(); + printTime("start"); + // Create direct and heap buffers ByteBuffer direct = ByteBuffer.allocateDirect(GB); ByteBuffer heap = ByteBuffer.allocate(GB); @@ -83,6 +93,7 @@ public class LargeGatheringWrite { // Write the data to a temporary file Path tempFile = Files.createTempFile("LargeGatheringWrite", ".dat"); + printTime("before writing"); System.out.printf("Writing %d bytes of data...%n", totalLength); try (FileChannel fcw = FileChannel.open(tempFile, CREATE, WRITE);) { // Print size of individual writes and total number written @@ -93,11 +104,14 @@ public class LargeGatheringWrite { bytesWritten += n; } System.out.printf("Total of %d bytes written\n", bytesWritten); + printTime("after writing"); // Verify the content written try (FileChannel fcr = FileChannel.open(tempFile, READ);) { byte[] bytes = null; for (ByteBuffer buf : bigBuffers) { + printTime("before verifying"); + // For each buffer read the corresponding number of bytes buf.rewind(); int length = buf.remaining(); @@ -117,10 +131,13 @@ public class LargeGatheringWrite { String msg = String.format("mismatch: %d%n", mismatch); throw new RuntimeException(msg); } + + printTime("after verifying"); } } } finally { Files.delete(tempFile); } + printTime("end"); } }