607
608 jlong allocated_bytes() { return _allocated_bytes; }
609 void set_allocated_bytes(jlong value) { _allocated_bytes = value; }
610 void incr_allocated_bytes(jlong size) { _allocated_bytes += size; }
611 inline jlong cooked_allocated_bytes();
612
613 ThreadHeapSampler& heap_sampler() { return _heap_sampler; }
614
615 ThreadStatisticalInfo& statistical_info() { return _statistical_info; }
616
617 JFR_ONLY(DEFINE_THREAD_LOCAL_ACCESSOR_JFR;)
618
619 bool is_trace_suspend() { return (_suspend_flags & _trace_flag) != 0; }
620
621 // VM operation support
622 int vm_operation_ticket() { return ++_vm_operation_started_count; }
623 int vm_operation_completed_count() { return _vm_operation_completed_count; }
624 void increment_vm_operation_completed_count() { _vm_operation_completed_count++; }
625
626 // For tracking the heavyweight monitor the thread is pending on.
627 ObjectMonitor* current_pending_monitor() {
628 return _current_pending_monitor;
629 }
630 void set_current_pending_monitor(ObjectMonitor* monitor) {
631 _current_pending_monitor = monitor;
632 }
633 void set_current_pending_monitor_is_from_java(bool from_java) {
634 _current_pending_monitor_is_from_java = from_java;
635 }
636 bool current_pending_monitor_is_from_java() {
637 return _current_pending_monitor_is_from_java;
638 }
639
640 // For tracking the ObjectMonitor on which this thread called Object.wait()
641 ObjectMonitor* current_waiting_monitor() {
642 return _current_waiting_monitor;
643 }
644 void set_current_waiting_monitor(ObjectMonitor* monitor) {
645 _current_waiting_monitor = monitor;
646 }
647
648 // For tracking the Jvmti raw monitor the thread is pending on.
649 JvmtiRawMonitor* current_pending_raw_monitor() {
650 return _current_pending_raw_monitor;
651 }
652 void set_current_pending_raw_monitor(JvmtiRawMonitor* monitor) {
653 _current_pending_raw_monitor = monitor;
654 }
655
656 // GC support
657 // Apply "f->do_oop" to all root oops in "this".
658 // Used by JavaThread::oops_do.
659 // Apply "cf->do_code_blob" (if !NULL) to all code blobs active in frames
660 virtual void oops_do(OopClosure* f, CodeBlobClosure* cf);
661
662 // Handles the parallel case for claim_threads_do.
663 private:
664 bool claim_par_threads_do(uintx claim_token);
665 public:
|
607
608 jlong allocated_bytes() { return _allocated_bytes; }
609 void set_allocated_bytes(jlong value) { _allocated_bytes = value; }
610 void incr_allocated_bytes(jlong size) { _allocated_bytes += size; }
611 inline jlong cooked_allocated_bytes();
612
613 ThreadHeapSampler& heap_sampler() { return _heap_sampler; }
614
615 ThreadStatisticalInfo& statistical_info() { return _statistical_info; }
616
617 JFR_ONLY(DEFINE_THREAD_LOCAL_ACCESSOR_JFR;)
618
619 bool is_trace_suspend() { return (_suspend_flags & _trace_flag) != 0; }
620
621 // VM operation support
622 int vm_operation_ticket() { return ++_vm_operation_started_count; }
623 int vm_operation_completed_count() { return _vm_operation_completed_count; }
624 void increment_vm_operation_completed_count() { _vm_operation_completed_count++; }
625
626 // For tracking the heavyweight monitor the thread is pending on.
627 ObjectMonitor* current_pending_monitor(ObjectMonitorHandle* omh_p) {
628 if (omh_p->save_om_ptr_if_safe(_current_pending_monitor)) {
629 return omh_p->om_ptr(); // Return the safe ObjectMonitor*.
630 }
631 return NULL;
632 }
633 void set_current_pending_monitor(ObjectMonitor* monitor) {
634 ObjectMonitor* saved_cur = NULL;
635 if (monitor != NULL) {
636 monitor->inc_ref_count(); // Protect the ObjectMonitor* we're about to cache.
637 } else {
638 saved_cur = _current_pending_monitor;
639 }
640 _current_pending_monitor = monitor;
641 if (saved_cur != NULL) {
642 saved_cur->dec_ref_count(); // Cleared the cached ObjectMonitor*.
643 }
644 }
645 void set_current_pending_monitor_is_from_java(bool from_java) {
646 _current_pending_monitor_is_from_java = from_java;
647 }
648 bool current_pending_monitor_is_from_java() {
649 return _current_pending_monitor_is_from_java;
650 }
651
652 // For tracking the ObjectMonitor on which this thread called Object.wait()
653 ObjectMonitor* current_waiting_monitor(ObjectMonitorHandle* omh_p) {
654 if (omh_p->save_om_ptr_if_safe(_current_waiting_monitor)) {
655 return omh_p->om_ptr(); // Return the safe ObjectMonitor*.
656 }
657 return NULL;
658 }
659 void set_current_waiting_monitor(ObjectMonitor* monitor) {
660 ObjectMonitor* saved_cur = NULL;
661 if (monitor != NULL) {
662 monitor->inc_ref_count(); // Protect the ObjectMonitor* we're about to cache.
663 } else {
664 saved_cur = _current_waiting_monitor;
665 }
666 _current_waiting_monitor = monitor;
667 if (saved_cur != NULL) {
668 saved_cur->dec_ref_count(); // Cleared the cached ObjectMonitor*.
669 }
670 }
671
672 // For tracking the Jvmti raw monitor the thread is pending on.
673 JvmtiRawMonitor* current_pending_raw_monitor() {
674 return _current_pending_raw_monitor;
675 }
676 void set_current_pending_raw_monitor(JvmtiRawMonitor* monitor) {
677 _current_pending_raw_monitor = monitor;
678 }
679
680 // GC support
681 // Apply "f->do_oop" to all root oops in "this".
682 // Used by JavaThread::oops_do.
683 // Apply "cf->do_code_blob" (if !NULL) to all code blobs active in frames
684 virtual void oops_do(OopClosure* f, CodeBlobClosure* cf);
685
686 // Handles the parallel case for claim_threads_do.
687 private:
688 bool claim_par_threads_do(uintx claim_token);
689 public:
|