src/share/vm/runtime/mutex.hpp

Print this page
rev 6249 : 8039458: Ensure consistency of Monitor/Mutex lock acquisitions in relation to safepoint protocol
Reviewed-by:


 123   Thread * volatile _owner;              // The owner of the lock
 124                                          // Consider sequestering _owner on its own $line
 125                                          // to aid future synchronization mechanisms.
 126   ParkEvent * volatile _EntryList ;      // List of threads waiting for entry
 127   ParkEvent * volatile _OnDeck ;         // heir-presumptive
 128   volatile intptr_t _WaitLock [1] ;      // Protects _WaitSet
 129   ParkEvent * volatile  _WaitSet ;       // LL of ParkEvents
 130   volatile bool     _snuck;              // Used for sneaky locking (evil).
 131   int NotifyCount ;                      // diagnostic assist
 132   char _name[MONITOR_NAME_LEN];          // Name of mutex
 133 
 134   // Debugging fields for naming, deadlock detection, etc. (some only used in debug mode)
 135 #ifndef PRODUCT
 136   bool      _allow_vm_block;
 137   debug_only(int _rank;)                 // rank (to avoid/detect potential deadlocks)
 138   debug_only(Monitor * _next;)           // Used by a Thread to link up owned locks
 139   debug_only(Thread* _last_owner;)       // the last thread to own the lock
 140   debug_only(static bool contains(Monitor * locks, Monitor * lock);)
 141   debug_only(static Monitor * get_least_ranked_lock(Monitor * locks);)
 142   debug_only(Monitor * get_least_ranked_lock_besides_this(Monitor * locks);)



 143 #endif
 144 
 145   void set_owner_implementation(Thread* owner)                        PRODUCT_RETURN;
 146   void check_prelock_state     (Thread* thread)                       PRODUCT_RETURN;
 147   void check_block_state       (Thread* thread)                       PRODUCT_RETURN;
 148 
 149   // platform-dependent support code can go here (in os_<os_family>.cpp)
 150  public:
 151   enum {
 152     _no_safepoint_check_flag    = true,
 153     _allow_vm_block_flag        = true,
 154     _as_suspend_equivalent_flag = true
 155   };
 156 
 157   enum WaitResults {
 158     CONDVAR_EVENT,         // Wait returned because of condition variable notification
 159     INTERRUPT_EVENT,       // Wait returned because waiting thread was interrupted
 160     NUMBER_WAIT_RESULTS
 161   };
 162 




 123   Thread * volatile _owner;              // The owner of the lock
 124                                          // Consider sequestering _owner on its own $line
 125                                          // to aid future synchronization mechanisms.
 126   ParkEvent * volatile _EntryList ;      // List of threads waiting for entry
 127   ParkEvent * volatile _OnDeck ;         // heir-presumptive
 128   volatile intptr_t _WaitLock [1] ;      // Protects _WaitSet
 129   ParkEvent * volatile  _WaitSet ;       // LL of ParkEvents
 130   volatile bool     _snuck;              // Used for sneaky locking (evil).
 131   int NotifyCount ;                      // diagnostic assist
 132   char _name[MONITOR_NAME_LEN];          // Name of mutex
 133 
 134   // Debugging fields for naming, deadlock detection, etc. (some only used in debug mode)
 135 #ifndef PRODUCT
 136   bool      _allow_vm_block;
 137   debug_only(int _rank;)                 // rank (to avoid/detect potential deadlocks)
 138   debug_only(Monitor * _next;)           // Used by a Thread to link up owned locks
 139   debug_only(Thread* _last_owner;)       // the last thread to own the lock
 140   debug_only(static bool contains(Monitor * locks, Monitor * lock);)
 141   debug_only(static Monitor * get_least_ranked_lock(Monitor * locks);)
 142   debug_only(Monitor * get_least_ranked_lock_besides_this(Monitor * locks);)
 143   debug_only(void ensure_lock_acquisition_consistency(const Thread* new_owner) const;)
 144   debug_only(bool acquired_with_no_safepoint_check(void) const;)
 145   debug_only(bool _acquired_with_no_safepoint_check;)
 146 #endif
 147 
 148   void set_owner_implementation(Thread* owner)                        PRODUCT_RETURN;
 149   void check_prelock_state     (Thread* thread)                       PRODUCT_RETURN;
 150   void check_block_state       (Thread* thread)                       PRODUCT_RETURN;
 151 
 152   // platform-dependent support code can go here (in os_<os_family>.cpp)
 153  public:
 154   enum {
 155     _no_safepoint_check_flag    = true,
 156     _allow_vm_block_flag        = true,
 157     _as_suspend_equivalent_flag = true
 158   };
 159 
 160   enum WaitResults {
 161     CONDVAR_EVENT,         // Wait returned because of condition variable notification
 162     INTERRUPT_EVENT,       // Wait returned because waiting thread was interrupted
 163     NUMBER_WAIT_RESULTS
 164   };
 165