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->set_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->set_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;
|
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;
|