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