8338383: Implement JEP 491: Synchronize Virtual Threads without Pinning

Co-authored-by: Patricio Chilano Mateo <pchilanomate@openjdk.org>
Co-authored-by: Alan Bateman <alanb@openjdk.org>
Co-authored-by: Andrew Haley <aph@openjdk.org>
Co-authored-by: Fei Yang <fyang@openjdk.org>
Co-authored-by: Coleen Phillimore <coleenp@openjdk.org>
Co-authored-by: Richard Reingruber <rrich@openjdk.org>
Co-authored-by: Martin Doerr <mdoerr@openjdk.org>
Reviewed-by: aboldtch, dholmes, coleenp, fbredberg, dlong, sspitsyn
This commit is contained in:
Patricio Chilano Mateo 2024-11-12 15:23:48 +00:00
parent 8a2a75e56d
commit 78b80150e0
246 changed files with 8295 additions and 2755 deletions

View file

@ -530,6 +530,11 @@ class java_lang_VirtualThread : AllStatic {
static int _carrierThread_offset;
static int _continuation_offset;
static int _state_offset;
static int _next_offset;
static int _onWaitingList_offset;
static int _notified_offset;
static int _recheckInterval_offset;
static int _timeout_offset;
JFR_ONLY(static int _jfr_epoch_offset;)
public:
enum {
@ -545,6 +550,13 @@ class java_lang_VirtualThread : AllStatic {
UNPARKED = 9,
YIELDING = 10,
YIELDED = 11,
BLOCKING = 12,
BLOCKED = 13,
UNBLOCKED = 14,
WAITING = 15,
WAIT = 16, // waiting in Object.wait
TIMED_WAITING = 17,
TIMED_WAIT = 18, // waiting in timed-Object.wait
TERMINATED = 99,
// additional state bits
@ -564,6 +576,15 @@ class java_lang_VirtualThread : AllStatic {
static oop carrier_thread(oop vthread);
static oop continuation(oop vthread);
static int state(oop vthread);
static void set_state(oop vthread, int state);
static int cmpxchg_state(oop vthread, int old_state, int new_state);
static oop next(oop vthread);
static void set_next(oop vthread, oop next_vthread);
static bool set_onWaitingList(oop vthread, OopHandle& list_head);
static jlong timeout(oop vthread);
static void set_timeout(oop vthread, jlong value);
static void set_notified(oop vthread, jboolean value);
static bool is_preempted(oop vthread);
static JavaThreadStatus map_state_to_thread_status(int state);
};