< prev index next >

src/hotspot/share/runtime/mutex.hpp

Print this page
rev 56251 : imported patch 8226705-v1


  47   // that require special barriers, e.g. SATB GC barriers, that in turn uses locks.
  48   // The rank 'tty' is also similar to 'special' and has the same restrictions.
  49   // It is reserved for the tty_lock.
  50   // Since memory accesses should be able to be performed pretty much anywhere
  51   // in the code, that requires locks required for performing accesses being
  52   // inherently a bit more special than even locks of the 'special' rank.
  53   // NOTE: It is critical that the rank 'special' be the lowest (earliest)
  54   // (except for "event" and "access") for the deadlock detection to work correctly.
  55   // The rank native was only for use in Mutexes created by JVM_RawMonitorCreate,
  56   // which being external to the VM are not subject to deadlock detection,
  57   // however it has now been used by other locks that don't fit into the
  58   // deadlock detection scheme.
  59   // While at a safepoint no mutexes of rank safepoint are held by any thread.
  60   // The rank named "leaf" is probably historical (and should
  61   // be changed) -- mutexes of this rank aren't really leaf mutexes
  62   // at all.
  63   enum lock_types {
  64        event,
  65        access         = event          +   1,
  66        tty            = access         +   2,
  67        special        = tty            +   1,
  68        suspend_resume = special        +   1,
  69        oopstorage     = suspend_resume +   2,
  70        leaf           = oopstorage     +   2,
  71        safepoint      = leaf           +  10,
  72        barrier        = safepoint      +   1,
  73        nonleaf        = barrier        +   1,
  74        max_nonleaf    = nonleaf        + 900,
  75        native         = max_nonleaf    +   1
  76   };
  77 
  78  protected:                              // Monitor-Mutex metadata
  79   Thread * volatile _owner;              // The owner of the lock
  80   os::PlatformMonitor _lock;             // Native monitor implementation
  81   char _name[MUTEX_NAME_LEN];            // Name of mutex/monitor
  82 
  83   // Debugging fields for naming, deadlock detection, etc. (some only used in debug mode)
  84 #ifndef PRODUCT
  85   bool      _allow_vm_block;
  86   DEBUG_ONLY(int _rank;)                 // rank (to avoid/detect potential deadlocks)
  87   DEBUG_ONLY(Mutex* _next;)              // Used by a Thread to link up owned locks




  47   // that require special barriers, e.g. SATB GC barriers, that in turn uses locks.
  48   // The rank 'tty' is also similar to 'special' and has the same restrictions.
  49   // It is reserved for the tty_lock.
  50   // Since memory accesses should be able to be performed pretty much anywhere
  51   // in the code, that requires locks required for performing accesses being
  52   // inherently a bit more special than even locks of the 'special' rank.
  53   // NOTE: It is critical that the rank 'special' be the lowest (earliest)
  54   // (except for "event" and "access") for the deadlock detection to work correctly.
  55   // The rank native was only for use in Mutexes created by JVM_RawMonitorCreate,
  56   // which being external to the VM are not subject to deadlock detection,
  57   // however it has now been used by other locks that don't fit into the
  58   // deadlock detection scheme.
  59   // While at a safepoint no mutexes of rank safepoint are held by any thread.
  60   // The rank named "leaf" is probably historical (and should
  61   // be changed) -- mutexes of this rank aren't really leaf mutexes
  62   // at all.
  63   enum lock_types {
  64        event,
  65        access         = event          +   1,
  66        tty            = access         +   2,
  67        special        = tty            +   2,
  68        suspend_resume = special        +   1,
  69        oopstorage     = suspend_resume +   2,
  70        leaf           = oopstorage     +   2,
  71        safepoint      = leaf           +  10,
  72        barrier        = safepoint      +   1,
  73        nonleaf        = barrier        +   1,
  74        max_nonleaf    = nonleaf        + 900,
  75        native         = max_nonleaf    +   1
  76   };
  77 
  78  protected:                              // Monitor-Mutex metadata
  79   Thread * volatile _owner;              // The owner of the lock
  80   os::PlatformMonitor _lock;             // Native monitor implementation
  81   char _name[MUTEX_NAME_LEN];            // Name of mutex/monitor
  82 
  83   // Debugging fields for naming, deadlock detection, etc. (some only used in debug mode)
  84 #ifndef PRODUCT
  85   bool      _allow_vm_block;
  86   DEBUG_ONLY(int _rank;)                 // rank (to avoid/detect potential deadlocks)
  87   DEBUG_ONLY(Mutex* _next;)              // Used by a Thread to link up owned locks


< prev index next >