546 static bool is_daemon(oop java_thread_group);
547
548 // Debugging
549 friend class JavaClasses;
550 };
551
552
553 // Interface to java.lang.VirtualThread objects
554 #define VTHREAD_INJECTED_FIELDS(macro) \
555 macro(java_lang_VirtualThread, objectWaiter, intptr_signature, false)
556
557 class java_lang_VirtualThread : AllStatic {
558 private:
559 static int static_vthread_scope_offset;
560 static int _carrierThread_offset;
561 static int _continuation_offset;
562 static int _state_offset;
563 static int _next_offset;
564 static int _onWaitingList_offset;
565 static int _notified_offset;
566 static int _recheckInterval_offset;
567 static int _timeout_offset;
568 static int _objectWaiter_offset;
569 JFR_ONLY(static int _jfr_epoch_offset;)
570 public:
571 enum {
572 NEW = 0,
573 STARTED = 1,
574 RUNNING = 2,
575 PARKING = 3,
576 PARKED = 4,
577 PINNED = 5,
578 TIMED_PARKING = 6,
579 TIMED_PARKED = 7,
580 TIMED_PINNED = 8,
581 UNPARKED = 9,
582 YIELDING = 10,
583 YIELDED = 11,
584 BLOCKING = 12,
585 BLOCKED = 13,
598 static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
599
600 // Testers
601 static bool is_subclass(Klass* klass) {
602 return klass->is_subclass_of(vmClasses::VirtualThread_klass());
603 }
604 static bool is_instance(oop obj);
605
606 static oop vthread_scope();
607 static oop carrier_thread(oop vthread);
608 static oop continuation(oop vthread);
609 static int state(oop vthread);
610 static void set_state(oop vthread, int state);
611 static int cmpxchg_state(oop vthread, int old_state, int new_state);
612 static oop next(oop vthread);
613 static void set_next(oop vthread, oop next_vthread);
614 static bool set_onWaitingList(oop vthread, OopHandle& list_head);
615 static jlong timeout(oop vthread);
616 static void set_timeout(oop vthread, jlong value);
617 static void set_notified(oop vthread, jboolean value);
618 static bool is_preempted(oop vthread);
619 static JavaThreadStatus map_state_to_thread_status(int state);
620
621 static inline ObjectWaiter* objectWaiter(oop vthread);
622 static inline void set_objectWaiter(oop vthread, ObjectWaiter* waiter);
623 static ObjectMonitor* current_pending_monitor(oop vthread);
624 static ObjectMonitor* current_waiting_monitor(oop vthread);
625 };
626
627
628 // Interface to java.lang.Throwable objects
629
630 class java_lang_Throwable: AllStatic {
631 friend class BacktraceBuilder;
632 friend class BacktraceIterator;
633
634 private:
635 // Trace constants
636 enum {
637 trace_methods_offset = 0,
|
546 static bool is_daemon(oop java_thread_group);
547
548 // Debugging
549 friend class JavaClasses;
550 };
551
552
553 // Interface to java.lang.VirtualThread objects
554 #define VTHREAD_INJECTED_FIELDS(macro) \
555 macro(java_lang_VirtualThread, objectWaiter, intptr_signature, false)
556
557 class java_lang_VirtualThread : AllStatic {
558 private:
559 static int static_vthread_scope_offset;
560 static int _carrierThread_offset;
561 static int _continuation_offset;
562 static int _state_offset;
563 static int _next_offset;
564 static int _onWaitingList_offset;
565 static int _notified_offset;
566 static int _interruptible_wait_offset;
567 static int _recheckInterval_offset;
568 static int _timeout_offset;
569 static int _objectWaiter_offset;
570 JFR_ONLY(static int _jfr_epoch_offset;)
571 public:
572 enum {
573 NEW = 0,
574 STARTED = 1,
575 RUNNING = 2,
576 PARKING = 3,
577 PARKED = 4,
578 PINNED = 5,
579 TIMED_PARKING = 6,
580 TIMED_PARKED = 7,
581 TIMED_PINNED = 8,
582 UNPARKED = 9,
583 YIELDING = 10,
584 YIELDED = 11,
585 BLOCKING = 12,
586 BLOCKED = 13,
599 static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
600
601 // Testers
602 static bool is_subclass(Klass* klass) {
603 return klass->is_subclass_of(vmClasses::VirtualThread_klass());
604 }
605 static bool is_instance(oop obj);
606
607 static oop vthread_scope();
608 static oop carrier_thread(oop vthread);
609 static oop continuation(oop vthread);
610 static int state(oop vthread);
611 static void set_state(oop vthread, int state);
612 static int cmpxchg_state(oop vthread, int old_state, int new_state);
613 static oop next(oop vthread);
614 static void set_next(oop vthread, oop next_vthread);
615 static bool set_onWaitingList(oop vthread, OopHandle& list_head);
616 static jlong timeout(oop vthread);
617 static void set_timeout(oop vthread, jlong value);
618 static void set_notified(oop vthread, jboolean value);
619 static void set_interruptible_wait(oop vthread, jboolean value);
620 static bool is_preempted(oop vthread);
621 static JavaThreadStatus map_state_to_thread_status(int state);
622
623 static inline ObjectWaiter* objectWaiter(oop vthread);
624 static inline void set_objectWaiter(oop vthread, ObjectWaiter* waiter);
625 static ObjectMonitor* current_pending_monitor(oop vthread);
626 static ObjectMonitor* current_waiting_monitor(oop vthread);
627 };
628
629
630 // Interface to java.lang.Throwable objects
631
632 class java_lang_Throwable: AllStatic {
633 friend class BacktraceBuilder;
634 friend class BacktraceIterator;
635
636 private:
637 // Trace constants
638 enum {
639 trace_methods_offset = 0,
|