504 // name
505 static const char* name(oop java_thread_group);
506 // maxPriority in group
507 static ThreadPriority maxPriority(oop java_thread_group);
508 // Daemon
509 static bool is_daemon(oop java_thread_group);
510
511 // Debugging
512 friend class JavaClasses;
513 };
514
515
516 // Interface to java.lang.VirtualThread objects
517
518 class java_lang_VirtualThread : AllStatic {
519 private:
520 static int static_vthread_scope_offset;
521 static int _carrierThread_offset;
522 static int _continuation_offset;
523 static int _state_offset;
524 JFR_ONLY(static int _jfr_epoch_offset;)
525 public:
526 enum {
527 NEW = 0,
528 STARTED = 1,
529 RUNNING = 2,
530 PARKING = 3,
531 PARKED = 4,
532 PINNED = 5,
533 TIMED_PARKING = 6,
534 TIMED_PARKED = 7,
535 TIMED_PINNED = 8,
536 UNPARKED = 9,
537 YIELDING = 10,
538 YIELDED = 11,
539 TERMINATED = 99,
540
541 // additional state bits
542 SUSPENDED = 1 << 8, // suspended when unmounted
543 };
544
545 static void compute_offsets();
546 static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
547
548 // Testers
549 static bool is_subclass(Klass* klass) {
550 return klass->is_subclass_of(vmClasses::VirtualThread_klass());
551 }
552 static bool is_instance(oop obj);
553
554 static oop vthread_scope();
555 static oop carrier_thread(oop vthread);
556 static oop continuation(oop vthread);
557 static int state(oop vthread);
558 static JavaThreadStatus map_state_to_thread_status(int state);
559 };
560
561
562 // Interface to java.lang.Throwable objects
563
564 class java_lang_Throwable: AllStatic {
565 friend class BacktraceBuilder;
566 friend class BacktraceIterator;
567
568 private:
569 // Trace constants
570 enum {
571 trace_methods_offset = 0,
572 trace_bcis_offset = 1,
573 trace_mirrors_offset = 2,
574 trace_names_offset = 3,
575 trace_conts_offset = 4,
576 trace_next_offset = 5,
577 trace_hidden_offset = 6,
|
504 // name
505 static const char* name(oop java_thread_group);
506 // maxPriority in group
507 static ThreadPriority maxPriority(oop java_thread_group);
508 // Daemon
509 static bool is_daemon(oop java_thread_group);
510
511 // Debugging
512 friend class JavaClasses;
513 };
514
515
516 // Interface to java.lang.VirtualThread objects
517
518 class java_lang_VirtualThread : AllStatic {
519 private:
520 static int static_vthread_scope_offset;
521 static int _carrierThread_offset;
522 static int _continuation_offset;
523 static int _state_offset;
524 static int _next_offset;
525 static int _onWaitingList_offset;
526 static int _recheckInterval_offset;
527 JFR_ONLY(static int _jfr_epoch_offset;)
528 public:
529 enum {
530 NEW = 0,
531 STARTED = 1,
532 RUNNING = 2,
533 PARKING = 3,
534 PARKED = 4,
535 PINNED = 5,
536 TIMED_PARKING = 6,
537 TIMED_PARKED = 7,
538 TIMED_PINNED = 8,
539 UNPARKED = 9,
540 YIELDING = 10,
541 YIELDED = 11,
542 BLOCKING = 12,
543 BLOCKED = 13,
544 UNBLOCKED = 14,
545 TERMINATED = 99,
546
547 // additional state bits
548 SUSPENDED = 1 << 8, // suspended when unmounted
549 };
550
551 static void compute_offsets();
552 static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
553
554 // Testers
555 static bool is_subclass(Klass* klass) {
556 return klass->is_subclass_of(vmClasses::VirtualThread_klass());
557 }
558 static bool is_instance(oop obj);
559
560 static oop vthread_scope();
561 static oop carrier_thread(oop vthread);
562 static oop continuation(oop vthread);
563 static int state(oop vthread);
564 static void set_state(oop vthread, int state);
565 static oop next(oop vthread);
566 static void set_next(oop vthread, oop next_vthread);
567 static bool set_onWaitingList(oop vthread, OopHandle& list_head);
568 static jbyte recheckInterval(oop vthread);
569 static void set_recheckInterval(oop vthread, jbyte value);
570 static bool is_preempted(oop vthread);
571 static JavaThreadStatus map_state_to_thread_status(int state);
572 };
573
574
575 // Interface to java.lang.Throwable objects
576
577 class java_lang_Throwable: AllStatic {
578 friend class BacktraceBuilder;
579 friend class BacktraceIterator;
580
581 private:
582 // Trace constants
583 enum {
584 trace_methods_offset = 0,
585 trace_bcis_offset = 1,
586 trace_mirrors_offset = 2,
587 trace_names_offset = 3,
588 trace_conts_offset = 4,
589 trace_next_offset = 5,
590 trace_hidden_offset = 6,
|