45 // The rank 'access' is similar to 'special' and has the same restrictions on usage.
46 // It is reserved for locks that may be required in order to perform memory accesses
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 is only for use in Mutex's created by JVM_RawMonitorCreate,
56 // which being external to the VM are not subject to deadlock detection.
57 // While at a safepoint no mutexes of rank safepoint are held by any thread.
58 // The rank named "leaf" is probably historical (and should
59 // be changed) -- mutexes of this rank aren't really leaf mutexes
60 // at all.
61 enum lock_types {
62 event,
63 access = event + 1,
64 tty = access + 2,
65 special = tty + 1,
66 suspend_resume = special + 1,
67 vmweak = suspend_resume + 2,
68 leaf = vmweak + 2,
69 safepoint = leaf + 10,
70 barrier = safepoint + 1,
71 nonleaf = barrier + 1,
72 max_nonleaf = nonleaf + 900,
73 native = max_nonleaf + 1
74 };
75
76 protected: // Monitor-Mutex metadata
77 Thread * volatile _owner; // The owner of the lock
78 os::PlatformMonitor _lock; // Native monitor implementation
79 char _name[MONITOR_NAME_LEN]; // Name of mutex/monitor
80
81 // Debugging fields for naming, deadlock detection, etc. (some only used in debug mode)
82 #ifndef PRODUCT
83 bool _allow_vm_block;
84 DEBUG_ONLY(int _rank;) // rank (to avoid/detect potential deadlocks)
85 DEBUG_ONLY(Monitor * _next;) // Used by a Thread to link up owned locks
|
45 // The rank 'access' is similar to 'special' and has the same restrictions on usage.
46 // It is reserved for locks that may be required in order to perform memory accesses
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 is only for use in Mutex's created by JVM_RawMonitorCreate,
56 // which being external to the VM are not subject to deadlock detection.
57 // While at a safepoint no mutexes of rank safepoint are held by any thread.
58 // The rank named "leaf" is probably historical (and should
59 // be changed) -- mutexes of this rank aren't really leaf mutexes
60 // at all.
61 enum lock_types {
62 event,
63 access = event + 1,
64 tty = access + 2,
65 special = tty + 2,
66 suspend_resume = special + 1,
67 vmweak = suspend_resume + 2,
68 leaf = vmweak + 2,
69 safepoint = leaf + 10,
70 barrier = safepoint + 1,
71 nonleaf = barrier + 1,
72 max_nonleaf = nonleaf + 900,
73 native = max_nonleaf + 1
74 };
75
76 protected: // Monitor-Mutex metadata
77 Thread * volatile _owner; // The owner of the lock
78 os::PlatformMonitor _lock; // Native monitor implementation
79 char _name[MONITOR_NAME_LEN]; // Name of mutex/monitor
80
81 // Debugging fields for naming, deadlock detection, etc. (some only used in debug mode)
82 #ifndef PRODUCT
83 bool _allow_vm_block;
84 DEBUG_ONLY(int _rank;) // rank (to avoid/detect potential deadlocks)
85 DEBUG_ONLY(Monitor * _next;) // Used by a Thread to link up owned locks
|