@@ -99,10 +99,8 @@ class Mutex : public CHeapObj<mtSynchronizer> {
99
99
void no_safepoint_verifier (Thread* thread, bool enable) NOT_DEBUG_RETURN;
100
100
101
101
public:
102
- enum {
103
- _allow_vm_block_flag = true ,
104
- _as_suspend_equivalent_flag = true
105
- };
102
+ static const bool _allow_vm_block_flag = true ;
103
+ static const bool _as_suspend_equivalent_flag = true ;
106
104
107
105
// Locks can be acquired with or without a safepoint check. NonJavaThreads do not follow
108
106
// the safepoint protocol when acquiring locks.
@@ -124,12 +122,17 @@ class Mutex : public CHeapObj<mtSynchronizer> {
124
122
// deadlock can occur. We should check this by noting which
125
123
// locks are shared, and walk held locks during safepoint checking.
126
124
127
- enum SafepointCheckFlag {
125
+ enum class SafepointCheckFlag {
128
126
_safepoint_check_flag,
129
127
_no_safepoint_check_flag
130
128
};
129
+ // Bring the enumerator names into class scope.
130
+ static const SafepointCheckFlag _safepoint_check_flag =
131
+ SafepointCheckFlag::_safepoint_check_flag;
132
+ static const SafepointCheckFlag _no_safepoint_check_flag =
133
+ SafepointCheckFlag::_no_safepoint_check_flag;
131
134
132
- enum SafepointCheckRequired {
135
+ enum class SafepointCheckRequired {
133
136
_safepoint_check_never, // Mutexes with this value will cause errors
134
137
// when acquired by a JavaThread with a safepoint check.
135
138
_safepoint_check_sometimes, // A couple of special locks are acquired by JavaThreads sometimes
@@ -138,6 +141,13 @@ class Mutex : public CHeapObj<mtSynchronizer> {
138
141
_safepoint_check_always // Mutexes with this value will cause errors
139
142
// when acquired by a JavaThread without a safepoint check.
140
143
};
144
+ // Bring the enumerator names into class scope.
145
+ static const SafepointCheckRequired _safepoint_check_never =
146
+ SafepointCheckRequired::_safepoint_check_never;
147
+ static const SafepointCheckRequired _safepoint_check_sometimes =
148
+ SafepointCheckRequired::_safepoint_check_sometimes;
149
+ static const SafepointCheckRequired _safepoint_check_always =
150
+ SafepointCheckRequired::_safepoint_check_always;
141
151
142
152
NOT_PRODUCT (SafepointCheckRequired _safepoint_check_required;)
143
153
0 commit comments