@@ -158,10 +158,6 @@ Monitor* JVMCIRuntime_lock = nullptr;
158158// Only one RecursiveMutex
159159RecursiveMutex* MultiArray_lock = nullptr ;
160160
161- #define MAX_NUM_MUTEX 128
162- static Mutex* _mutex_array[MAX_NUM_MUTEX];
163- static int _num_mutex;
164-
165161#ifdef ASSERT
166162void assert_locked_or_safepoint (const Mutex* lock) {
167163 if (DebuggingContext::is_enabled () || VMError::is_error_reported ()) return ;
@@ -182,18 +178,13 @@ void assert_lock_strong(const Mutex* lock) {
182178}
183179#endif
184180
185- static void add_mutex (Mutex* var) {
186- assert (_num_mutex < MAX_NUM_MUTEX, " increase MAX_NUM_MUTEX" );
187- _mutex_array[_num_mutex++] = var;
188- }
189-
190181#define MUTEX_STORAGE_NAME (name ) name##_storage
191182#define MUTEX_STORAGE (name, type ) alignas (type) static uint8_t MUTEX_STORAGE_NAME (name)[sizeof(type)]
192183#define MUTEX_DEF (name, type, pri, ...) { \
193184 assert (name == nullptr , " Mutex/Monitor initialized twice" ); \
194185 MUTEX_STORAGE (name, type); \
195186 name = ::new (static_cast <void *>(MUTEX_STORAGE_NAME (name))) type ((pri), #name, ##__VA_ARGS__); \
196- add_mutex (name); \
187+ Mutex:: add_mutex (name); \
197188}
198189#define MUTEX_DEFN (name, type, pri, ...) MUTEX_DEF(name, type, Mutex::pri, ##__VA_ARGS__)
199190
@@ -371,7 +362,7 @@ void MutexLockerImpl::post_initialize() {
371362 if (lt.is_enabled ()) {
372363 ResourceMark rm;
373364 LogStream ls (lt);
374- print_lock_ranks (&ls);
365+ Mutex:: print_lock_ranks (&ls);
375366 }
376367}
377368
@@ -385,58 +376,3 @@ GCMutexLocker::GCMutexLocker(Mutex* mutex) {
385376 }
386377}
387378
388- // Print all mutexes/monitors that are currently owned by a thread; called
389- // by fatal error handler.
390- void print_owned_locks_on_error (outputStream* st) {
391- st->print (" VM Mutex/Monitor currently owned by a thread: " );
392- bool none = true ;
393- for (int i = 0 ; i < _num_mutex; i++) {
394- // see if it has an owner
395- if (_mutex_array[i]->owner () != nullptr ) {
396- if (none) {
397- // print format used by Mutex::print_on_error()
398- st->print_cr (" ([mutex/lock_event])" );
399- none = false ;
400- }
401- _mutex_array[i]->print_on_error (st);
402- st->cr ();
403- }
404- }
405- if (none) st->print_cr (" None" );
406- }
407-
408- void print_lock_ranks (outputStream* st) {
409- st->print_cr (" VM Mutex/Monitor ranks: " );
410-
411- #ifdef ASSERT
412- // Be extra defensive and figure out the bounds on
413- // ranks right here. This also saves a bit of time
414- // in the #ranks*#mutexes loop below.
415- int min_rank = INT_MAX;
416- int max_rank = INT_MIN;
417- for (int i = 0 ; i < _num_mutex; i++) {
418- Mutex* m = _mutex_array[i];
419- int r = (int ) m->rank ();
420- if (min_rank > r) min_rank = r;
421- if (max_rank < r) max_rank = r;
422- }
423-
424- // Print the listings rank by rank
425- for (int r = min_rank; r <= max_rank; r++) {
426- bool first = true ;
427- for (int i = 0 ; i < _num_mutex; i++) {
428- Mutex* m = _mutex_array[i];
429- if (r != (int ) m->rank ()) continue ;
430-
431- if (first) {
432- st->cr ();
433- st->print_cr (" Rank \" %s\" :" , m->rank_name ());
434- first = false ;
435- }
436- st->print_cr (" %s" , m->name ());
437- }
438- }
439- #else
440- st->print_cr (" Only known in debug builds." );
441- #endif // ASSERT
442- }
0 commit comments