8304919: Implementation of Virtual Threads
Reviewed-by: lmesnik, cjplummer, psandoz, mchung, sspitsyn, jpai
This commit is contained in:
parent
39398075b7
commit
2586f36120
@ -1498,11 +1498,9 @@ JavaThreadStatus java_lang_Thread_FieldHolder::get_thread_status(oop holder) {
|
||||
|
||||
|
||||
int java_lang_Thread_Constants::_static_VTHREAD_GROUP_offset = 0;
|
||||
int java_lang_Thread_Constants::_static_NOT_SUPPORTED_CLASSLOADER_offset = 0;
|
||||
|
||||
#define THREAD_CONSTANTS_STATIC_FIELDS_DO(macro) \
|
||||
macro(_static_VTHREAD_GROUP_offset, k, "VTHREAD_GROUP", threadgroup_signature, true); \
|
||||
macro(_static_NOT_SUPPORTED_CLASSLOADER_offset, k, "NOT_SUPPORTED_CLASSLOADER", classloader_signature, true);
|
||||
macro(_static_VTHREAD_GROUP_offset, k, "VTHREAD_GROUP", threadgroup_signature, true);
|
||||
|
||||
void java_lang_Thread_Constants::compute_offsets() {
|
||||
assert(_static_VTHREAD_GROUP_offset == 0, "offsets should be initialized only once");
|
||||
@ -1523,11 +1521,6 @@ oop java_lang_Thread_Constants::get_VTHREAD_GROUP() {
|
||||
return base->obj_field(_static_VTHREAD_GROUP_offset);
|
||||
}
|
||||
|
||||
oop java_lang_Thread_Constants::get_NOT_SUPPORTED_CLASSLOADER() {
|
||||
InstanceKlass* k = vmClasses::Thread_Constants_klass();
|
||||
oop base = k->static_field_base_raw();
|
||||
return base->obj_field(_static_NOT_SUPPORTED_CLASSLOADER_offset);
|
||||
}
|
||||
|
||||
int java_lang_Thread::_holder_offset;
|
||||
int java_lang_Thread::_name_offset;
|
||||
|
@ -475,7 +475,6 @@ class java_lang_Thread_Constants : AllStatic {
|
||||
|
||||
public:
|
||||
static oop get_VTHREAD_GROUP();
|
||||
static oop get_NOT_SUPPORTED_CLASSLOADER();
|
||||
|
||||
friend class JavaClasses;
|
||||
};
|
||||
|
@ -102,7 +102,7 @@
|
||||
#include "jfr/jfr.hpp"
|
||||
#endif
|
||||
|
||||
static jint CurrentVersion = JNI_VERSION_20;
|
||||
static jint CurrentVersion = JNI_VERSION_21;
|
||||
|
||||
#if defined(_WIN32) && !defined(USE_VECTORED_EXCEPTION_HANDLING)
|
||||
extern LONG WINAPI topLevelExceptionFilter(_EXCEPTION_POINTERS* );
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<?xml-stylesheet type="text/xsl" href="jvmti.xsl"?>
|
||||
<!--
|
||||
Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2002, 2023, 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
|
||||
@ -1724,13 +1724,9 @@ jvmtiEnv *jvmti;
|
||||
</errors>
|
||||
</function>
|
||||
|
||||
<function id="SuspendAllVirtualThreads" num="118" since="19">
|
||||
<function id="SuspendAllVirtualThreads" num="118" since="21">
|
||||
<synopsis>Suspend All Virtual Threads</synopsis>
|
||||
<description>
|
||||
<b> SuspendAllVirtualThreads is a preview API of the Java platform. </b>
|
||||
<i>Preview features may be removed in a future release, or upgraded to
|
||||
permanent features of the Java platform.</i>
|
||||
<p/>
|
||||
Suspend all virtual threads except those in the exception list.
|
||||
Virtual threads that are currently suspended do not change state.
|
||||
Virtual threads may be resumed with
|
||||
@ -1850,13 +1846,9 @@ jvmtiEnv *jvmti;
|
||||
</errors>
|
||||
</function>
|
||||
|
||||
<function id="ResumeAllVirtualThreads" num="119" since="19">
|
||||
<function id="ResumeAllVirtualThreads" num="119" since="21">
|
||||
<synopsis>Resume All Virtual Threads</synopsis>
|
||||
<description>
|
||||
<b> ResumeAllVirtualThreads is a preview API of the Java platform. </b>
|
||||
<i>Preview features may be removed in a future release, or upgraded to
|
||||
permanent features of the Java platform.</i>
|
||||
<p/>
|
||||
Resume all virtual threads except those in the exception list.
|
||||
Virtual threads that are currently resumed do not change state.
|
||||
Virtual threads may be suspended with
|
||||
@ -10650,12 +10642,8 @@ myInit() {
|
||||
called and <eventlink id="SampledObjectAlloc"></eventlink> events can be generated.
|
||||
</description>
|
||||
</capabilityfield>
|
||||
<capabilityfield id="can_support_virtual_threads" since="19">
|
||||
<capabilityfield id="can_support_virtual_threads" since="21">
|
||||
<description>
|
||||
<b> can_support_virtual_threads is a preview API of the Java platform. </b>
|
||||
<i>Preview features may be removed in a future release, or upgraded to
|
||||
permanent features of the Java platform.</i>
|
||||
<p/>
|
||||
Can support virtual threads.
|
||||
If this capability is enabled then the following functions can be called:
|
||||
<functionlink id="SuspendAllVirtualThreads"></functionlink>,
|
||||
@ -13038,12 +13026,8 @@ myInit() {
|
||||
</event>
|
||||
|
||||
<event label="Virtual Thread Start"
|
||||
id="VirtualThreadStart" const="JVMTI_EVENT_VIRTUAL_THREAD_START" filtered="thread" num="87" phase="start" since="19">
|
||||
id="VirtualThreadStart" const="JVMTI_EVENT_VIRTUAL_THREAD_START" filtered="thread" num="87" phase="start" since="21">
|
||||
<description>
|
||||
<b> VirtualThreadStart is a preview API of the Java platform. </b>
|
||||
<i>Preview features may be removed in a future release, or upgraded to
|
||||
permanent features of the Java platform.</i>
|
||||
<p/>
|
||||
A virtual thread start event is generated before its initial method executes.
|
||||
<p/>
|
||||
The event is sent on the newly started <paramlink id="virtual_thread"></paramlink>.
|
||||
@ -13071,12 +13055,8 @@ myInit() {
|
||||
</event>
|
||||
|
||||
<event label="Virtual Thread End"
|
||||
id="VirtualThreadEnd" const="JVMTI_EVENT_VIRTUAL_THREAD_END" filtered="thread" num="88" phase="start" since="19">
|
||||
id="VirtualThreadEnd" const="JVMTI_EVENT_VIRTUAL_THREAD_END" filtered="thread" num="88" phase="start" since="21">
|
||||
<description>
|
||||
<b> VirtualThreadEnd is a preview API of the Java platform. </b>
|
||||
<i>Preview features may be removed in a future release, or upgraded to
|
||||
permanent features of the Java platform.</i>
|
||||
<p/>
|
||||
A virtual thread end event is generated after its initial method has finished execution.
|
||||
<p/>
|
||||
The event is sent on the terminating <paramlink id="virtual_thread"></paramlink>.
|
||||
|
@ -1311,13 +1311,6 @@ JvmtiEnv::GetThreadInfo(jthread thread, jvmtiThreadInfo* info_ptr) {
|
||||
}
|
||||
|
||||
oop loader = java_lang_Thread::context_class_loader(thread_obj());
|
||||
if (loader != nullptr) {
|
||||
// Do the same as Thread.getContextClassLoader and set context_class_loader to be
|
||||
// the system class loader when the field value is the "not supported" placeholder.
|
||||
if (loader == java_lang_Thread_Constants::get_NOT_SUPPORTED_CLASSLOADER()) {
|
||||
loader = SystemDictionary::java_system_loader();
|
||||
}
|
||||
}
|
||||
context_class_loader = Handle(current_thread, loader);
|
||||
|
||||
{ const char *n;
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2002, 2023, 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
|
||||
@ -116,6 +116,7 @@ enum {
|
||||
JVMTI_VERSION_9 = 0x30090000,
|
||||
JVMTI_VERSION_11 = 0x300B0000,
|
||||
JVMTI_VERSION_19 = 0x30130000,
|
||||
JVMTI_VERSION_21 = 0x30150000,
|
||||
|
||||
JVMTI_VERSION = 0x30000000 + (</xsl:text>
|
||||
<xsl:value-of select="$majorversion"/>
|
||||
|
@ -1141,7 +1141,6 @@ void JvmtiTagMap::iterate_through_heap(jint heap_filter,
|
||||
const void* user_data)
|
||||
{
|
||||
// EA based optimizations on tagged objects are already reverted.
|
||||
// disabled if vritual threads are enabled with --enable-preview
|
||||
EscapeBarrier eb(!(heap_filter & JVMTI_HEAP_FILTER_UNTAGGED), JavaThread::current());
|
||||
eb.deoptimize_objects_all_threads();
|
||||
|
||||
|
@ -173,6 +173,12 @@ int StackWalk::fill_in_frames(jlong mode, BaseFrameStream& stream,
|
||||
|
||||
int frames_decoded = 0;
|
||||
for (; !stream.at_end(); stream.next()) {
|
||||
if (stream.continuation() != nullptr && stream.continuation() != stream.reg_map()->cont()) {
|
||||
// The code in StackStreamFactory.java has failed to set the continuation because frameBuffer.isAtBottom()
|
||||
// returns false if the end of a continuation falls precisely at the end of the batch.
|
||||
// By breaking here, we're signalling the Java code to set the continuation to the parent.
|
||||
break;
|
||||
}
|
||||
assert(stream.continuation() == nullptr || stream.continuation() == stream.reg_map()->cont(), "");
|
||||
Method* method = stream.method();
|
||||
|
||||
@ -190,6 +196,8 @@ int StackWalk::fill_in_frames(jlong mode, BaseFrameStream& stream,
|
||||
method->print_short_name(&ls);
|
||||
ls.cr();
|
||||
}
|
||||
// We end a batch on continuation bottom to let the Java side skip top frames of the next one
|
||||
if (stream.continuation() != nullptr && method->intrinsic_id() == vmIntrinsics::_Continuation_enter) break;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -576,7 +584,7 @@ jint StackWalk::fetchNextBatch(Handle stackStream, jlong mode, jlong magic,
|
||||
if (!stream.at_end()) {
|
||||
int n = fill_in_frames(mode, stream, frame_count, start_index,
|
||||
frames_array, end_index, CHECK_0);
|
||||
if (n < 1) {
|
||||
if (n < 1 && !skip_hidden_frames(mode)) {
|
||||
THROW_MSG_(vmSymbols::java_lang_InternalError(), "doStackWalk: later decode failed", 0L);
|
||||
}
|
||||
return end_index;
|
||||
|
@ -1159,6 +1159,7 @@ jboolean Threads::is_supported_jni_version(jint version) {
|
||||
if (version == JNI_VERSION_10) return JNI_TRUE;
|
||||
if (version == JNI_VERSION_19) return JNI_TRUE;
|
||||
if (version == JNI_VERSION_20) return JNI_TRUE;
|
||||
if (version == JNI_VERSION_21) return JNI_TRUE;
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,6 @@ import jdk.internal.vm.ThreadContainer;
|
||||
import jdk.internal.vm.annotation.ForceInline;
|
||||
import jdk.internal.vm.annotation.IntrinsicCandidate;
|
||||
import jdk.internal.vm.annotation.Stable;
|
||||
import jdk.internal.vm.annotation.ChangesCurrentThread;
|
||||
import sun.nio.fs.DefaultFileSystemProvider;
|
||||
import sun.reflect.annotation.AnnotationType;
|
||||
import sun.nio.ch.Interruptible;
|
||||
@ -2567,17 +2566,9 @@ public final class System {
|
||||
return Thread.currentCarrierThread();
|
||||
}
|
||||
|
||||
@ChangesCurrentThread
|
||||
public <V> V executeOnCarrierThread(Callable<V> task) throws Exception {
|
||||
Thread thread = Thread.currentThread();
|
||||
if (thread.isVirtual()) {
|
||||
Thread carrier = Thread.currentCarrierThread();
|
||||
carrier.setCurrentThread(carrier);
|
||||
try {
|
||||
return task.call();
|
||||
} finally {
|
||||
carrier.setCurrentThread(thread);
|
||||
}
|
||||
if (Thread.currentThread() instanceof VirtualThread vthread) {
|
||||
return vthread.executeOnCarrierThread(task);
|
||||
} else {
|
||||
return task.call();
|
||||
}
|
||||
|
@ -38,11 +38,7 @@ import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.locks.LockSupport;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Stream;
|
||||
import jdk.internal.event.ThreadSleepEvent;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
import jdk.internal.misc.PreviewFeatures;
|
||||
import jdk.internal.misc.StructureViolationExceptions;
|
||||
import jdk.internal.misc.TerminatingThreadLocal;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
@ -56,6 +52,7 @@ import jdk.internal.vm.ThreadContainer;
|
||||
import jdk.internal.vm.annotation.ForceInline;
|
||||
import jdk.internal.vm.annotation.Hidden;
|
||||
import jdk.internal.vm.annotation.IntrinsicCandidate;
|
||||
import jdk.internal.vm.annotation.Stable;
|
||||
import sun.nio.ch.Interruptible;
|
||||
import sun.security.util.SecurityConstants;
|
||||
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||
@ -84,11 +81,11 @@ import static java.util.concurrent.TimeUnit.NANOSECONDS;
|
||||
*
|
||||
* <p> Threads support {@link ThreadLocal} variables. These are variables that are
|
||||
* local to a thread, meaning a thread can have a copy of a variable that is set to
|
||||
* a value that is independent of the value set by other threads. Thread also supports
|
||||
* {@link InheritableThreadLocal} variables that are thread local variables that are
|
||||
* inherited at Thread creation time from the parent Thread. Thread supports a special
|
||||
* inheritable thread local for the thread {@linkplain #getContextClassLoader()
|
||||
* context-class-loader}.
|
||||
* a value that is independent of the value set by other threads. {@code Thread} also
|
||||
* supports {@link InheritableThreadLocal} variables that are thread local variables
|
||||
* that are inherited at thread creation time from the parent {@code Thread}.
|
||||
* {@code Thread} supports a special inheritable thread local for the thread
|
||||
* {@linkplain #getContextClassLoader() context-class-loader}.
|
||||
*
|
||||
* <h2><a id="platform-threads">Platform threads</a></h2>
|
||||
* <p> {@code Thread} supports the creation of <i>platform threads</i> that are
|
||||
@ -279,7 +276,8 @@ public class Thread implements Runnable {
|
||||
|
||||
/*
|
||||
* ThreadLocal values pertaining to this thread. This map is maintained
|
||||
* by the ThreadLocal class. */
|
||||
* by the ThreadLocal class.
|
||||
*/
|
||||
ThreadLocal.ThreadLocalMap threadLocals;
|
||||
|
||||
/*
|
||||
@ -450,6 +448,36 @@ public class Thread implements Runnable {
|
||||
|
||||
private static native void yield0();
|
||||
|
||||
/**
|
||||
* Called before sleeping to create a jdk.ThreadSleep event.
|
||||
*/
|
||||
private static ThreadSleepEvent beforeSleep(long nanos) {
|
||||
ThreadSleepEvent event = null;
|
||||
if (ThreadSleepEvent.isTurnedOn()) {
|
||||
try {
|
||||
event = new ThreadSleepEvent();
|
||||
event.time = nanos;
|
||||
event.begin();
|
||||
} catch (OutOfMemoryError e) {
|
||||
event = null;
|
||||
}
|
||||
}
|
||||
return event;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after sleeping to commit the jdk.ThreadSleep event.
|
||||
*/
|
||||
private static void afterSleep(ThreadSleepEvent event) {
|
||||
if (event != null) {
|
||||
try {
|
||||
event.commit();
|
||||
} catch (OutOfMemoryError e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Causes the currently executing thread to sleep (temporarily cease
|
||||
* execution) for the specified number of milliseconds, subject to
|
||||
@ -472,23 +500,16 @@ public class Thread implements Runnable {
|
||||
throw new IllegalArgumentException("timeout value is negative");
|
||||
}
|
||||
|
||||
if (currentThread() instanceof VirtualThread vthread) {
|
||||
long nanos = MILLISECONDS.toNanos(millis);
|
||||
vthread.sleepNanos(nanos);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ThreadSleepEvent.isTurnedOn()) {
|
||||
ThreadSleepEvent event = new ThreadSleepEvent();
|
||||
try {
|
||||
event.time = MILLISECONDS.toNanos(millis);
|
||||
event.begin();
|
||||
long nanos = MILLISECONDS.toNanos(millis);
|
||||
ThreadSleepEvent event = beforeSleep(nanos);
|
||||
try {
|
||||
if (currentThread() instanceof VirtualThread vthread) {
|
||||
vthread.sleepNanos(nanos);
|
||||
} else {
|
||||
sleep0(millis);
|
||||
} finally {
|
||||
event.commit();
|
||||
}
|
||||
} else {
|
||||
sleep0(millis);
|
||||
} finally {
|
||||
afterSleep(event);
|
||||
}
|
||||
}
|
||||
|
||||
@ -525,18 +546,24 @@ public class Thread implements Runnable {
|
||||
throw new IllegalArgumentException("nanosecond timeout value out of range");
|
||||
}
|
||||
|
||||
if (currentThread() instanceof VirtualThread vthread) {
|
||||
// total sleep time, in nanoseconds
|
||||
long totalNanos = MILLISECONDS.toNanos(millis);
|
||||
totalNanos += Math.min(Long.MAX_VALUE - totalNanos, nanos);
|
||||
vthread.sleepNanos(totalNanos);
|
||||
return;
|
||||
}
|
||||
// total sleep time, in nanoseconds
|
||||
long totalNanos = MILLISECONDS.toNanos(millis);
|
||||
totalNanos += Math.min(Long.MAX_VALUE - totalNanos, nanos);
|
||||
|
||||
if (nanos > 0 && millis < Long.MAX_VALUE) {
|
||||
millis++;
|
||||
ThreadSleepEvent event = beforeSleep(totalNanos);
|
||||
try {
|
||||
if (currentThread() instanceof VirtualThread vthread) {
|
||||
vthread.sleepNanos(totalNanos);
|
||||
} else {
|
||||
// millisecond precision
|
||||
if (nanos > 0 && millis < Long.MAX_VALUE) {
|
||||
millis++;
|
||||
}
|
||||
sleep0(millis);
|
||||
}
|
||||
} finally {
|
||||
afterSleep(event);
|
||||
}
|
||||
sleep(millis);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -557,20 +584,25 @@ public class Thread implements Runnable {
|
||||
*/
|
||||
public static void sleep(Duration duration) throws InterruptedException {
|
||||
long nanos = NANOSECONDS.convert(duration); // MAX_VALUE if > 292 years
|
||||
if (nanos < 0)
|
||||
return;
|
||||
|
||||
if (currentThread() instanceof VirtualThread vthread) {
|
||||
vthread.sleepNanos(nanos);
|
||||
if (nanos < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// convert to milliseconds
|
||||
long millis = MILLISECONDS.convert(nanos, NANOSECONDS);
|
||||
if (nanos > NANOSECONDS.convert(millis, MILLISECONDS)) {
|
||||
millis += 1L;
|
||||
ThreadSleepEvent event = beforeSleep(nanos);
|
||||
try {
|
||||
if (currentThread() instanceof VirtualThread vthread) {
|
||||
vthread.sleepNanos(nanos);
|
||||
} else {
|
||||
// millisecond precision
|
||||
long millis = NANOSECONDS.toMillis(nanos);
|
||||
if (nanos > MILLISECONDS.toNanos(millis)) {
|
||||
millis += 1L;
|
||||
}
|
||||
sleep0(millis);
|
||||
}
|
||||
} finally {
|
||||
afterSleep(event);
|
||||
}
|
||||
sleep(millis);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -612,13 +644,6 @@ public class Thread implements Runnable {
|
||||
@IntrinsicCandidate
|
||||
public static void onSpinWait() {}
|
||||
|
||||
/**
|
||||
* Characteristic value signifying that the thread cannot set values for its
|
||||
* copy of {@link ThreadLocal thread-locals}.
|
||||
* See Thread initialization.
|
||||
*/
|
||||
static final int NO_THREAD_LOCALS = 1 << 1;
|
||||
|
||||
/**
|
||||
* Characteristic value signifying that initial values for {@link
|
||||
* InheritableThreadLocal inheritable-thread-locals} are not inherited from
|
||||
@ -658,8 +683,7 @@ public class Thread implements Runnable {
|
||||
return parent.getContextClassLoader();
|
||||
} else {
|
||||
// skip call to getContextClassLoader
|
||||
ClassLoader cl = parent.contextClassLoader;
|
||||
return (isSupportedClassLoader(cl)) ? cl : ClassLoader.getSystemClassLoader();
|
||||
return parent.contextClassLoader;
|
||||
}
|
||||
}
|
||||
|
||||
@ -728,23 +752,13 @@ public class Thread implements Runnable {
|
||||
|
||||
// thread locals
|
||||
if (!attached) {
|
||||
if ((characteristics & NO_THREAD_LOCALS) != 0) {
|
||||
this.threadLocals = ThreadLocal.ThreadLocalMap.NOT_SUPPORTED;
|
||||
this.inheritableThreadLocals = ThreadLocal.ThreadLocalMap.NOT_SUPPORTED;
|
||||
this.contextClassLoader = Constants.NOT_SUPPORTED_CLASSLOADER;
|
||||
} else if ((characteristics & NO_INHERIT_THREAD_LOCALS) == 0) {
|
||||
if ((characteristics & NO_INHERIT_THREAD_LOCALS) == 0) {
|
||||
ThreadLocal.ThreadLocalMap parentMap = parent.inheritableThreadLocals;
|
||||
if (parentMap != null
|
||||
&& parentMap != ThreadLocal.ThreadLocalMap.NOT_SUPPORTED
|
||||
&& parentMap.size() > 0) {
|
||||
if (parentMap != null && parentMap.size() > 0) {
|
||||
this.inheritableThreadLocals = ThreadLocal.createInheritedMap(parentMap);
|
||||
}
|
||||
ClassLoader parentLoader = contextClassLoader(parent);
|
||||
if (VM.isBooted() && !isSupportedClassLoader(parentLoader)) {
|
||||
// parent does not support thread locals so no CCL to inherit
|
||||
this.contextClassLoader = ClassLoader.getSystemClassLoader();
|
||||
} else {
|
||||
this.contextClassLoader = parentLoader;
|
||||
if (VM.isBooted()) {
|
||||
this.contextClassLoader = contextClassLoader(parent);
|
||||
}
|
||||
} else if (VM.isBooted()) {
|
||||
// default CCL to the system class loader when not inheriting
|
||||
@ -752,7 +766,7 @@ public class Thread implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
// Special value to indicate this is a newly-created Thread
|
||||
// special value to indicate this is a newly-created Thread
|
||||
// Note that his must match the declaration in ScopedValue.
|
||||
this.scopedValueBindings = NEW_THREAD_BINDINGS;
|
||||
}
|
||||
@ -770,31 +784,19 @@ public class Thread implements Runnable {
|
||||
this.inheritedAccessControlContext = Constants.NO_PERMISSIONS_ACC;
|
||||
|
||||
// thread locals
|
||||
if ((characteristics & NO_THREAD_LOCALS) != 0) {
|
||||
this.threadLocals = ThreadLocal.ThreadLocalMap.NOT_SUPPORTED;
|
||||
this.inheritableThreadLocals = ThreadLocal.ThreadLocalMap.NOT_SUPPORTED;
|
||||
this.contextClassLoader = Constants.NOT_SUPPORTED_CLASSLOADER;
|
||||
} else if ((characteristics & NO_INHERIT_THREAD_LOCALS) == 0) {
|
||||
if ((characteristics & NO_INHERIT_THREAD_LOCALS) == 0) {
|
||||
Thread parent = currentThread();
|
||||
ThreadLocal.ThreadLocalMap parentMap = parent.inheritableThreadLocals;
|
||||
if (parentMap != null
|
||||
&& parentMap != ThreadLocal.ThreadLocalMap.NOT_SUPPORTED
|
||||
&& parentMap.size() > 0) {
|
||||
if (parentMap != null && parentMap.size() > 0) {
|
||||
this.inheritableThreadLocals = ThreadLocal.createInheritedMap(parentMap);
|
||||
}
|
||||
ClassLoader parentLoader = contextClassLoader(parent);
|
||||
if (isSupportedClassLoader(parentLoader)) {
|
||||
this.contextClassLoader = parentLoader;
|
||||
} else {
|
||||
// parent does not support thread locals so no CCL to inherit
|
||||
this.contextClassLoader = ClassLoader.getSystemClassLoader();
|
||||
}
|
||||
this.contextClassLoader = contextClassLoader(parent);
|
||||
} else {
|
||||
// default CCL to the system class loader when not inheriting
|
||||
this.contextClassLoader = ClassLoader.getSystemClassLoader();
|
||||
}
|
||||
|
||||
// Special value to indicate this is a newly-created Thread
|
||||
// special value to indicate this is a newly-created Thread
|
||||
this.scopedValueBindings = NEW_THREAD_BINDINGS;
|
||||
|
||||
// create a FieldHolder object, needed when bound to an OS thread
|
||||
@ -837,9 +839,8 @@ public class Thread implements Runnable {
|
||||
* }
|
||||
*
|
||||
* @return A builder for creating {@code Thread} or {@code ThreadFactory} objects.
|
||||
* @since 19
|
||||
* @since 21
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.VIRTUAL_THREADS)
|
||||
public static Builder.OfPlatform ofPlatform() {
|
||||
return new ThreadBuilders.PlatformThreadBuilder();
|
||||
}
|
||||
@ -858,12 +859,9 @@ public class Thread implements Runnable {
|
||||
* }
|
||||
*
|
||||
* @return A builder for creating {@code Thread} or {@code ThreadFactory} objects.
|
||||
* @throws UnsupportedOperationException if preview features are not enabled
|
||||
* @since 19
|
||||
* @since 21
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.VIRTUAL_THREADS)
|
||||
public static Builder.OfVirtual ofVirtual() {
|
||||
PreviewFeatures.ensureEnabled();
|
||||
return new ThreadBuilders.VirtualThreadBuilder();
|
||||
}
|
||||
|
||||
@ -893,14 +891,10 @@ public class Thread implements Runnable {
|
||||
*
|
||||
* @see Thread#ofPlatform()
|
||||
* @see Thread#ofVirtual()
|
||||
* @since 19
|
||||
* @since 21
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.VIRTUAL_THREADS)
|
||||
public sealed interface Builder
|
||||
permits Builder.OfPlatform,
|
||||
Builder.OfVirtual,
|
||||
ThreadBuilders.BaseThreadBuilder {
|
||||
|
||||
permits Builder.OfPlatform, Builder.OfVirtual {
|
||||
|
||||
/**
|
||||
* Sets the thread name.
|
||||
@ -936,37 +930,11 @@ public class Thread implements Runnable {
|
||||
*/
|
||||
Builder name(String prefix, long start);
|
||||
|
||||
/**
|
||||
* Sets whether the thread is allowed to set values for its copy of {@linkplain
|
||||
* ThreadLocal thread-local} variables. The default is to allow. If not allowed,
|
||||
* then any attempt by the thread to set a value for a thread-local with the
|
||||
* {@link ThreadLocal#set(Object)} method throws {@code
|
||||
* UnsupportedOperationException}. Any attempt to set the thread's context
|
||||
* class loader with {@link Thread#setContextClassLoader(ClassLoader)
|
||||
* setContextClassLoader} also throws. The {@link ThreadLocal#get()} method
|
||||
* always returns the {@linkplain ThreadLocal#initialValue() initial-value}
|
||||
* when thread locals are not allowed.
|
||||
*
|
||||
* @apiNote This method is intended for cases where there are a large number of
|
||||
* threads and where potentially unbounded memory usage due to thread locals is
|
||||
* a concern. Disallowing a thread to set its copy of thread-local variables
|
||||
* creates the potential for exceptions at run-time so great care is required
|
||||
* when the thread is used to invoke arbitrary code.
|
||||
*
|
||||
* @param allow {@code true} to allow, {@code false} to disallow
|
||||
* @return this builder
|
||||
*/
|
||||
Builder allowSetThreadLocals(boolean allow);
|
||||
|
||||
/**
|
||||
* Sets whether the thread inherits the initial values of {@linkplain
|
||||
* InheritableThreadLocal inheritable-thread-local} variables from the
|
||||
* constructing thread. The default is to inherit.
|
||||
*
|
||||
* <p> The initial values of {@code InheritableThreadLocal}s are never inherited
|
||||
* when {@link #allowSetThreadLocals(boolean)} is used to disallow the thread
|
||||
* to have its own copy of thread-local variables.
|
||||
*
|
||||
* @param inherit {@code true} to inherit, {@code false} to not inherit
|
||||
* @return this builder
|
||||
*/
|
||||
@ -1025,9 +993,8 @@ public class Thread implements Runnable {
|
||||
* this interface causes a {@code NullPointerException} to be thrown.
|
||||
*
|
||||
* @see Thread#ofPlatform()
|
||||
* @since 19
|
||||
* @since 21
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.VIRTUAL_THREADS)
|
||||
sealed interface OfPlatform extends Builder
|
||||
permits ThreadBuilders.PlatformThreadBuilder {
|
||||
|
||||
@ -1038,7 +1005,6 @@ public class Thread implements Runnable {
|
||||
*/
|
||||
@Override OfPlatform name(String prefix, long start);
|
||||
|
||||
@Override OfPlatform allowSetThreadLocals(boolean allow);
|
||||
@Override OfPlatform inheritInheritableThreadLocals(boolean inherit);
|
||||
@Override OfPlatform uncaughtExceptionHandler(UncaughtExceptionHandler ueh);
|
||||
|
||||
@ -1101,9 +1067,8 @@ public class Thread implements Runnable {
|
||||
* this interface causes a {@code NullPointerException} to be thrown.
|
||||
*
|
||||
* @see Thread#ofVirtual()
|
||||
* @since 19
|
||||
* @since 21
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.VIRTUAL_THREADS)
|
||||
sealed interface OfVirtual extends Builder
|
||||
permits ThreadBuilders.VirtualThreadBuilder {
|
||||
|
||||
@ -1114,7 +1079,6 @@ public class Thread implements Runnable {
|
||||
*/
|
||||
@Override OfVirtual name(String prefix, long start);
|
||||
|
||||
@Override OfVirtual allowSetThreadLocals(boolean allow);
|
||||
@Override OfVirtual inheritInheritableThreadLocals(boolean inherit);
|
||||
@Override OfVirtual uncaughtExceptionHandler(UncaughtExceptionHandler ueh);
|
||||
}
|
||||
@ -1532,14 +1496,11 @@ public class Thread implements Runnable {
|
||||
*
|
||||
* @param task the object to run when the thread executes
|
||||
* @return a new, and started, virtual thread
|
||||
* @throws UnsupportedOperationException if preview features are not enabled
|
||||
* @see <a href="#inheritance">Inheritance when creating threads</a>
|
||||
* @since 19
|
||||
* @since 21
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.VIRTUAL_THREADS)
|
||||
public static Thread startVirtualThread(Runnable task) {
|
||||
Objects.requireNonNull(task);
|
||||
PreviewFeatures.ensureEnabled();
|
||||
var thread = ThreadBuilders.newVirtualThread(null, null, 0, task);
|
||||
thread.start();
|
||||
return thread;
|
||||
@ -1551,9 +1512,8 @@ public class Thread implements Runnable {
|
||||
*
|
||||
* @return {@code true} if this thread is a virtual thread
|
||||
*
|
||||
* @since 19
|
||||
* @since 21
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.VIRTUAL_THREADS)
|
||||
public final boolean isVirtual() {
|
||||
return (this instanceof BaseVirtualThread);
|
||||
}
|
||||
@ -1588,6 +1548,8 @@ public class Thread implements Runnable {
|
||||
throw new IllegalThreadStateException();
|
||||
|
||||
// bind thread to container
|
||||
if (this.container != null)
|
||||
throw new IllegalThreadStateException();
|
||||
setThreadContainer(container);
|
||||
|
||||
// start thread
|
||||
@ -1662,15 +1624,17 @@ public class Thread implements Runnable {
|
||||
* a chance to clean up before it actually exits.
|
||||
*/
|
||||
private void exit() {
|
||||
// pop any remaining scopes from the stack, this may block
|
||||
if (headStackableScopes != null) {
|
||||
StackableScope.popAll();
|
||||
}
|
||||
|
||||
// notify container that thread is exiting
|
||||
ThreadContainer container = threadContainer();
|
||||
if (container != null) {
|
||||
container.onExit(this);
|
||||
try {
|
||||
// pop any remaining scopes from the stack, this may block
|
||||
if (headStackableScopes != null) {
|
||||
StackableScope.popAll();
|
||||
}
|
||||
} finally {
|
||||
// notify container that thread is exiting
|
||||
ThreadContainer container = threadContainer();
|
||||
if (container != null) {
|
||||
container.onExit(this);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
@ -2383,8 +2347,6 @@ public class Thread implements Runnable {
|
||||
ClassLoader cl = this.contextClassLoader;
|
||||
if (cl == null)
|
||||
return null;
|
||||
if (!isSupportedClassLoader(cl))
|
||||
cl = ClassLoader.getSystemClassLoader();
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
@ -2400,10 +2362,6 @@ public class Thread implements Runnable {
|
||||
* <p> The context {@code ClassLoader} may be set by the creator of the thread
|
||||
* for use by code running in this thread when loading classes and resources.
|
||||
*
|
||||
* <p> The context {@code ClassLoader} cannot be set when the thread is
|
||||
* {@linkplain Thread.Builder#allowSetThreadLocals(boolean) not allowed} to have
|
||||
* its own copy of thread local variables.
|
||||
*
|
||||
* <p> If a security manager is present, its {@link
|
||||
* SecurityManager#checkPermission(java.security.Permission) checkPermission}
|
||||
* method is invoked with a {@link RuntimePermission RuntimePermission}{@code
|
||||
@ -2414,9 +2372,6 @@ public class Thread implements Runnable {
|
||||
* the context ClassLoader for this Thread, or null indicating the
|
||||
* system class loader (or, failing that, the bootstrap class loader)
|
||||
*
|
||||
* @throws UnsupportedOperationException if this thread is not allowed
|
||||
* to set values for its copy of thread-local variables
|
||||
*
|
||||
* @throws SecurityException
|
||||
* if the current thread cannot set the context ClassLoader
|
||||
*
|
||||
@ -2428,27 +2383,9 @@ public class Thread implements Runnable {
|
||||
if (sm != null) {
|
||||
sm.checkPermission(new RuntimePermission("setContextClassLoader"));
|
||||
}
|
||||
if (!isSupportedClassLoader(contextClassLoader)) {
|
||||
throw new UnsupportedOperationException(
|
||||
"The context class loader cannot be set");
|
||||
}
|
||||
contextClassLoader = cl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given ClassLoader is a "supported" class loader. All
|
||||
* class loaders, except ClassLoaders.NOT_SUPPORTED, are considered supported.
|
||||
* This method allows the initialization of ClassLoaders to be delayed until
|
||||
* it is required.
|
||||
*/
|
||||
private static boolean isSupportedClassLoader(ClassLoader loader) {
|
||||
if (loader == null)
|
||||
return true;
|
||||
if (loader == jdk.internal.loader.ClassLoaders.appClassLoader())
|
||||
return true;
|
||||
return loader != Constants.NOT_SUPPORTED_CLASSLOADER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if and only if the current thread holds the
|
||||
* monitor lock on the specified object.
|
||||
@ -2985,9 +2922,6 @@ public class Thread implements Runnable {
|
||||
@SuppressWarnings("removal")
|
||||
static final AccessControlContext NO_PERMISSIONS_ACC;
|
||||
|
||||
// Placeholder TCCL when thread locals not supported
|
||||
static final ClassLoader NOT_SUPPORTED_CLASSLOADER;
|
||||
|
||||
static {
|
||||
var getThreadGroup = new PrivilegedAction<ThreadGroup>() {
|
||||
@Override
|
||||
@ -3005,16 +2939,6 @@ public class Thread implements Runnable {
|
||||
NO_PERMISSIONS_ACC = new AccessControlContext(new ProtectionDomain[] {
|
||||
new ProtectionDomain(null, null)
|
||||
});
|
||||
|
||||
var createClassLoader = new PrivilegedAction<ClassLoader>() {
|
||||
@Override
|
||||
public ClassLoader run() {
|
||||
return new ClassLoader(null) { };
|
||||
}
|
||||
};
|
||||
@SuppressWarnings("removal")
|
||||
ClassLoader loader = AccessController.doPrivileged(createClassLoader);
|
||||
NOT_SUPPORTED_CLASSLOADER = loader;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3040,7 +2964,7 @@ public class Thread implements Runnable {
|
||||
int threadLocalRandomSecondarySeed;
|
||||
|
||||
/** The thread container that this thread is in */
|
||||
private volatile ThreadContainer container; // @Stable candidate?
|
||||
private @Stable ThreadContainer container;
|
||||
ThreadContainer threadContainer() {
|
||||
return container;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2023, 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
|
||||
@ -24,7 +24,6 @@
|
||||
*/
|
||||
package java.lang;
|
||||
|
||||
import java.lang.Thread.Builder;
|
||||
import java.lang.Thread.Builder.OfPlatform;
|
||||
import java.lang.Thread.Builder.OfVirtual;
|
||||
import java.lang.Thread.UncaughtExceptionHandler;
|
||||
@ -41,12 +40,12 @@ import jdk.internal.vm.ContinuationSupport;
|
||||
* Defines static methods to create platform and virtual thread builders.
|
||||
*/
|
||||
class ThreadBuilders {
|
||||
private ThreadBuilders() { }
|
||||
|
||||
/**
|
||||
* Base implementation of ThreadBuilder.
|
||||
* Base class for Thread.Builder implementations.
|
||||
*/
|
||||
static abstract non-sealed
|
||||
class BaseThreadBuilder<T extends Builder> implements Builder {
|
||||
private static class BaseThreadBuilder {
|
||||
private String name;
|
||||
private long counter;
|
||||
private int characteristics;
|
||||
@ -76,52 +75,29 @@ class ThreadBuilders {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public T name(String name) {
|
||||
void setName(String name) {
|
||||
this.name = Objects.requireNonNull(name);
|
||||
this.counter = -1;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public T name(String prefix, long start) {
|
||||
void setName(String prefix, long start) {
|
||||
Objects.requireNonNull(prefix);
|
||||
if (start < 0)
|
||||
throw new IllegalArgumentException("'start' is negative");
|
||||
this.name = prefix;
|
||||
this.counter = start;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public T allowSetThreadLocals(boolean allow) {
|
||||
if (allow) {
|
||||
characteristics &= ~Thread.NO_THREAD_LOCALS;
|
||||
} else {
|
||||
characteristics |= Thread.NO_THREAD_LOCALS;
|
||||
}
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public T inheritInheritableThreadLocals(boolean inherit) {
|
||||
void setInheritInheritableThreadLocals(boolean inherit) {
|
||||
if (inherit) {
|
||||
characteristics &= ~Thread.NO_INHERIT_THREAD_LOCALS;
|
||||
} else {
|
||||
characteristics |= Thread.NO_INHERIT_THREAD_LOCALS;
|
||||
}
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public T uncaughtExceptionHandler(UncaughtExceptionHandler ueh) {
|
||||
void setUncaughtExceptionHandler(UncaughtExceptionHandler ueh) {
|
||||
this.uhe = Objects.requireNonNull(ueh);
|
||||
return (T) this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,7 +105,7 @@ class ThreadBuilders {
|
||||
* ThreadBuilder.OfPlatform implementation.
|
||||
*/
|
||||
static final class PlatformThreadBuilder
|
||||
extends BaseThreadBuilder<OfPlatform> implements OfPlatform {
|
||||
extends BaseThreadBuilder implements OfPlatform {
|
||||
private ThreadGroup group;
|
||||
private boolean daemon;
|
||||
private boolean daemonChanged;
|
||||
@ -145,6 +121,30 @@ class ThreadBuilders {
|
||||
return (name != null) ? name : Thread.genThreadName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public OfPlatform name(String name) {
|
||||
setName(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OfPlatform name(String prefix, long start) {
|
||||
setName(prefix, start);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OfPlatform inheritInheritableThreadLocals(boolean inherit) {
|
||||
setInheritInheritableThreadLocals(inherit);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OfPlatform uncaughtExceptionHandler(UncaughtExceptionHandler ueh) {
|
||||
setUncaughtExceptionHandler(ueh);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OfPlatform group(ThreadGroup group) {
|
||||
this.group = Objects.requireNonNull(group);
|
||||
@ -208,7 +208,7 @@ class ThreadBuilders {
|
||||
* ThreadBuilder.OfVirtual implementation.
|
||||
*/
|
||||
static final class VirtualThreadBuilder
|
||||
extends BaseThreadBuilder<OfVirtual> implements OfVirtual {
|
||||
extends BaseThreadBuilder implements OfVirtual {
|
||||
private Executor scheduler;
|
||||
|
||||
VirtualThreadBuilder() {
|
||||
@ -221,6 +221,30 @@ class ThreadBuilders {
|
||||
this.scheduler = Objects.requireNonNull(scheduler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OfVirtual name(String name) {
|
||||
setName(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OfVirtual name(String prefix, long start) {
|
||||
setName(prefix, start);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OfVirtual inheritInheritableThreadLocals(boolean inherit) {
|
||||
setInheritInheritableThreadLocals(inherit);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OfVirtual uncaughtExceptionHandler(UncaughtExceptionHandler ueh) {
|
||||
setUncaughtExceptionHandler(ueh);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread unstarted(Runnable task) {
|
||||
Objects.requireNonNull(task);
|
||||
|
@ -29,9 +29,11 @@ import java.lang.ref.WeakReference;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import jdk.internal.misc.CarrierThreadLocal;
|
||||
import jdk.internal.misc.TerminatingThreadLocal;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
/**
|
||||
* This class provides thread-local variables. These variables differ from
|
||||
@ -77,6 +79,8 @@ import jdk.internal.misc.TerminatingThreadLocal;
|
||||
* @since 1.2
|
||||
*/
|
||||
public class ThreadLocal<T> {
|
||||
private static final boolean TRACE_VTHREAD_LOCALS = traceVirtualThreadLocals();
|
||||
|
||||
/**
|
||||
* ThreadLocals rely on per-thread linear-probe hash maps attached
|
||||
* to each thread (Thread.threadLocals and
|
||||
@ -161,11 +165,8 @@ public class ThreadLocal<T> {
|
||||
* thread-local variable. If the variable has no value for the
|
||||
* current thread, it is first initialized to the value returned
|
||||
* by an invocation of the {@link #initialValue} method.
|
||||
* If the current thread does not support thread locals then
|
||||
* this method returns its {@link #initialValue}.
|
||||
*
|
||||
* @return the current thread's value of this thread-local
|
||||
* @see Thread.Builder#allowSetThreadLocals(boolean)
|
||||
*/
|
||||
public T get() {
|
||||
return get(Thread.currentThread());
|
||||
@ -183,15 +184,11 @@ public class ThreadLocal<T> {
|
||||
private T get(Thread t) {
|
||||
ThreadLocalMap map = getMap(t);
|
||||
if (map != null) {
|
||||
if (map == ThreadLocalMap.NOT_SUPPORTED) {
|
||||
return initialValue();
|
||||
} else {
|
||||
ThreadLocalMap.Entry e = map.getEntry(this);
|
||||
if (e != null) {
|
||||
@SuppressWarnings("unchecked")
|
||||
T result = (T) e.value;
|
||||
return result;
|
||||
}
|
||||
ThreadLocalMap.Entry e = map.getEntry(this);
|
||||
if (e != null) {
|
||||
@SuppressWarnings("unchecked")
|
||||
T result = (T) e.value;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return setInitialValue(t);
|
||||
@ -211,7 +208,7 @@ public class ThreadLocal<T> {
|
||||
|
||||
private boolean isPresent(Thread t) {
|
||||
ThreadLocalMap map = getMap(t);
|
||||
if (map != null && map != ThreadLocalMap.NOT_SUPPORTED) {
|
||||
if (map != null) {
|
||||
return map.getEntry(this) != null;
|
||||
} else {
|
||||
return false;
|
||||
@ -227,7 +224,6 @@ public class ThreadLocal<T> {
|
||||
private T setInitialValue(Thread t) {
|
||||
T value = initialValue();
|
||||
ThreadLocalMap map = getMap(t);
|
||||
assert map != ThreadLocalMap.NOT_SUPPORTED;
|
||||
if (map != null) {
|
||||
map.set(this, value);
|
||||
} else {
|
||||
@ -236,6 +232,9 @@ public class ThreadLocal<T> {
|
||||
if (this instanceof TerminatingThreadLocal<?> ttl) {
|
||||
TerminatingThreadLocal.register(ttl);
|
||||
}
|
||||
if (TRACE_VTHREAD_LOCALS) {
|
||||
dumpStackIfVirtualThread();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -247,14 +246,12 @@ public class ThreadLocal<T> {
|
||||
*
|
||||
* @param value the value to be stored in the current thread's copy of
|
||||
* this thread-local.
|
||||
*
|
||||
* @throws UnsupportedOperationException if the current thread is not
|
||||
* allowed to set its copy of thread-local variables
|
||||
*
|
||||
* @see Thread.Builder#allowSetThreadLocals(boolean)
|
||||
*/
|
||||
public void set(T value) {
|
||||
set(Thread.currentThread(), value);
|
||||
if (TRACE_VTHREAD_LOCALS) {
|
||||
dumpStackIfVirtualThread();
|
||||
}
|
||||
}
|
||||
|
||||
void setCarrierThreadLocal(T value) {
|
||||
@ -264,9 +261,6 @@ public class ThreadLocal<T> {
|
||||
|
||||
private void set(Thread t, T value) {
|
||||
ThreadLocalMap map = getMap(t);
|
||||
if (map == ThreadLocalMap.NOT_SUPPORTED) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
if (map != null) {
|
||||
map.set(this, value);
|
||||
} else {
|
||||
@ -296,7 +290,7 @@ public class ThreadLocal<T> {
|
||||
|
||||
private void remove(Thread t) {
|
||||
ThreadLocalMap m = getMap(t);
|
||||
if (m != null && m != ThreadLocalMap.NOT_SUPPORTED) {
|
||||
if (m != null) {
|
||||
m.remove(this);
|
||||
}
|
||||
}
|
||||
@ -394,9 +388,6 @@ public class ThreadLocal<T> {
|
||||
}
|
||||
}
|
||||
|
||||
// Placeholder when thread locals not supported
|
||||
static final ThreadLocalMap NOT_SUPPORTED = new ThreadLocalMap();
|
||||
|
||||
/**
|
||||
* The initial capacity -- MUST be a power of two.
|
||||
*/
|
||||
@ -807,4 +798,43 @@ public class ThreadLocal<T> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reads the value of the jdk.traceVirtualThreadLocals property to determine if
|
||||
* a stack trace should be printed when a virtual thread sets a thread local.
|
||||
*/
|
||||
private static boolean traceVirtualThreadLocals() {
|
||||
String propValue = GetPropertyAction.privilegedGetProperty("jdk.traceVirtualThreadLocals");
|
||||
return (propValue != null)
|
||||
&& (propValue.isEmpty() || Boolean.parseBoolean(propValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a stack trace if the current thread is a virtual thread.
|
||||
*/
|
||||
static void dumpStackIfVirtualThread() {
|
||||
if (Thread.currentThread() instanceof VirtualThread vthread) {
|
||||
try {
|
||||
var stack = StackWalkerHolder.STACK_WALKER.walk(s ->
|
||||
s.skip(1) // skip caller
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
// switch to carrier thread to avoid recursive use of thread-locals
|
||||
vthread.executeOnCarrierThread(() -> {
|
||||
System.out.println(vthread);
|
||||
for (StackWalker.StackFrame frame : stack) {
|
||||
System.out.format(" %s%n", frame.toStackTraceElement());
|
||||
}
|
||||
return null;
|
||||
});
|
||||
} catch (Exception e) {
|
||||
throw new InternalError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class StackWalkerHolder {
|
||||
static final StackWalker STACK_WALKER = StackWalker.getInstance();
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2023, 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,6 +29,7 @@ import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Executors;
|
||||
@ -40,7 +41,6 @@ import java.util.concurrent.Future;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
import jdk.internal.event.ThreadSleepEvent;
|
||||
import jdk.internal.event.VirtualThreadEndEvent;
|
||||
import jdk.internal.event.VirtualThreadPinnedEvent;
|
||||
import jdk.internal.event.VirtualThreadStartEvent;
|
||||
@ -58,6 +58,7 @@ import jdk.internal.vm.annotation.ForceInline;
|
||||
import jdk.internal.vm.annotation.Hidden;
|
||||
import jdk.internal.vm.annotation.IntrinsicCandidate;
|
||||
import jdk.internal.vm.annotation.JvmtiMountTransition;
|
||||
import jdk.internal.vm.annotation.ReservedStackAccess;
|
||||
import sun.nio.ch.Interruptible;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
import static java.util.concurrent.TimeUnit.*;
|
||||
@ -175,7 +176,7 @@ final class VirtualThread extends BaseVirtualThread {
|
||||
*/
|
||||
private static class VThreadContinuation extends Continuation {
|
||||
VThreadContinuation(VirtualThread vthread, Runnable task) {
|
||||
super(VTHREAD_SCOPE, () -> vthread.run(task));
|
||||
super(VTHREAD_SCOPE, wrap(vthread, task));
|
||||
}
|
||||
@Override
|
||||
protected void onPinned(Continuation.Pinned reason) {
|
||||
@ -184,6 +185,14 @@ final class VirtualThread extends BaseVirtualThread {
|
||||
PinnedThreadPrinter.printStackTrace(System.out, printAll);
|
||||
}
|
||||
}
|
||||
private static Runnable wrap(VirtualThread vthread, Runnable task) {
|
||||
return new Runnable() {
|
||||
@Hidden
|
||||
public void run() {
|
||||
vthread.run(task);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -211,13 +220,13 @@ final class VirtualThread extends BaseVirtualThread {
|
||||
}
|
||||
|
||||
// notify JVMTI before mount
|
||||
notifyJvmtiMount(true, firstRun);
|
||||
notifyJvmtiMount(/*hide*/true, firstRun);
|
||||
|
||||
try {
|
||||
cont.run();
|
||||
} finally {
|
||||
if (cont.isDone()) {
|
||||
afterTerminate(/*executed*/ true);
|
||||
afterTerminate();
|
||||
} else {
|
||||
afterYield();
|
||||
}
|
||||
@ -291,7 +300,7 @@ final class VirtualThread extends BaseVirtualThread {
|
||||
|
||||
// first mount
|
||||
mount();
|
||||
notifyJvmtiMount(false, true);
|
||||
notifyJvmtiMount(/*hide*/false, /*first*/true);
|
||||
|
||||
// emit JFR event if enabled
|
||||
if (VirtualThreadStartEvent.isTurnedOn()) {
|
||||
@ -319,7 +328,7 @@ final class VirtualThread extends BaseVirtualThread {
|
||||
|
||||
} finally {
|
||||
// last unmount
|
||||
notifyJvmtiUnmount(true, true);
|
||||
notifyJvmtiUnmount(/*hide*/true, /*last*/true);
|
||||
unmount();
|
||||
|
||||
// final state
|
||||
@ -341,6 +350,7 @@ final class VirtualThread extends BaseVirtualThread {
|
||||
* return, the current thread is the virtual thread.
|
||||
*/
|
||||
@ChangesCurrentThread
|
||||
@ReservedStackAccess
|
||||
private void mount() {
|
||||
// sets the carrier thread
|
||||
Thread carrier = Thread.currentCarrierThread();
|
||||
@ -367,6 +377,7 @@ final class VirtualThread extends BaseVirtualThread {
|
||||
* current thread is the current platform thread.
|
||||
*/
|
||||
@ChangesCurrentThread
|
||||
@ReservedStackAccess
|
||||
private void unmount() {
|
||||
// set Thread.currentThread() to return the platform thread
|
||||
Thread carrier = this.carrierThread;
|
||||
@ -404,22 +415,37 @@ final class VirtualThread extends BaseVirtualThread {
|
||||
notifyJvmtiHideFrames(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the given value returning task on the current carrier thread.
|
||||
*/
|
||||
@ChangesCurrentThread
|
||||
<V> V executeOnCarrierThread(Callable<V> task) throws Exception {
|
||||
assert Thread.currentThread() == this;
|
||||
switchToCarrierThread();
|
||||
try {
|
||||
return task.call();
|
||||
} finally {
|
||||
switchToVirtualThread(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unmounts this virtual thread, invokes Continuation.yield, and re-mounts the
|
||||
* thread when continued. When enabled, JVMTI must be notified from this method.
|
||||
* @return true if the yield was successful
|
||||
*/
|
||||
@Hidden
|
||||
@ChangesCurrentThread
|
||||
private boolean yieldContinuation() {
|
||||
// unmount
|
||||
notifyJvmtiUnmount(true, false);
|
||||
notifyJvmtiUnmount(/*hide*/true, /*last*/false);
|
||||
unmount();
|
||||
try {
|
||||
return Continuation.yield(VTHREAD_SCOPE);
|
||||
} finally {
|
||||
// re-mount
|
||||
mount();
|
||||
notifyJvmtiMount(false, false);
|
||||
notifyJvmtiMount(/*hide*/false, /*first*/false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -436,7 +462,7 @@ final class VirtualThread extends BaseVirtualThread {
|
||||
setState(PARKED);
|
||||
|
||||
// notify JVMTI that unmount has completed, thread is parked
|
||||
notifyJvmtiUnmount(false, false);
|
||||
notifyJvmtiUnmount(/*hide*/false, /*last*/false);
|
||||
|
||||
// may have been unparked while parking
|
||||
if (parkPermit && compareAndSetState(PARKED, RUNNABLE)) {
|
||||
@ -452,7 +478,7 @@ final class VirtualThread extends BaseVirtualThread {
|
||||
setState(RUNNABLE);
|
||||
|
||||
// notify JVMTI that unmount has completed, thread is runnable
|
||||
notifyJvmtiUnmount(false, false);
|
||||
notifyJvmtiUnmount(/*hide*/false, /*last*/false);
|
||||
|
||||
// external submit if there are no tasks in the local task queue
|
||||
if (currentThread() instanceof CarrierThread ct && ct.getQueuedTaskCount() == 0) {
|
||||
@ -463,17 +489,26 @@ final class VirtualThread extends BaseVirtualThread {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked after the thread terminates execution. It notifies anyone
|
||||
* waiting for the thread to terminate.
|
||||
*/
|
||||
private void afterTerminate() {
|
||||
afterTerminate(true, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked after the thread terminates (or start failed). This method
|
||||
* notifies anyone waiting for the thread to terminate.
|
||||
*
|
||||
* @param notifyContainer true if its container should be notified
|
||||
* @param executed true if the thread executed, false if it failed to start
|
||||
*/
|
||||
private void afterTerminate(boolean executed) {
|
||||
private void afterTerminate(boolean notifyContainer, boolean executed) {
|
||||
assert (state() == TERMINATED) && (carrierThread == null);
|
||||
|
||||
if (executed) {
|
||||
notifyJvmtiUnmount(false, true);
|
||||
notifyJvmtiUnmount(/*hide*/false, /*last*/true);
|
||||
}
|
||||
|
||||
// notify anyone waiting for this virtual thread to terminate
|
||||
@ -483,13 +518,13 @@ final class VirtualThread extends BaseVirtualThread {
|
||||
termination.countDown();
|
||||
}
|
||||
|
||||
if (executed) {
|
||||
// notify container if thread executed
|
||||
// notify container
|
||||
if (notifyContainer) {
|
||||
threadContainer().onExit(this);
|
||||
|
||||
// clear references to thread locals
|
||||
clearReferences();
|
||||
}
|
||||
|
||||
// clear references to thread locals
|
||||
clearReferences();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -506,12 +541,16 @@ final class VirtualThread extends BaseVirtualThread {
|
||||
}
|
||||
|
||||
// bind thread to container
|
||||
assert threadContainer() == null;
|
||||
setThreadContainer(container);
|
||||
|
||||
// start thread
|
||||
boolean addedToContainer = false;
|
||||
boolean started = false;
|
||||
container.onStart(this); // may throw
|
||||
try {
|
||||
container.onStart(this); // may throw
|
||||
addedToContainer = true;
|
||||
|
||||
// scoped values may be inherited
|
||||
inheritScopedValueBindings(container);
|
||||
|
||||
@ -521,8 +560,7 @@ final class VirtualThread extends BaseVirtualThread {
|
||||
} finally {
|
||||
if (!started) {
|
||||
setState(TERMINATED);
|
||||
container.onExit(this);
|
||||
afterTerminate(/*executed*/ false);
|
||||
afterTerminate(addedToContainer, /*executed*/false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -551,14 +589,21 @@ final class VirtualThread extends BaseVirtualThread {
|
||||
return;
|
||||
|
||||
// park the thread
|
||||
boolean yielded = false;
|
||||
setState(PARKING);
|
||||
try {
|
||||
if (!yieldContinuation()) {
|
||||
// park on the carrier thread when pinned
|
||||
parkOnCarrierThread(false, 0);
|
||||
}
|
||||
yielded = yieldContinuation(); // may throw
|
||||
} finally {
|
||||
assert (Thread.currentThread() == this) && (state() == RUNNING);
|
||||
assert (Thread.currentThread() == this) && (yielded == (state() == RUNNING));
|
||||
if (!yielded) {
|
||||
assert state() == PARKING;
|
||||
setState(RUNNING);
|
||||
}
|
||||
}
|
||||
|
||||
// park on the carrier thread when pinned
|
||||
if (!yielded) {
|
||||
parkOnCarrierThread(false, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -582,14 +627,17 @@ final class VirtualThread extends BaseVirtualThread {
|
||||
if (nanos > 0) {
|
||||
long startTime = System.nanoTime();
|
||||
|
||||
boolean yielded;
|
||||
boolean yielded = false;
|
||||
Future<?> unparker = scheduleUnpark(this::unpark, nanos);
|
||||
setState(PARKING);
|
||||
try {
|
||||
yielded = yieldContinuation();
|
||||
yielded = yieldContinuation(); // may throw
|
||||
} finally {
|
||||
assert (Thread.currentThread() == this)
|
||||
&& (state() == RUNNING || state() == PARKING);
|
||||
assert (Thread.currentThread() == this) && (yielded == (state() == RUNNING));
|
||||
if (!yielded) {
|
||||
assert state() == PARKING;
|
||||
setState(RUNNING);
|
||||
}
|
||||
cancel(unparker);
|
||||
}
|
||||
|
||||
@ -611,10 +659,15 @@ final class VirtualThread extends BaseVirtualThread {
|
||||
* @param nanos the waiting time in nanoseconds
|
||||
*/
|
||||
private void parkOnCarrierThread(boolean timed, long nanos) {
|
||||
assert state() == PARKING;
|
||||
assert state() == RUNNING;
|
||||
|
||||
var pinnedEvent = new VirtualThreadPinnedEvent();
|
||||
pinnedEvent.begin();
|
||||
VirtualThreadPinnedEvent event;
|
||||
try {
|
||||
event = new VirtualThreadPinnedEvent();
|
||||
event.begin();
|
||||
} catch (OutOfMemoryError e) {
|
||||
event = null;
|
||||
}
|
||||
|
||||
setState(PINNED);
|
||||
try {
|
||||
@ -632,7 +685,13 @@ final class VirtualThread extends BaseVirtualThread {
|
||||
// consume parking permit
|
||||
setParkPermit(false);
|
||||
|
||||
pinnedEvent.commit();
|
||||
if (event != null) {
|
||||
try {
|
||||
event.commit();
|
||||
} catch (OutOfMemoryError e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -707,41 +766,18 @@ final class VirtualThread extends BaseVirtualThread {
|
||||
void tryYield() {
|
||||
assert Thread.currentThread() == this;
|
||||
setState(YIELDING);
|
||||
boolean yielded = false;
|
||||
try {
|
||||
yieldContinuation();
|
||||
yielded = yieldContinuation(); // may throw
|
||||
} finally {
|
||||
assert Thread.currentThread() == this;
|
||||
if (state() != RUNNING) {
|
||||
assert (Thread.currentThread() == this) && (yielded == (state() == RUNNING));
|
||||
if (!yielded) {
|
||||
assert state() == YIELDING;
|
||||
setState(RUNNING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sleep the current virtual thread for the given sleep time.
|
||||
*
|
||||
* @param nanos the maximum number of nanoseconds to sleep
|
||||
* @throws InterruptedException if interrupted while sleeping
|
||||
*/
|
||||
void sleepNanos(long nanos) throws InterruptedException {
|
||||
assert Thread.currentThread() == this;
|
||||
if (nanos >= 0) {
|
||||
if (ThreadSleepEvent.isTurnedOn()) {
|
||||
ThreadSleepEvent event = new ThreadSleepEvent();
|
||||
try {
|
||||
event.time = nanos;
|
||||
event.begin();
|
||||
doSleepNanos(nanos);
|
||||
} finally {
|
||||
event.commit();
|
||||
}
|
||||
} else {
|
||||
doSleepNanos(nanos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sleep the current thread for the given sleep time (in nanoseconds). If
|
||||
* nanos is 0 then the thread will attempt to yield.
|
||||
@ -751,9 +787,12 @@ final class VirtualThread extends BaseVirtualThread {
|
||||
* will consume the parking permit so this method makes available the parking
|
||||
* permit after the sleep. This may be observed as a spurious, but benign,
|
||||
* wakeup when the thread subsequently attempts to park.
|
||||
*
|
||||
* @param nanos the maximum number of nanoseconds to sleep
|
||||
* @throws InterruptedException if interrupted while sleeping
|
||||
*/
|
||||
private void doSleepNanos(long nanos) throws InterruptedException {
|
||||
assert nanos >= 0;
|
||||
void sleepNanos(long nanos) throws InterruptedException {
|
||||
assert Thread.currentThread() == this && nanos >= 0;
|
||||
if (getAndClearInterrupt())
|
||||
throw new InterruptedException();
|
||||
if (nanos == 0) {
|
||||
|
@ -46,7 +46,6 @@ import java.security.PrivilegedExceptionAction;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
import jdk.internal.ref.CleanerFactory;
|
||||
import sun.security.util.SecurityConstants;
|
||||
|
||||
@ -249,9 +248,8 @@ public class Executors {
|
||||
* @param threadFactory the factory to use when creating new threads
|
||||
* @return a new executor that creates a new Thread for each task
|
||||
* @throws NullPointerException if threadFactory is null
|
||||
* @since 19
|
||||
* @since 21
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.VIRTUAL_THREADS)
|
||||
public static ExecutorService newThreadPerTaskExecutor(ThreadFactory threadFactory) {
|
||||
return ThreadPerTaskExecutor.create(threadFactory);
|
||||
}
|
||||
@ -265,10 +263,8 @@ public class Executors {
|
||||
* that creates virtual threads.
|
||||
*
|
||||
* @return a new executor that creates a new virtual Thread for each task
|
||||
* @throws UnsupportedOperationException if preview features are not enabled
|
||||
* @since 19
|
||||
* @since 21
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.VIRTUAL_THREADS)
|
||||
public static ExecutorService newVirtualThreadPerTaskExecutor() {
|
||||
ThreadFactory factory = Thread.ofVirtual().factory();
|
||||
return newThreadPerTaskExecutor(factory);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2023, 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
|
||||
@ -325,15 +325,14 @@ class ThreadPerTaskExecutor extends ThreadContainer implements ExecutorService {
|
||||
* notified when the task completes.
|
||||
*/
|
||||
private static class ThreadBoundFuture<T>
|
||||
extends CompletableFuture<T> implements Runnable {
|
||||
extends FutureTask<T> implements Runnable {
|
||||
|
||||
final ThreadPerTaskExecutor executor;
|
||||
final Callable<T> task;
|
||||
final Thread thread;
|
||||
|
||||
ThreadBoundFuture(ThreadPerTaskExecutor executor, Callable<T> task) {
|
||||
super(task);
|
||||
this.executor = executor;
|
||||
this.task = task;
|
||||
this.thread = executor.newThread(this);
|
||||
}
|
||||
|
||||
@ -342,28 +341,8 @@ class ThreadPerTaskExecutor extends ThreadContainer implements ExecutorService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (Thread.currentThread() != thread) {
|
||||
// should not happen except where something casts this object
|
||||
// to a Runnable and invokes the run method.
|
||||
throw new WrongThreadException();
|
||||
}
|
||||
try {
|
||||
T result = task.call();
|
||||
complete(result);
|
||||
} catch (Throwable e) {
|
||||
completeExceptionally(e);
|
||||
} finally {
|
||||
executor.taskComplete(thread);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cancel(boolean mayInterruptIfRunning) {
|
||||
boolean cancelled = super.cancel(mayInterruptIfRunning);
|
||||
if (cancelled && mayInterruptIfRunning)
|
||||
thread.interrupt();
|
||||
return cancelled;
|
||||
protected void done() {
|
||||
executor.taskComplete(thread);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2023, 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
|
||||
@ -68,7 +68,7 @@ public @interface PreviewFeature {
|
||||
SWITCH_PATTERN_MATCHING(),
|
||||
@JEP(number=432, title="Record Patterns", status="Second Preview")
|
||||
RECORD_PATTERNS,
|
||||
@JEP(number=436, title="Virtual Threads", status="Second Preview")
|
||||
// not used
|
||||
VIRTUAL_THREADS,
|
||||
@JEP(number=434, title="Foreign Function & Memory API", status="Second Preview")
|
||||
FOREIGN,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2023, 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
|
||||
@ -25,7 +25,6 @@
|
||||
|
||||
package jdk.internal.vm;
|
||||
|
||||
import jdk.internal.misc.PreviewFeatures;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
import jdk.internal.vm.annotation.DontInline;
|
||||
import jdk.internal.vm.annotation.IntrinsicCandidate;
|
||||
@ -36,6 +35,7 @@ import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
import jdk.internal.access.JavaLangAccess;
|
||||
import jdk.internal.access.SharedSecrets;
|
||||
import jdk.internal.vm.annotation.Hidden;
|
||||
|
||||
/**
|
||||
* A one-shot delimited continuation.
|
||||
@ -47,7 +47,6 @@ public class Continuation {
|
||||
private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess();
|
||||
static {
|
||||
ContinuationSupport.ensureSupported();
|
||||
PreviewFeatures.ensureEnabled();
|
||||
|
||||
StackChunk.init(); // ensure StackChunk class is initialized
|
||||
|
||||
@ -303,6 +302,7 @@ public class Continuation {
|
||||
private native static void enterSpecial(Continuation c, boolean isContinue, boolean isVirtualThread);
|
||||
|
||||
|
||||
@Hidden
|
||||
@DontInline
|
||||
@IntrinsicCandidate
|
||||
private static void enter(Continuation c, boolean isContinue) {
|
||||
@ -315,8 +315,9 @@ public class Continuation {
|
||||
}
|
||||
}
|
||||
|
||||
@Hidden
|
||||
private void enter0() {
|
||||
target.run();
|
||||
target.run();
|
||||
}
|
||||
|
||||
private boolean isStarted() {
|
||||
@ -338,6 +339,7 @@ public class Continuation {
|
||||
* @return {@code true} for success; {@code false} for failure
|
||||
* @throws IllegalStateException if not currently in the given {@code scope},
|
||||
*/
|
||||
@Hidden
|
||||
public static boolean yield(ContinuationScope scope) {
|
||||
Continuation cont = JLA.getContinuation(currentCarrierThread());
|
||||
Continuation c;
|
||||
@ -349,6 +351,7 @@ public class Continuation {
|
||||
return cont.yield0(scope, null);
|
||||
}
|
||||
|
||||
@Hidden
|
||||
private boolean yield0(ContinuationScope scope, Continuation child) {
|
||||
preempted = false;
|
||||
|
||||
|
@ -148,15 +148,10 @@ module java.base {
|
||||
// module declaration be annotated with jdk.internal.javac.ParticipatesInPreview
|
||||
exports jdk.internal.javac to
|
||||
java.compiler,
|
||||
java.management, // participates in preview features
|
||||
jdk.compiler,
|
||||
jdk.incubator.concurrent, // participates in preview features
|
||||
jdk.incubator.vector, // participates in preview features
|
||||
jdk.jartool, // participates in preview features
|
||||
jdk.jdi,
|
||||
jdk.jfr,
|
||||
jdk.jshell,
|
||||
jdk.management;
|
||||
jdk.jshell;
|
||||
exports jdk.internal.access to
|
||||
java.desktop,
|
||||
java.logging,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2023, 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
|
||||
@ -1992,6 +1992,7 @@ JNI_OnUnload(JavaVM *vm, void *reserved);
|
||||
#define JNI_VERSION_10 0x000a0000
|
||||
#define JNI_VERSION_19 0x00130000
|
||||
#define JNI_VERSION_20 0x00140000
|
||||
#define JNI_VERSION_21 0x00150000
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2023, 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
|
||||
@ -23,8 +23,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import jdk.internal.javac.ParticipatesInPreview;
|
||||
|
||||
/**
|
||||
* Defines the Java Management Extensions (JMX) API.
|
||||
* <P>
|
||||
@ -37,7 +35,6 @@ import jdk.internal.javac.ParticipatesInPreview;
|
||||
* @moduleGraph
|
||||
* @since 9
|
||||
*/
|
||||
@ParticipatesInPreview
|
||||
module java.management {
|
||||
|
||||
exports java.lang.management;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2023, 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
|
||||
@ -2156,12 +2156,9 @@ JDWP "Java(tm) Debug Wire Protocol"
|
||||
)
|
||||
)
|
||||
(Command IsVirtual=15
|
||||
"<b>IsVirtual is a preview API of the Java platform.</b> "
|
||||
"<em>Preview features may be removed in a future release, or upgraded to "
|
||||
"permanent features of the Java platform.</em> Since JDWP version 19."
|
||||
"<p>"
|
||||
"Determine if a thread is a "
|
||||
"<a href=../../api/java.base/java/lang/Thread.html#virtual-threads>virtual thread</a>."
|
||||
"<p>Since JDWP version 21."
|
||||
(Out
|
||||
(threadObject thread "The thread object ID.")
|
||||
)
|
||||
@ -2537,12 +2534,9 @@ JDWP "Java(tm) Debug Wire Protocol"
|
||||
)
|
||||
)
|
||||
(Alt PlatformThreadsOnly=13
|
||||
"<b>PlatformThreadsOnly is a preview API of the Java platform.</b> "
|
||||
"<em>Preview features may be removed in a future release, or upgraded to "
|
||||
"permanent features of the Java platform.</em> Since JDWP version 19."
|
||||
"<p>"
|
||||
"For thread start and thread end events, restrict the "
|
||||
"events so they are only sent for platform threads."
|
||||
"<p>Since JDWP version 21."
|
||||
)
|
||||
|
||||
)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2023, 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
|
||||
@ -46,7 +46,6 @@ import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.function.Function;
|
||||
import jdk.internal.misc.PreviewFeatures;
|
||||
import jdk.internal.misc.ThreadFlock;
|
||||
|
||||
/**
|
||||
@ -335,11 +334,8 @@ public class StructuredTaskScope<T> implements AutoCloseable {
|
||||
*
|
||||
* <p> This constructor is equivalent to invoking the 2-arg constructor with a name
|
||||
* of {@code null} and a thread factory that creates virtual threads.
|
||||
*
|
||||
* @throws UnsupportedOperationException if preview features are not enabled
|
||||
*/
|
||||
public StructuredTaskScope() {
|
||||
PreviewFeatures.ensureEnabled();
|
||||
this.factory = Thread.ofVirtual().factory();
|
||||
this.flock = ThreadFlock.open(null);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2022, 2023, 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
|
||||
@ -23,15 +23,12 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import jdk.internal.javac.ParticipatesInPreview;
|
||||
|
||||
/**
|
||||
* Defines non-final APIs for concurrent programming.
|
||||
* {@Incubating}
|
||||
*
|
||||
* @moduleGraph
|
||||
*/
|
||||
@ParticipatesInPreview
|
||||
module jdk.incubator.concurrent {
|
||||
exports jdk.incubator.concurrent;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2023, 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
|
||||
@ -27,7 +27,6 @@ package com.sun.jdi;
|
||||
|
||||
import java.util.List;
|
||||
import com.sun.jdi.event.EventSet;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* A thread object from the target VM.
|
||||
@ -516,9 +515,8 @@ public interface ThreadReference extends ObjectReference {
|
||||
* @implSpec
|
||||
* The default implementation throws {@code UnsupportedOperationException}.
|
||||
*
|
||||
* @since 19
|
||||
* @since 21
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.VIRTUAL_THREADS, reflective = true)
|
||||
default boolean isVirtual() {
|
||||
throw new UnsupportedOperationException("Method not implemented");
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2023, 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,6 @@ import com.sun.jdi.ThreadReference;
|
||||
import com.sun.jdi.event.EventQueue;
|
||||
import com.sun.jdi.event.EventSet;
|
||||
import com.sun.jdi.event.ThreadDeathEvent;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Request for notification when a thread terminates in the target VM.
|
||||
@ -70,9 +69,8 @@ public interface ThreadDeathRequest extends EventRequest {
|
||||
* @throws InvalidRequestStateException if this request is currently
|
||||
* enabled or has been deleted
|
||||
*
|
||||
* @since 19
|
||||
* @since 21
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.VIRTUAL_THREADS, reflective = true)
|
||||
default void addPlatformThreadsOnlyFilter() {
|
||||
throw new UnsupportedOperationException("Method not implemented");
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2023, 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,6 @@ import com.sun.jdi.ThreadReference;
|
||||
import com.sun.jdi.event.EventQueue;
|
||||
import com.sun.jdi.event.EventSet;
|
||||
import com.sun.jdi.event.ThreadStartEvent;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Request for notification when a thread starts execution in the target VM.
|
||||
@ -70,9 +69,8 @@ public interface ThreadStartRequest extends EventRequest {
|
||||
* @throws InvalidRequestStateException if this request is currently
|
||||
* enabled or has been deleted
|
||||
*
|
||||
* @since 19
|
||||
* @since 21
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.VIRTUAL_THREADS, reflective = true)
|
||||
default void addPlatformThreadsOnlyFilter() {
|
||||
throw new UnsupportedOperationException("Method not implemented");
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2023, 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
|
||||
@ -477,7 +477,6 @@ public class TTYResources extends java.util.ListResourceBundle {
|
||||
" connect to target VM using named connector with listed argument values\n" +
|
||||
" -dbgtrace [flags] print info for debugging {0}\n" +
|
||||
" -trackallthreads Track all threads, including virtual threads.\n" +
|
||||
" Virtual threads are a preview feature of the Java platform.\n" +
|
||||
" -tclient run the application in the HotSpot(TM) Client Compiler\n" +
|
||||
" -tserver run the application in the HotSpot(TM) Server Compiler\n" +
|
||||
" -R<option> forward <option> to debuggee process if launched by jdb, otherwise ignored\n" +
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2010, 2023, 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
|
||||
@ -45,7 +45,7 @@ sun.quote = Character used to combine space-delimited text into a single command
|
||||
sun.quote.label = Quote
|
||||
sun.vm_exec = Name of the Java VM launcher
|
||||
sun.vm_exec.label = Launcher
|
||||
sun.include_virtualthreads = List of all threads includes virtual threads as well as platform threads. Virtual threads are a preview feature of the Java platform.
|
||||
sun.include_virtualthreads = List of all threads includes virtual threads as well as platform threads.
|
||||
sun.include_virtualthreads.label = Include Virtual Threads
|
||||
sun.description = Launches target using Sun Java VM command line and attaches to it
|
||||
generic_attaching.address = Address to which to attach for VM connections
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" Copyright (c) 1995, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
.\" Copyright (c) 1995, 2023, 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
|
||||
@ -215,7 +215,6 @@ Runs the application in the Java HotSpot VM client.
|
||||
\f[V]-trackallthreads\f[R]
|
||||
Track all threads as they are created, including virtual threads.
|
||||
See \f[B]Working With Virtual Threads\f[R] below.
|
||||
Virtual threads are a preview feature of the Java platform.
|
||||
.TP
|
||||
\f[V]-tserver\f[R]
|
||||
Runs the application in the Java HotSpot VM server.
|
||||
@ -252,10 +251,6 @@ Other options are supported to provide alternate mechanisms for
|
||||
connecting the debugger to the JVM that it\[aq]s to debug.
|
||||
.SH WORKING WITH VIRTUAL THREADS
|
||||
.PP
|
||||
Virtual threads are a preview feature of the Java platform.
|
||||
Preview features may be removed in a future release, or upgraded to
|
||||
permanent features of the Java platform.
|
||||
.PP
|
||||
Often virtual theads are created in such large numbers and frequency
|
||||
that they can overwhelm a debugger.
|
||||
For this reason by default JDB does not keep track of virtual threads as
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2023, 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
|
||||
@ -827,7 +827,6 @@ printUsage(void)
|
||||
"onuncaught=y|n debug on any uncaught? n\n"
|
||||
"timeout=<timeout value> for listen/attach in milliseconds n\n"
|
||||
"includevirtualthreads=y|n List of all threads includes virtual threads as well as platform threads.\n"
|
||||
" Virtual threads are a preview feature of the Java platform.\n"
|
||||
" n\n"
|
||||
"mutf8=y|n output modified utf-8 n\n"
|
||||
"quiet=y|n control over terminal messages n\n"));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2023, 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
|
||||
@ -26,7 +26,6 @@
|
||||
package jdk.jfr.consumer;
|
||||
|
||||
import jdk.jfr.internal.consumer.ObjectContext;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* A recorded thread.
|
||||
@ -113,9 +112,8 @@ public final class RecordedThread extends RecordedObject {
|
||||
/**
|
||||
* {@return {@code true} if this is a virtual Thread, {@code false} otherwise}
|
||||
*
|
||||
* @since 19
|
||||
* @since 21
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.VIRTUAL_THREADS, reflective = true)
|
||||
public boolean isVirtual() {
|
||||
return getTyped("virtual", Boolean.class, Boolean.FALSE);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2023, 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
|
||||
@ -27,7 +27,6 @@ package com.sun.management;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.management.PlatformManagedObject;
|
||||
import jdk.internal.javac.PreviewFeature;
|
||||
|
||||
/**
|
||||
* Diagnostic management interface for the HotSpot Virtual Machine.
|
||||
@ -147,18 +146,16 @@ public interface HotSpotDiagnosticMXBean extends PlatformManagedObject {
|
||||
* access to the file or {@link java.lang.management.ManagementPermission
|
||||
* ManagementPermission("control")} is denied
|
||||
* @throws UnsupportedOperationException if this operation is not supported
|
||||
* @since 19
|
||||
* @since 21
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.VIRTUAL_THREADS, reflective = true)
|
||||
default void dumpThreads(String outputFile, ThreadDumpFormat format) throws IOException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Thread dump format.
|
||||
* @since 19
|
||||
* @since 21
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.VIRTUAL_THREADS, reflective = true)
|
||||
public static enum ThreadDumpFormat {
|
||||
/**
|
||||
* Plain text format.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2023, 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
|
||||
@ -65,26 +65,7 @@ public final class Helper {
|
||||
}
|
||||
|
||||
public static ThreadFactory threadFactory(boolean virtual) {
|
||||
// After virtual thread Preview:
|
||||
// return (virtual ? Thread.ofVirtual() : Thread.ofPlatform().daemon()).factory();
|
||||
if (virtual) {
|
||||
return virtualThreadFactory();
|
||||
} else {
|
||||
return runnable -> {
|
||||
Thread t = new Thread(runnable);
|
||||
t.setDaemon(true);
|
||||
return t;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private static ThreadFactory virtualThreadFactory() {
|
||||
try {
|
||||
return (ThreadFactory)Class.forName("java.lang.Thread$Builder").getMethod("factory")
|
||||
.invoke(Thread.class.getMethod("ofVirtual").invoke(null));
|
||||
} catch (ReflectiveOperationException ex) {
|
||||
throw new AssertionError(ex);
|
||||
}
|
||||
return (virtual ? Thread.ofVirtual() : Thread.ofPlatform().daemon()).factory();
|
||||
}
|
||||
|
||||
public static int callMethod(Callable<Integer> callable, int expected) {
|
||||
|
@ -36,6 +36,9 @@
|
||||
* -XX:+WhiteBoxAPI
|
||||
* -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
|
||||
* -XX:CompileCommand=exclude,java.lang.Thread::sleep
|
||||
* -XX:CompileCommand=exclude,java.lang.Thread::beforeSleep
|
||||
* -XX:CompileCommand=exclude,java.lang.Thread::afterSleep
|
||||
* -XX:CompileCommand=exclude,java.lang.Math::min
|
||||
* -XX:CompileCommand=exclude,jdk.internal.event.ThreadSleepEvent::*
|
||||
* -XX:CompileCommand=exclude,jdk.internal.event.SleepEvent::*
|
||||
* -XX:CompileCommand=exclude,jdk.internal.event.Event::*
|
||||
@ -45,6 +48,9 @@
|
||||
* -XX:+WhiteBoxAPI
|
||||
* -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
|
||||
* -XX:CompileCommand=exclude,java.lang.Thread::sleep
|
||||
* -XX:CompileCommand=exclude,java.lang.Thread::beforeSleep
|
||||
* -XX:CompileCommand=exclude,java.lang.Thread::afterSleep
|
||||
* -XX:CompileCommand=exclude,java.lang.Math::min
|
||||
* -XX:CompileCommand=exclude,jdk.internal.event.ThreadSleepEvent::*
|
||||
* -XX:CompileCommand=exclude,jdk.internal.event.SleepEvent::*
|
||||
* -XX:CompileCommand=exclude,jdk.internal.event.Event::*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2023, 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
|
||||
@ -48,14 +48,14 @@
|
||||
* -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom
|
||||
* -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
|
||||
* -XX:-SegmentedCodeCache
|
||||
* --enable-preview -DhelperVirtualThread=true
|
||||
* -DhelperVirtualThread=true
|
||||
* compiler.codecache.stress.UnexpectedDeoptimizationAllTest
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI
|
||||
* -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom
|
||||
* -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
|
||||
* -XX:+SegmentedCodeCache
|
||||
* --enable-preview -DhelperVirtualThread=true
|
||||
* -DhelperVirtualThread=true
|
||||
* compiler.codecache.stress.UnexpectedDeoptimizationAllTest
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2023, 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
|
||||
@ -48,14 +48,14 @@
|
||||
* -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom
|
||||
* -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
|
||||
* -XX:-SegmentedCodeCache
|
||||
* --enable-preview -DhelperVirtualThread=true
|
||||
* -DhelperVirtualThread=true
|
||||
* compiler.codecache.stress.UnexpectedDeoptimizationTest
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI
|
||||
* -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom
|
||||
* -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
|
||||
* -XX:+SegmentedCodeCache
|
||||
* --enable-preview -DhelperVirtualThread=true
|
||||
* -DhelperVirtualThread=true
|
||||
* compiler.codecache.stress.UnexpectedDeoptimizationTest
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2023, 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
|
||||
@ -27,12 +27,12 @@
|
||||
*/
|
||||
public class JniVersion {
|
||||
|
||||
public static final int JNI_VERSION_20 = 0x00140000;
|
||||
public static final int JNI_VERSION_21 = 0x00150000;
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
System.loadLibrary("JniVersion");
|
||||
int res = getJniVersion();
|
||||
if (res != JNI_VERSION_20) {
|
||||
if (res != JNI_VERSION_21) {
|
||||
throw new Exception("Unexpected value returned from getJniVersion(): 0x" + Integer.toHexString(res));
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2023, 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
|
||||
@ -33,8 +33,7 @@ import java.util.stream.*;
|
||||
* @requires vm.flagless
|
||||
* @requires vm.flavor != "zero"
|
||||
* @library /test/lib
|
||||
* @enablePreview
|
||||
* @run main/othervm/timeout=180000 --enable-preview SyncOnValueBasedClassTest
|
||||
* @run main/othervm/timeout=180000 SyncOnValueBasedClassTest
|
||||
*/
|
||||
|
||||
public class SyncOnValueBasedClassTest {
|
||||
@ -63,7 +62,7 @@ public class SyncOnValueBasedClassTest {
|
||||
|
||||
private static void generateTests() {
|
||||
initTestObjects();
|
||||
String[] commonFatalTestsFlags = {"--enable-preview", "-XX:+UnlockDiagnosticVMOptions", "-XX:-CreateCoredumpOnCrash", "-XX:DiagnoseSyncOnValueBasedClasses=1"};
|
||||
String[] commonFatalTestsFlags = {"-XX:+UnlockDiagnosticVMOptions", "-XX:-CreateCoredumpOnCrash", "-XX:DiagnoseSyncOnValueBasedClasses=1"};
|
||||
fatalTests = new String[specificFlags.length * testObjects.size()][];
|
||||
for (int i = 0; i < specificFlags.length; i++) {
|
||||
for (int j = 0; j < testObjects.size(); j++) {
|
||||
@ -73,7 +72,7 @@ public class SyncOnValueBasedClassTest {
|
||||
.toArray(String[]::new);
|
||||
}
|
||||
}
|
||||
String[] commonLogTestsFlags = {"--enable-preview", "-XX:+UnlockDiagnosticVMOptions", "-XX:DiagnoseSyncOnValueBasedClasses=2"};
|
||||
String[] commonLogTestsFlags = {"-XX:+UnlockDiagnosticVMOptions", "-XX:DiagnoseSyncOnValueBasedClasses=2"};
|
||||
logTests = new String[specificFlags.length][];
|
||||
for (int i = 0; i < specificFlags.length; i++) {
|
||||
logTests[i] = Stream.of(commonLogTestsFlags, specificFlags[i], new String[] {"SyncOnValueBasedClassTest$LogTest"})
|
||||
@ -168,10 +167,10 @@ public class SyncOnValueBasedClassTest {
|
||||
|
||||
// Very basic sanity tests to show things work for virtual threads too.
|
||||
private static void virtualThreadTests() throws Exception {
|
||||
final String[] vtTest = { "--enable-preview", "-XX:+UnlockDiagnosticVMOptions", "-XX:-CreateCoredumpOnCrash",
|
||||
final String[] vtTest = { "-XX:+UnlockDiagnosticVMOptions", "-XX:-CreateCoredumpOnCrash",
|
||||
"", "SyncOnValueBasedClassTest$VTTest" };
|
||||
// Fatal test
|
||||
vtTest[3] = "-XX:DiagnoseSyncOnValueBasedClasses=1";
|
||||
vtTest[2] = "-XX:DiagnoseSyncOnValueBasedClasses=1";
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(vtTest);
|
||||
OutputAnalyzer output = ProcessTools.executeProcess(pb);
|
||||
output.shouldContain("fatal error: Synchronizing on object");
|
||||
@ -179,7 +178,7 @@ public class SyncOnValueBasedClassTest {
|
||||
output.shouldNotHaveExitValue(0);
|
||||
|
||||
// Log test
|
||||
vtTest[3] = "-XX:DiagnoseSyncOnValueBasedClasses=2";
|
||||
vtTest[2] = "-XX:DiagnoseSyncOnValueBasedClasses=2";
|
||||
pb = ProcessTools.createJavaProcessBuilder(vtTest);
|
||||
output = ProcessTools.executeProcess(pb);
|
||||
output.shouldHaveExitValue(0);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2023, 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
|
||||
@ -31,7 +31,7 @@
|
||||
* @library /test/lib /test/hotspot/jtreg/serviceability/jvmti/RedefineClasses /test/hotspot/jtreg/runtime/cds/appcds
|
||||
* @run driver RedefineClassHelper
|
||||
* @build jdk.test.whitebox.WhiteBox
|
||||
* @compile --enable-preview -source ${jdk.version} RedefineRunningMethods_SharedHelper.java
|
||||
* @compile RedefineRunningMethods_SharedHelper.java
|
||||
* @run driver RedefineRunningMethods_Shared
|
||||
*/
|
||||
|
||||
@ -59,8 +59,7 @@ public class RedefineRunningMethods_Shared {
|
||||
OutputAnalyzer output;
|
||||
TestCommon.testDump(appJar, shared_classes,
|
||||
// command-line arguments ...
|
||||
use_whitebox_jar,
|
||||
"--enable-preview");
|
||||
use_whitebox_jar);
|
||||
|
||||
// RedefineRunningMethods.java contained this:
|
||||
// @run main/othervm -javaagent:redefineagent.jar -Xlog:redefine+class+iklass+add=trace,redefine+class+iklass+purge=trace RedefineRunningMethods
|
||||
@ -69,7 +68,6 @@ public class RedefineRunningMethods_Shared {
|
||||
use_whitebox_jar,
|
||||
"-XX:+UnlockDiagnosticVMOptions",
|
||||
"-XX:+WhiteBoxAPI",
|
||||
"--enable-preview",
|
||||
// These arguments are expected by RedefineRunningMethods
|
||||
"-javaagent:redefineagent.jar",
|
||||
"-Xlog:redefine+class+iklass+add=trace,redefine+class+iklass+purge=trace",
|
||||
|
@ -26,7 +26,6 @@
|
||||
* @bug 8284161
|
||||
* @summary Test JNI IsVirtualThread
|
||||
* @library /test/lib
|
||||
* @enablePreview
|
||||
* @run main/native/othervm IsVirtualThread
|
||||
*/
|
||||
|
||||
@ -34,7 +33,6 @@
|
||||
* @test id=no-vmcontinuations
|
||||
* @requires vm.continuations
|
||||
* @library /test/lib
|
||||
* @enablePreview
|
||||
* @run main/native/othervm -XX:+UnlockExperimentalVMOptions -XX:-VMContinuations IsVirtualThread
|
||||
*/
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Red Hat, Inc. All rights reserved.
|
||||
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2022, 2023, 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,6 @@
|
||||
* @summary -Xcheck:jni should catch wrong parameter passed to GetPrimitiveArrayCritical
|
||||
* @comment Tests reporting with regular thread and virtual thread.
|
||||
* @library /test/lib
|
||||
* @enablePreview
|
||||
* @run main/native TestPrimitiveArrayCriticalWithBadParam
|
||||
*/
|
||||
import java.util.List;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2023, 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
|
||||
@ -28,8 +28,8 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
* @test JNIMonitor
|
||||
* @summary Tests that JNI monitors work correctly with virtual threads
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} JNIMonitor.java
|
||||
* @run main/native/othervm --enable-preview JNIMonitor
|
||||
* @compile JNIMonitor.java
|
||||
* @run main/native/othervm JNIMonitor
|
||||
*/
|
||||
|
||||
public class JNIMonitor {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017 SAP SE. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -25,8 +25,8 @@
|
||||
/**
|
||||
* @test
|
||||
* @summary Regression test based on runtime/Metaspace/DefineClass.java
|
||||
* @compile --enable-preview -source ${jdk.version} RedefineClass.java
|
||||
* @run main/othervm --enable-preview -Djdk.attach.allowAttachSelf RedefineClass
|
||||
* @compile RedefineClass.java
|
||||
* @run main/othervm -Djdk.attach.allowAttachSelf RedefineClass
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2023, 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
|
||||
@ -27,8 +27,8 @@ import jdk.jfr.consumer.RecordingStream;
|
||||
* @summary Tests ObjectAllocationSampleEvent
|
||||
* @requires vm.hasJFR
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} TestObjectAllocationSampleEvent.java
|
||||
* @run main/othervm --enable-preview TestObjectAllocationSampleEvent
|
||||
* @compile TestObjectAllocationSampleEvent.java
|
||||
* @run main/othervm TestObjectAllocationSampleEvent
|
||||
*/
|
||||
public class TestObjectAllocationSampleEvent {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2022, 2023, 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
|
||||
@ -24,7 +24,6 @@
|
||||
/**
|
||||
* @test
|
||||
* @summary Verifies JVMTI GetLocalXXX/SetLocalXXX return errors for unsuspended vthreads
|
||||
* @enablePreview
|
||||
* @library /test/lib
|
||||
* @run main/othervm/native -agentlib:GetSetLocalUnsuspended GetSetLocalUnsuspended
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2023, 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
|
||||
@ -27,8 +27,8 @@
|
||||
* @bug 8185164
|
||||
* @summary Checks that a contended monitor does not show up in the list of owned monitors
|
||||
* @requires vm.jvmti
|
||||
* @compile --enable-preview -source ${jdk.version} GetOwnedMonitorInfoTest.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:GetOwnedMonitorInfoTest GetOwnedMonitorInfoTest
|
||||
* @compile GetOwnedMonitorInfoTest.java
|
||||
* @run main/othervm/native -agentlib:GetOwnedMonitorInfoTest GetOwnedMonitorInfoTest
|
||||
*/
|
||||
|
||||
import java.io.PrintStream;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2023, 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
|
||||
@ -27,8 +27,8 @@
|
||||
* @bug 8153629
|
||||
* @summary Need to cover JVMTI's GetOwnedMonitorStackDepthInfo function
|
||||
* @requires vm.jvmti
|
||||
* @compile --enable-preview -source ${jdk.version} GetOwnedMonitorStackDepthInfoTest.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:GetOwnedMonitorStackDepthInfoTest GetOwnedMonitorStackDepthInfoTest
|
||||
* @compile GetOwnedMonitorStackDepthInfoTest.java
|
||||
* @run main/othervm/native -agentlib:GetOwnedMonitorStackDepthInfoTest GetOwnedMonitorStackDepthInfoTest
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, Google and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -47,9 +47,8 @@ import java.util.concurrent.ThreadFactory;
|
||||
* @requires vm.jvmti
|
||||
* @requires !vm.graal.enabled
|
||||
* @build Frame HeapMonitor
|
||||
* @compile --enable-preview -source ${jdk.version} HeapMonitorVMEventsTest.java
|
||||
* @run main/othervm/native --enable-preview
|
||||
* -XX:+UnlockDiagnosticVMOptions
|
||||
* @compile HeapMonitorVMEventsTest.java
|
||||
* @run main/othervm/native -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:DisableIntrinsic=_clone
|
||||
* -agentlib:HeapMonitorTest MyPackage.HeapMonitorVMEventsTest virtual
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2023, 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
|
||||
@ -32,9 +32,8 @@
|
||||
* java.instrument
|
||||
* jdk.jartool/sun.tools.jar
|
||||
* @run main RedefineClassHelper
|
||||
* @compile --enable-preview -source ${jdk.version} RedefineRunningMethods.java
|
||||
* @compile RedefineRunningMethods.java
|
||||
* @run main/othervm/timeout=180
|
||||
* --enable-preview
|
||||
* -javaagent:redefineagent.jar
|
||||
* -Xlog:redefine+class+iklass+add=trace,redefine+class+iklass+purge=trace,class+loader+data=debug,safepoint+cleanup,gc+phases=debug:rt.log
|
||||
* RedefineRunningMethods
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2023, 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
|
||||
@ -32,9 +32,9 @@
|
||||
* java.instrument
|
||||
* jdk.jartool/sun.tools.jar
|
||||
* @run main RedefineClassHelper
|
||||
* @compile --enable-preview -source ${jdk.version} RedefineRunningMethodsWithBacktrace.java
|
||||
* @run main/othervm --enable-preview -javaagent:redefineagent.jar RedefineRunningMethodsWithBacktrace platform
|
||||
* @run main/othervm --enable-preview -javaagent:redefineagent.jar RedefineRunningMethodsWithBacktrace virtual
|
||||
* @compile RedefineRunningMethodsWithBacktrace.java
|
||||
* @run main/othervm -javaagent:redefineagent.jar RedefineRunningMethodsWithBacktrace platform
|
||||
* @run main/othervm -javaagent:redefineagent.jar RedefineRunningMethodsWithBacktrace virtual
|
||||
*/
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -42,8 +42,8 @@ import java.io.*;
|
||||
*
|
||||
* @comment make sure breakpoint01 is compiled with full debug info
|
||||
* @clean breakpoint01
|
||||
* @compile --enable-preview -source ${jdk.version} -g:lines,source,vars breakpoint01.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:breakpoint01 breakpoint01
|
||||
* @compile -g:lines,source,vars breakpoint01.java
|
||||
* @run main/othervm/native -agentlib:breakpoint01 breakpoint01
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -43,8 +43,8 @@ import java.io.*;
|
||||
* Fixed the 5031200 bug.
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} classload01.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:classload01 classload01
|
||||
* @compile classload01.java
|
||||
* @run main/othervm/native -agentlib:classload01 classload01
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -38,8 +38,8 @@
|
||||
* Ported from JVMDI.
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} classprep01.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:classprep01 classprep01
|
||||
* @compile classprep01.java
|
||||
* @run main/othervm/native -agentlib:classprep01 classprep01
|
||||
*/
|
||||
|
||||
public class classprep01 {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -39,8 +39,8 @@
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile exception01a.jasm
|
||||
* @compile --enable-preview -source ${jdk.version} exception01.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:exception01 exception01
|
||||
* @compile exception01.java
|
||||
* @run main/othervm/native -agentlib:exception01 exception01
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -39,8 +39,8 @@
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile excatch01a.jasm
|
||||
* @compile --enable-preview -source ${jdk.version} excatch01.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:excatch01 excatch01
|
||||
* @compile excatch01.java
|
||||
* @run main/othervm/native -agentlib:excatch01 excatch01
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -37,8 +37,8 @@
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile fieldacc01a.jasm
|
||||
* @compile --enable-preview -source ${jdk.version} fieldacc01.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:fieldacc01 fieldacc01
|
||||
* @compile fieldacc01.java
|
||||
* @run main/othervm/native -agentlib:fieldacc01 fieldacc01
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -36,8 +36,8 @@
|
||||
* Ported from JVMDI.
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} fieldacc02.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:fieldacc02 fieldacc02
|
||||
* @compile fieldacc02.java
|
||||
* @run main/othervm/native -agentlib:fieldacc02 fieldacc02
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -37,8 +37,8 @@
|
||||
* Ported from JVMDI.
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} fieldacc03.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:fieldacc03 fieldacc03
|
||||
* @compile fieldacc03.java
|
||||
* @run main/othervm/native -agentlib:fieldacc03 fieldacc03
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -37,8 +37,8 @@
|
||||
* Ported from JVMDI.
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} fieldacc04.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:fieldacc04 fieldacc04
|
||||
* @compile fieldacc04.java
|
||||
* @run main/othervm/native -agentlib:fieldacc04 fieldacc04
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -38,8 +38,8 @@
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile fieldmod01a.jasm
|
||||
* @compile --enable-preview -source ${jdk.version} fieldmod01.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:fieldmod01 fieldmod01
|
||||
* @compile fieldmod01.java
|
||||
* @run main/othervm/native -agentlib:fieldmod01 fieldmod01
|
||||
*/
|
||||
|
||||
public class fieldmod01 {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -36,8 +36,8 @@
|
||||
* Ported from JVMDI.
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} fieldmod02.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:fieldmod02 fieldmod02
|
||||
* @compile fieldmod02.java
|
||||
* @run main/othervm/native -agentlib:fieldmod02 fieldmod02
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -39,8 +39,8 @@
|
||||
* Ported from JVMDI.
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} framepop01a.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:framepop01 framepop01
|
||||
* @compile framepop01a.java
|
||||
* @run main/othervm/native -agentlib:framepop01 framepop01
|
||||
*/
|
||||
|
||||
public class framepop01 {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -39,14 +39,14 @@
|
||||
* Ported from JVMDI.
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} framepop02.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:framepop02 framepop02 platform
|
||||
* @compile framepop02.java
|
||||
* @run main/othervm/native -agentlib:framepop02 framepop02 platform
|
||||
*/
|
||||
/*
|
||||
* @test
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} framepop02.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:framepop02 framepop02 virtual
|
||||
* @compile framepop02.java
|
||||
* @run main/othervm/native -agentlib:framepop02 framepop02 virtual
|
||||
*/
|
||||
|
||||
public class framepop02 {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -40,8 +40,8 @@
|
||||
* Fixed the 5004632 bug.
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} mentry01.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:mentry01 mentry01
|
||||
* @compile mentry01.java
|
||||
* @run main/othervm/native -agentlib:mentry01 mentry01
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -38,8 +38,8 @@
|
||||
* Ported from JVMDI test /nsk/regression/b4248826.
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} mentry02.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:mentry02 mentry02
|
||||
* @compile mentry02.java
|
||||
* @run main/othervm/native -agentlib:mentry02 mentry02
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -41,8 +41,8 @@
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile mexit01a.jasm
|
||||
* @compile --enable-preview -source ${jdk.version} mexit01.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:mexit01 mexit01
|
||||
* @compile mexit01.java
|
||||
* @run main/othervm/native -agentlib:mexit01 mexit01
|
||||
*/
|
||||
|
||||
public class mexit01 {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -44,8 +44,8 @@
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile mexit02a.jasm
|
||||
* @compile --enable-preview -source ${jdk.version} mexit02.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:mexit02 mexit02
|
||||
* @compile mexit02.java
|
||||
* @run main/othervm/native -agentlib:mexit02 mexit02
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -42,9 +42,9 @@ import jdk.test.lib.jvmti.DebugeeClass;
|
||||
* 1000 ms of sleep added to main thread to reduce probability of bad racing.
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} mcontenter01.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:mcontenter01 mcontenter01 platform
|
||||
* @run main/othervm/native --enable-preview -agentlib:mcontenter01 mcontenter01 virtual
|
||||
* @compile mcontenter01.java
|
||||
* @run main/othervm/native -agentlib:mcontenter01 mcontenter01 platform
|
||||
* @run main/othervm/native -agentlib:mcontenter01 mcontenter01 virtual
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -41,9 +41,9 @@ import jdk.test.lib.jvmti.DebugeeClass;
|
||||
* and save JNIEnv pointer now passed as argument.
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} mcontentered01.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:mcontentered01 mcontentered01 platform
|
||||
* @run main/othervm/native --enable-preview -agentlib:mcontentered01 mcontentered01 virtual
|
||||
* @compile mcontentered01.java
|
||||
* @run main/othervm/native -agentlib:mcontentered01 mcontentered01 platform
|
||||
* @run main/othervm/native -agentlib:mcontentered01 mcontentered01 virtual
|
||||
*/
|
||||
|
||||
public class mcontentered01 extends DebugeeClass {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -41,9 +41,9 @@ import jdk.test.lib.jvmti.DebugeeClass;
|
||||
* and save JNIEnv pointer now passed as argument.
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} monitorwait01.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:monitorwait01 monitorwait01 platform
|
||||
* @run main/othervm/native --enable-preview -agentlib:monitorwait01 monitorwait01 virtual
|
||||
* @compile monitorwait01.java
|
||||
* @run main/othervm/native -agentlib:monitorwait01 monitorwait01 platform
|
||||
* @run main/othervm/native -agentlib:monitorwait01 monitorwait01 virtual
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -41,9 +41,9 @@ import jdk.test.lib.jvmti.DebugeeClass;
|
||||
* and save JNIEnv pointer now passed as argument.
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} monitorwaited01.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:monitorwaited01 monitorwaited01 platform
|
||||
* @run main/othervm/native --enable-preview -agentlib:monitorwaited01 monitorwaited01 virtual
|
||||
* @compile monitorwaited01.java
|
||||
* @run main/othervm/native -agentlib:monitorwaited01 monitorwaited01 platform
|
||||
* @run main/othervm/native -agentlib:monitorwaited01 monitorwaited01 virtual
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -45,8 +45,8 @@ import java.io.*;
|
||||
* COMMENTS
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} singlestep01.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:singlestep01 singlestep01
|
||||
* @compile singlestep01.java
|
||||
* @run main/othervm/native -agentlib:singlestep01 singlestep01
|
||||
*/
|
||||
|
||||
public class singlestep01 {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -44,9 +44,9 @@ import java.io.*;
|
||||
* COMMENTS
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} singlestep03.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:singlestep03 singlestep03 platform
|
||||
* @run main/othervm/native --enable-preview -agentlib:singlestep03 singlestep03 virtual
|
||||
* @compile singlestep03.java
|
||||
* @run main/othervm/native -agentlib:singlestep03 singlestep03 platform
|
||||
* @run main/othervm/native -agentlib:singlestep03 singlestep03 virtual
|
||||
*/
|
||||
|
||||
public class singlestep03 {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2023, 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
|
||||
@ -25,8 +25,8 @@
|
||||
* @test
|
||||
* @summary Verifies JVMTI GetStackTrace functions called without suspend.
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} GetStackTraceNotSuspendedStressTest.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:GetStackTraceNotSuspendedStress GetStackTraceNotSuspendedStressTest
|
||||
* @compile GetStackTraceNotSuspendedStressTest.java
|
||||
* @run main/othervm/native -agentlib:GetStackTraceNotSuspendedStress GetStackTraceNotSuspendedStressTest
|
||||
*/
|
||||
|
||||
import jdk.test.lib.jvmti.DebugeeClass;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2023, 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
|
||||
@ -25,8 +25,8 @@
|
||||
* @test
|
||||
* @summary Verifies JVMTI GetStackTrace functions called after vthread is suspended.
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} GetStackTraceSuspendedStressTest.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:GetStackTraceSuspendedStress GetStackTraceSuspendedStressTest
|
||||
* @compile GetStackTraceSuspendedStressTest.java
|
||||
* @run main/othervm/native -agentlib:GetStackTraceSuspendedStress GetStackTraceSuspendedStressTest
|
||||
*/
|
||||
|
||||
import jdk.test.lib.jvmti.DebugeeClass;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -40,8 +40,8 @@
|
||||
*
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} SetGetThreadLocalStorageStressTest.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:SetGetThreadLocalStorageStress SetGetThreadLocalStorageStressTest
|
||||
* @compile SetGetThreadLocalStorageStressTest.java
|
||||
* @run main/othervm/native -agentlib:SetGetThreadLocalStorageStress SetGetThreadLocalStorageStressTest
|
||||
*/
|
||||
|
||||
|
||||
|
@ -38,8 +38,8 @@
|
||||
*
|
||||
* @requires vm.continuations
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} allthr01.java
|
||||
* @run main/othervm/native --enable-preview -Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -agentlib:allthr01 allthr01
|
||||
* @compile allthr01.java
|
||||
* @run main/othervm/native -Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -agentlib:allthr01 allthr01
|
||||
*/
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -60,8 +60,8 @@
|
||||
* - enhanced descripton
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} contmon01.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:contmon01 contmon01
|
||||
* @compile contmon01.java
|
||||
* @run main/othervm/native -agentlib:contmon01 contmon01
|
||||
*/
|
||||
|
||||
public class contmon01 {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -41,8 +41,8 @@
|
||||
* - enhanced descripton
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} contmon02.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:contmon02 contmon02
|
||||
* @compile contmon02.java
|
||||
* @run main/othervm/native -agentlib:contmon02 contmon02
|
||||
*/
|
||||
|
||||
public class contmon02 {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -35,8 +35,8 @@
|
||||
*
|
||||
* @requires vm.continuations
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} framecnt01.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:framecnt01 framecnt01
|
||||
* @compile framecnt01.java
|
||||
* @run main/othervm/native -agentlib:framecnt01 framecnt01
|
||||
*/
|
||||
|
||||
import java.util.concurrent.locks.LockSupport;
|
||||
@ -79,7 +79,7 @@ public class framecnt01 {
|
||||
}
|
||||
|
||||
// this is too fragile, implementation can change at any time.
|
||||
checkFrames(vThread1, false, 15);
|
||||
checkFrames(vThread1, false, 14);
|
||||
LockSupport.unpark(vThread1);
|
||||
vThread1.join();
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -39,8 +39,8 @@
|
||||
* Ported from JVMDI.
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} GetStackTraceCurrentThreadTest.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:GetStackTraceCurrentThreadTest GetStackTraceCurrentThreadTest
|
||||
* @compile GetStackTraceCurrentThreadTest.java
|
||||
* @run main/othervm/native -agentlib:GetStackTraceCurrentThreadTest GetStackTraceCurrentThreadTest
|
||||
*/
|
||||
|
||||
public class GetStackTraceCurrentThreadTest {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -38,8 +38,8 @@
|
||||
*
|
||||
* @requires vm.continuations
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} getstacktr03.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:getstacktr03 getstacktr03
|
||||
* @compile getstacktr03.java
|
||||
* @run main/othervm/native -agentlib:getstacktr03 getstacktr03
|
||||
*/
|
||||
|
||||
public class getstacktr03 {
|
||||
|
@ -46,8 +46,7 @@ static frame_info expected_virtual_frames[] = {
|
||||
{"Lgetstacktr03$Task;", "run", "()V"},
|
||||
{"Ljava/lang/VirtualThread;", "runWith", "(Ljava/lang/Object;Ljava/lang/Runnable;)V"},
|
||||
{"Ljava/lang/VirtualThread;", "run", "(Ljava/lang/Runnable;)V"},
|
||||
{"Ljava/lang/VirtualThread$VThreadContinuation;", "lambda$new$0", "(Ljava/lang/VirtualThread;Ljava/lang/Runnable;)V"},
|
||||
{"Ljava/lang/VirtualThread$VThreadContinuation$$Lambda.0x0000000800098810;", "run", "()V"},
|
||||
{"Ljava/lang/VirtualThread$VThreadContinuation$1;", "run", "()V"},
|
||||
{"Ljdk/internal/vm/Continuation;", "enter0", "()V"},
|
||||
{"Ljdk/internal/vm/Continuation;", "enter", "(Ljdk/internal/vm/Continuation;Z)V"}
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -37,8 +37,8 @@
|
||||
*
|
||||
* @requires vm.continuations
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} getstacktr04.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:getstacktr04 getstacktr04
|
||||
* @compile getstacktr04.java
|
||||
* @run main/othervm/native -agentlib:getstacktr04 getstacktr04
|
||||
*/
|
||||
|
||||
public class getstacktr04 {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -38,8 +38,8 @@
|
||||
*
|
||||
* @requires vm.continuations
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} getstacktr05.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:getstacktr05 getstacktr05
|
||||
* @compile getstacktr05.java
|
||||
* @run main/othervm/native -agentlib:getstacktr05 getstacktr05
|
||||
*/
|
||||
|
||||
public class getstacktr05 {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -51,8 +51,7 @@ static frame_info expected_virtual_frames[] = {
|
||||
{"Lgetstacktr05$TestThread;", "run", "()V"},
|
||||
{"Ljava/lang/VirtualThread;", "runWith", "(Ljava/lang/Object;Ljava/lang/Runnable;)V"},
|
||||
{"Ljava/lang/VirtualThread;", "run", "(Ljava/lang/Runnable;)V"},
|
||||
{"Ljava/lang/VirtualThread$VThreadContinuation;", "lambda$new$0", "(Ljava/lang/VirtualThread;Ljava/lang/Runnable;)V"},
|
||||
{"Ljava/lang/VirtualThread$VThreadContinuation$$Lambda;", "run", "()V"},
|
||||
{"Ljava/lang/VirtualThread$VThreadContinuation$1;", "run", "()V"},
|
||||
{"Ljdk/internal/vm/Continuation;", "enter0", "()V"},
|
||||
{"Ljdk/internal/vm/Continuation;", "enter", "(Ljdk/internal/vm/Continuation;Z)V"},
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -39,8 +39,8 @@
|
||||
*
|
||||
* @requires vm.continuations
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} getstacktr06.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:getstacktr06 getstacktr06
|
||||
* @compile getstacktr06.java
|
||||
* @run main/othervm/native -agentlib:getstacktr06 getstacktr06
|
||||
*/
|
||||
|
||||
public class getstacktr06 {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -38,8 +38,8 @@
|
||||
*
|
||||
* @requires vm.continuations
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} getstacktr07.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:getstacktr07 getstacktr07
|
||||
* @compile getstacktr07.java
|
||||
* @run main/othervm/native -agentlib:getstacktr07 getstacktr07
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -46,8 +46,8 @@
|
||||
*
|
||||
* @requires vm.continuations
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} getstacktr08.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:getstacktr08 getstacktr08
|
||||
* @compile getstacktr08.java
|
||||
* @run main/othervm/native -agentlib:getstacktr08 getstacktr08
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -42,8 +42,8 @@
|
||||
* Ported from JVMDI.
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} thrinfo01.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:thrinfo01 thrinfo01
|
||||
* @compile thrinfo01.java
|
||||
* @run main/othervm/native -agentlib:thrinfo01 thrinfo01
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 2023, 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
|
||||
@ -73,8 +73,8 @@
|
||||
* - enhanced descripton
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} thrstat01.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:thrstat01 thrstat01
|
||||
* @compile thrstat01.java
|
||||
* @run main/othervm/native -agentlib:thrstat01 thrstat01
|
||||
*/
|
||||
|
||||
public class thrstat01 {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 2023, 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
|
||||
@ -38,8 +38,8 @@
|
||||
* Ported from JVMDI.
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} thrstat03.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:thrstat03 thrstat03 5
|
||||
* @compile thrstat03.java
|
||||
* @run main/othervm/native -agentlib:thrstat03 thrstat03 5
|
||||
*/
|
||||
|
||||
public class thrstat03 {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2023, 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
|
||||
@ -56,8 +56,8 @@
|
||||
* COMMENTS
|
||||
*
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} thrstat05.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:thrstat05 thrstat05
|
||||
* @compile thrstat05.java
|
||||
* @run main/othervm/native -agentlib:thrstat05 thrstat05
|
||||
*/
|
||||
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
/**
|
||||
* @test
|
||||
* @summary Verifies correct JVMTI behavior for BoundVirtualThreads.
|
||||
* @enablePreview
|
||||
* @run main/othervm/native -agentlib:BoundVThreadTest -XX:+UnlockExperimentalVMOptions -XX:-VMContinuations BoundVThreadTest
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2023, 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
|
||||
@ -25,8 +25,8 @@
|
||||
* @test
|
||||
* @summary Verifies that JVMTI function return correct info in Breakpoint events in Continuation.yield0().
|
||||
* @requires vm.continuations
|
||||
* @compile --enable-preview -source ${jdk.version} BreakpointInYieldTest.java
|
||||
* @run main/othervm/native --enable-preview -agentlib:BreakpointInYieldTest -Djdk.defaultScheduler.parallelism=2 BreakpointInYieldTest
|
||||
* @compile BreakpointInYieldTest.java
|
||||
* @run main/othervm/native -agentlib:BreakpointInYieldTest -Djdk.defaultScheduler.parallelism=2 BreakpointInYieldTest
|
||||
*/
|
||||
|
||||
import java.util.concurrent.*;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2023, 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
|
||||
@ -27,7 +27,7 @@
|
||||
* @requires vm.continuations
|
||||
* @compile ContFramePopTest.java
|
||||
* @modules java.base/jdk.internal.vm
|
||||
* @run main/othervm/native --enable-preview -agentlib:ContFramePopTest ContFramePopTest
|
||||
* @run main/othervm/native -agentlib:ContFramePopTest ContFramePopTest
|
||||
*/
|
||||
|
||||
import jdk.internal.vm.Continuation;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2023, 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
|
||||
@ -27,7 +27,7 @@
|
||||
* @requires vm.continuations
|
||||
* @compile ContStackDepthTest.java
|
||||
* @modules java.base/jdk.internal.vm
|
||||
* @run main/othervm/native --enable-preview -agentlib:ContStackDepthTest ContStackDepthTest
|
||||
* @run main/othervm/native -agentlib:ContStackDepthTest ContStackDepthTest
|
||||
*/
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2023, 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
|
||||
@ -27,7 +27,7 @@
|
||||
* @requires vm.continuations
|
||||
* @compile ContYieldBreakPointTest.java
|
||||
* @modules java.base/jdk.internal.vm
|
||||
* @run main/othervm/native --enable-preview -agentlib:ContYieldBreakPointTest ContYieldBreakPointTest
|
||||
* @run main/othervm/native -agentlib:ContYieldBreakPointTest ContYieldBreakPointTest
|
||||
*/
|
||||
|
||||
import jdk.internal.vm.Continuation;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2023, 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
|
||||
@ -27,7 +27,7 @@
|
||||
* @requires vm.continuations
|
||||
* @compile ContinuationTest.java
|
||||
* @modules java.base/jdk.internal.vm
|
||||
* @run main/othervm/native --enable-preview -agentlib:ContinuationTest ContinuationTest
|
||||
* @run main/othervm/native -agentlib:ContinuationTest ContinuationTest
|
||||
*/
|
||||
|
||||
import jdk.internal.vm.Continuation;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user