Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8304919: Implementation of Virtual Threads
Reviewed-by: lmesnik, cjplummer, psandoz, mchung, sspitsyn, jpai
  • Loading branch information
Alan Bateman committed Apr 11, 2023
1 parent 3939807 commit 2586f36
Show file tree
Hide file tree
Showing 205 changed files with 1,379 additions and 1,342 deletions.
9 changes: 1 addition & 8 deletions src/hotspot/share/classfile/javaClasses.cpp
Expand Up @@ -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");
Expand All @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/classfile/javaClasses.hpp
Expand Up @@ -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;
};
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/prims/jni.cpp
Expand Up @@ -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* );
Expand Down
32 changes: 6 additions & 26 deletions src/hotspot/share/prims/jvmti.xml
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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>,
Expand Down Expand Up @@ -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>