< prev index next >

src/hotspot/share/runtime/thread.hpp

Print this page
rev 56776 : v2.00 -> v2.07 (CR7/v2.07/10-for-jdk14) patches combined into one; merge with 8230876.patch (2019.10.17) and jdk-14+21.
rev 56777 : See CR7-to-CR8-changes.

*** 412,426 **** // ObjectMonitor on which this thread called Object.wait() ObjectMonitor* _current_waiting_monitor; // Per-thread ObjectMonitor lists: public: ! ObjectMonitor* om_free_list; // SLL of free ObjectMonitors ! int om_free_count; // # on om_free_list int om_free_provision; // # to try to allocate next ! ObjectMonitor* om_in_use_list; // SLL of in-use ObjectMonitors ! int om_in_use_count; // # on om_in_use_list #ifdef ASSERT private: volatile uint64_t _visited_for_critical_count; --- 412,426 ---- // ObjectMonitor on which this thread called Object.wait() ObjectMonitor* _current_waiting_monitor; // Per-thread ObjectMonitor lists: public: ! ObjectMonitor* volatile om_free_list; // SLL of free ObjectMonitors ! volatile int om_free_count; // # on om_free_list int om_free_provision; // # to try to allocate next ! ObjectMonitor* volatile om_in_use_list; // SLL of in-use ObjectMonitors ! volatile int om_in_use_count; // # on om_in_use_list #ifdef ASSERT private: volatile uint64_t _visited_for_critical_count;
*** 522,532 **** void set_native_thread_name(const char *name) { assert(Thread::current() == this, "set_native_thread_name can only be called on the current thread"); os::set_native_thread_name(name); } - ObjectMonitor** om_in_use_list_addr() { return (ObjectMonitor **)&om_in_use_list; } Monitor* SR_lock() const { return _SR_lock; } bool has_async_exception() const { return (_suspend_flags & _has_async_exception) != 0; } inline void set_suspend_flag(SuspendFlags f); --- 522,531 ----
*** 621,649 **** int vm_operation_ticket() { return ++_vm_operation_started_count; } int vm_operation_completed_count() { return _vm_operation_completed_count; } void increment_vm_operation_completed_count() { _vm_operation_completed_count++; } // For tracking the heavyweight monitor the thread is pending on. ! ObjectMonitor* current_pending_monitor() { ! return _current_pending_monitor; } void set_current_pending_monitor(ObjectMonitor* monitor) { _current_pending_monitor = monitor; } void set_current_pending_monitor_is_from_java(bool from_java) { _current_pending_monitor_is_from_java = from_java; } bool current_pending_monitor_is_from_java() { return _current_pending_monitor_is_from_java; } // For tracking the ObjectMonitor on which this thread called Object.wait() ! ObjectMonitor* current_waiting_monitor() { ! return _current_waiting_monitor; } void set_current_waiting_monitor(ObjectMonitor* monitor) { _current_waiting_monitor = monitor; } // For tracking the Jvmti raw monitor the thread is pending on. JvmtiRawMonitor* current_pending_raw_monitor() { return _current_pending_raw_monitor; --- 620,672 ---- int vm_operation_ticket() { return ++_vm_operation_started_count; } int vm_operation_completed_count() { return _vm_operation_completed_count; } void increment_vm_operation_completed_count() { _vm_operation_completed_count++; } // For tracking the heavyweight monitor the thread is pending on. ! ObjectMonitor* current_pending_monitor(ObjectMonitorHandle* omh_p) { ! if (omh_p->set_om_ptr_if_safe(_current_pending_monitor)) { ! return omh_p->om_ptr(); // Return the safe ObjectMonitor*. ! } ! return NULL; } void set_current_pending_monitor(ObjectMonitor* monitor) { + ObjectMonitor* saved_cur = NULL; + if (monitor != NULL) { + monitor->inc_ref_count(); // Protect the ObjectMonitor* we're about to cache. + } else { + saved_cur = _current_pending_monitor; + } _current_pending_monitor = monitor; + if (saved_cur != NULL) { + saved_cur->dec_ref_count(); // Cleared the cached ObjectMonitor*. + } } void set_current_pending_monitor_is_from_java(bool from_java) { _current_pending_monitor_is_from_java = from_java; } bool current_pending_monitor_is_from_java() { return _current_pending_monitor_is_from_java; } // For tracking the ObjectMonitor on which this thread called Object.wait() ! ObjectMonitor* current_waiting_monitor(ObjectMonitorHandle* omh_p) { ! if (omh_p->set_om_ptr_if_safe(_current_waiting_monitor)) { ! return omh_p->om_ptr(); // Return the safe ObjectMonitor*. ! } ! return NULL; } void set_current_waiting_monitor(ObjectMonitor* monitor) { + ObjectMonitor* saved_cur = NULL; + if (monitor != NULL) { + monitor->inc_ref_count(); // Protect the ObjectMonitor* we're about to cache. + } else { + saved_cur = _current_waiting_monitor; + } _current_waiting_monitor = monitor; + if (saved_cur != NULL) { + saved_cur->dec_ref_count(); // Cleared the cached ObjectMonitor*. + } } // For tracking the Jvmti raw monitor the thread is pending on. JvmtiRawMonitor* current_pending_raw_monitor() { return _current_pending_raw_monitor;
< prev index next >