30
30
#include " memory/universe.hpp"
31
31
#include " runtime/javaThread.hpp"
32
32
#include " runtime/mutexLocker.hpp"
33
- #include " runtime/os.inline.hpp"
34
33
#include " runtime/safepoint.hpp"
35
34
#include " runtime/vmThread.hpp"
35
+ #include " utilities/vmError.hpp"
36
36
37
37
// Mutexes used in the VM (see comment in mutexLocker.hpp):
38
38
@@ -166,7 +166,7 @@ static int _num_mutex;
166
166
167
167
#ifdef ASSERT
168
168
void assert_locked_or_safepoint (const Mutex* lock) {
169
- if (DebuggingContext::is_enabled ()) return ;
169
+ if (DebuggingContext::is_enabled () || VMError::is_error_reported () ) return ;
170
170
// check if this thread owns the lock (common case)
171
171
assert (lock != nullptr , " Need non-null lock" );
172
172
if (lock->owned_by_self ()) return ;
@@ -177,7 +177,7 @@ void assert_locked_or_safepoint(const Mutex* lock) {
177
177
178
178
// a weaker assertion than the above
179
179
void assert_locked_or_safepoint_weak (const Mutex* lock) {
180
- if (DebuggingContext::is_enabled ()) return ;
180
+ if (DebuggingContext::is_enabled () || VMError::is_error_reported () ) return ;
181
181
assert (lock != nullptr , " Need non-null lock" );
182
182
if (lock->is_locked ()) return ;
183
183
if (SafepointSynchronize::is_at_safepoint ()) return ;
@@ -187,7 +187,7 @@ void assert_locked_or_safepoint_weak(const Mutex* lock) {
187
187
188
188
// a stronger assertion than the above
189
189
void assert_lock_strong (const Mutex* lock) {
190
- if (DebuggingContext::is_enabled ()) return ;
190
+ if (DebuggingContext::is_enabled () || VMError::is_error_reported () ) return ;
191
191
assert (lock != nullptr , " Need non-null lock" );
192
192
if (lock->owned_by_self ()) return ;
193
193
fatal (" must own lock %s" , lock->name ());
0 commit comments