< prev index next >

src/hotspot/share/runtime/mutex.hpp

Print this page
rev 56464 : 8231707: Improve Mutex inlining
Reviewed-by: coleenp, rehn


 135     _safepoint_check_sometimes,   // A couple of special locks are acquired by JavaThreads sometimes
 136                                   // with and sometimes without safepoint checks. These
 137                                   // locks will not produce errors when locked.
 138     _safepoint_check_always       // Mutexes with this value will cause errors
 139                                   // when acquired by a JavaThread without a safepoint check.
 140   };
 141 
 142   NOT_PRODUCT(SafepointCheckRequired _safepoint_check_required;)
 143 
 144  public:
 145   Mutex(int rank, const char *name, bool allow_vm_block = false,
 146         SafepointCheckRequired safepoint_check_required = _safepoint_check_always);
 147   ~Mutex();
 148 
 149   void lock(); // prints out warning if VM thread blocks
 150   void lock(Thread *thread); // overloaded with current thread
 151   void unlock();
 152   bool is_locked() const                     { return _owner != NULL; }
 153 
 154   bool try_lock(); // Like lock(), but unblocking. It returns false instead



 155 
 156   void release_for_safepoint();
 157 
 158   // Lock without safepoint check. Should ONLY be used by safepoint code and other code
 159   // that is guaranteed not to block while running inside the VM.
 160   void lock_without_safepoint_check();
 161   void lock_without_safepoint_check(Thread* self);
 162 
 163   // Current owner - not not MT-safe. Can only be used to guarantee that
 164   // the current running thread owns the lock
 165   Thread* owner() const         { return _owner; }
 166   bool owned_by_self() const;
 167 
 168   const char *name() const                  { return _name; }
 169 
 170   void print_on_error(outputStream* st) const;
 171 
 172   #ifndef PRODUCT
 173     void print_on(outputStream* st) const;
 174     void print() const                      { print_on(::tty); }




 135     _safepoint_check_sometimes,   // A couple of special locks are acquired by JavaThreads sometimes
 136                                   // with and sometimes without safepoint checks. These
 137                                   // locks will not produce errors when locked.
 138     _safepoint_check_always       // Mutexes with this value will cause errors
 139                                   // when acquired by a JavaThread without a safepoint check.
 140   };
 141 
 142   NOT_PRODUCT(SafepointCheckRequired _safepoint_check_required;)
 143 
 144  public:
 145   Mutex(int rank, const char *name, bool allow_vm_block = false,
 146         SafepointCheckRequired safepoint_check_required = _safepoint_check_always);
 147   ~Mutex();
 148 
 149   void lock(); // prints out warning if VM thread blocks
 150   void lock(Thread *thread); // overloaded with current thread
 151   void unlock();
 152   bool is_locked() const                     { return _owner != NULL; }
 153 
 154   bool try_lock(); // Like lock(), but unblocking. It returns false instead
 155  private:
 156   void lock_contended(Thread *thread); // contended slow-path
 157  public:
 158 
 159   void release_for_safepoint();
 160 
 161   // Lock without safepoint check. Should ONLY be used by safepoint code and other code
 162   // that is guaranteed not to block while running inside the VM.
 163   void lock_without_safepoint_check();
 164   void lock_without_safepoint_check(Thread* self);
 165 
 166   // Current owner - not not MT-safe. Can only be used to guarantee that
 167   // the current running thread owns the lock
 168   Thread* owner() const         { return _owner; }
 169   bool owned_by_self() const;
 170 
 171   const char *name() const                  { return _name; }
 172 
 173   void print_on_error(outputStream* st) const;
 174 
 175   #ifndef PRODUCT
 176     void print_on(outputStream* st) const;
 177     void print() const                      { print_on(::tty); }


< prev index next >