--- old/src/hotspot/share/gc/shared/parallelCleaning.cpp 2018-11-05 20:45:59.432194242 -0500 +++ new/src/hotspot/share/gc/shared/parallelCleaning.cpp 2018-11-05 20:45:57.856104340 -0500 @@ -89,8 +89,6 @@ CodeCache::verify_icholder_relocations(); } -Monitor* CodeCacheUnloadingTask::_lock = new Monitor(Mutex::leaf, "Code Cache Unload lock", false, Monitor::_safepoint_check_never); - void CodeCacheUnloadingTask::claim_nmethods(CompiledMethod** claimed_nmethods, int *num_claimed_nmethods) { CompiledMethod* first; CompiledMethodIterator last; --- old/src/hotspot/share/gc/shared/parallelCleaning.hpp 2018-11-05 20:46:04.340474217 -0500 +++ new/src/hotspot/share/gc/shared/parallelCleaning.hpp 2018-11-05 20:46:02.768384543 -0500 @@ -56,7 +56,6 @@ }; class CodeCacheUnloadingTask { - static Monitor* _lock; CodeCache::UnloadingScope _unloading_scope; const bool _unloading_occurred; --- old/src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp 2018-11-05 20:46:09.316758071 -0500 +++ new/src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp 2018-11-05 20:46:07.736667939 -0500 @@ -321,7 +321,6 @@ int _cur_index; const u4 _max_frames; volatile bool _disenrolled; - static Monitor* _transition_block_lock; JavaThread* next_thread(ThreadsList* t_list, JavaThread* first_sampled, JavaThread* current); void task_stacktrace(JfrSampleType type, JavaThread** last_thread); @@ -339,12 +338,10 @@ public: void run(); - static Monitor* transition_block() { return _transition_block_lock; } + static Monitor* transition_block() { return JfrThreadSampler_lock; } static void on_javathread_suspend(JavaThread* thread); }; -Monitor* JfrThreadSampler::_transition_block_lock = new Monitor(Mutex::leaf, "Trace block", true, Monitor::_safepoint_check_never); - static void clear_transition_block(JavaThread* jt) { jt->clear_trace_flag(); JfrThreadLocal* const tl = jt->jfr_thread_local(); --- old/src/hotspot/share/runtime/mutexLocker.cpp 2018-11-05 20:46:14.237038730 -0500 +++ new/src/hotspot/share/runtime/mutexLocker.cpp 2018-11-05 20:46:12.660948828 -0500 @@ -106,7 +106,7 @@ Mutex* ProfilePrint_lock = NULL; Mutex* ExceptionCache_lock = NULL; Mutex* OsrList_lock = NULL; - +Mutex* NMethodSweeper_stat_lock = NULL; #ifndef PRODUCT Mutex* FullGCALot_lock = NULL; #endif @@ -138,6 +138,7 @@ Monitor* JfrMsg_lock = NULL; Mutex* JfrBuffer_lock = NULL; Mutex* JfrStream_lock = NULL; +Monitor* JfrThreadSampler_lock = NULL; #endif #ifndef SUPPORTS_NATIVE_CX8 @@ -147,6 +148,9 @@ Mutex* MetaspaceExpand_lock = NULL; Mutex* ClassLoaderDataGraph_lock = NULL; +Monitor* ThreadsSMRSupport_delete_lock = NULL; +Mutex* Decoder_shared_decoder_lock = NULL; +Mutex* DCmdFactory_lock = NULL; #define MAX_NUM_MUTEX 128 static Monitor * _mutex_array[MAX_NUM_MUTEX]; @@ -243,7 +247,7 @@ def(JmethodIdCreation_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_always); // used for creating jmethodIDs. def(SystemDictionary_lock , PaddedMonitor, leaf, true, Monitor::_safepoint_check_always); // lookups done by VM thread - def(SharedDictionary_lock , PaddedMutex, leaf, true, Monitor::_safepoint_check_always); // lookups done by VM thread + def(SharedDictionary_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_always); // lookups done by VM thread def(Module_lock , PaddedMutex , leaf+2, true, Monitor::_safepoint_check_always); def(InlineCacheBuffer_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_always); def(VMStatistic_lock , PaddedMutex , leaf, false, Monitor::_safepoint_check_always); @@ -318,6 +322,7 @@ def(JfrBuffer_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_never); def(JfrStream_lock , PaddedMutex , leaf+1, true, Monitor::_safepoint_check_never); // ensure to rank lower than 'safepoint' def(JfrStacktrace_lock , PaddedMutex , special, true, Monitor::_safepoint_check_sometimes); + def(JfrThreadSampler_lock , PaddedMonitor, leaf, true, Monitor::_safepoint_check_never); #endif #ifndef SUPPORTS_NATIVE_CX8 @@ -325,6 +330,11 @@ #endif def(CodeHeapStateAnalytics_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_never); + + def(NMethodSweeper_stat_lock , PaddedMutex , special, true, Monitor::_safepoint_check_sometimes); + def(ThreadsSMRSupport_delete_lock, PaddedMonitor, special, false, Monitor::_safepoint_check_never); + def(Decoder_shared_decoder_lock , PaddedMutex , native, false, Monitor::_safepoint_check_never); + def(DCmdFactory_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_never); } GCMutexLocker::GCMutexLocker(Monitor * mutex) { --- old/src/hotspot/share/runtime/mutexLocker.hpp 2018-11-05 20:46:19.145318706 -0500 +++ new/src/hotspot/share/runtime/mutexLocker.hpp 2018-11-05 20:46:17.569228803 -0500 @@ -110,6 +110,7 @@ extern Mutex* ProfilePrint_lock; // a lock used to serialize the printing of profiles extern Mutex* ExceptionCache_lock; // a lock used to synchronize exception cache updates extern Mutex* OsrList_lock; // a lock used to serialize access to OSR queues +extern Mutex* NMethodSweeper_stat_lock; // a lock used to serialize access to sweeper statistics #ifndef PRODUCT extern Mutex* FullGCALot_lock; // a lock to make FullGCALot MT safe @@ -132,12 +133,15 @@ extern Monitor* Service_lock; // a lock used for service thread operation extern Monitor* PeriodicTask_lock; // protects the periodic task structure extern Monitor* RedefineClasses_lock; // locks classes from parallel redefinition - +extern Monitor* ThreadsSMRSupport_delete_lock; // Used by ThreadsSMRSupport to take pressure off the Threads_lock +extern Mutex* Decoder_shared_decoder_lock; // serializes access to the decoder during normal (not error reporting) use +extern Mutex* DCmdFactory_lock; // serialize access to DCmdFactory information #if INCLUDE_JFR extern Mutex* JfrStacktrace_lock; // used to guard access to the JFR stacktrace table extern Monitor* JfrMsg_lock; // protects JFR messaging extern Mutex* JfrBuffer_lock; // protects JFR buffer operations extern Mutex* JfrStream_lock; // protects JFR stream access +extern Monitor* JfrThreadSampler_lock; // used to suspend/resume JFR thread sampler #endif #ifndef SUPPORTS_NATIVE_CX8 --- old/src/hotspot/share/runtime/sweeper.cpp 2018-11-05 20:46:24.049598453 -0500 +++ new/src/hotspot/share/runtime/sweeper.cpp 2018-11-05 20:46:22.473508551 -0500 @@ -164,8 +164,6 @@ Tickspan NMethodSweeper::_peak_sweep_time; // Peak time for a full sweep Tickspan NMethodSweeper::_peak_sweep_fraction_time; // Peak time sweeping one fraction -Monitor* NMethodSweeper::_stat_lock = new Monitor(Mutex::special, "Sweeper::Statistics", true, Monitor::_safepoint_check_sometimes); - class MarkActivationClosure: public CodeBlobClosure { public: virtual void do_code_blob(CodeBlob* cb) { @@ -578,7 +576,7 @@ const Ticks sweep_end_counter = Ticks::now(); const Tickspan sweep_time = sweep_end_counter - sweep_start_counter; { - MutexLockerEx mu(_stat_lock, Mutex::_no_safepoint_check_flag); + MutexLockerEx mu(NMethodSweeper_stat_lock, Mutex::_no_safepoint_check_flag); _total_time_sweeping += sweep_time; _total_time_this_sweep += sweep_time; _peak_sweep_fraction_time = MAX2(sweep_time, _peak_sweep_fraction_time); --- old/src/hotspot/share/runtime/sweeper.hpp 2018-11-05 20:46:28.981879798 -0500 +++ new/src/hotspot/share/runtime/sweeper.hpp 2018-11-05 20:46:27.405789895 -0500 @@ -88,8 +88,6 @@ static Tickspan _peak_sweep_time; // Peak time for a full sweep static Tickspan _peak_sweep_fraction_time; // Peak time sweeping one fraction - static Monitor* _stat_lock; - static MethodStateChange process_compiled_method(CompiledMethod *nm); static void release_compiled_method(CompiledMethod* nm); --- old/src/hotspot/share/runtime/threadSMR.cpp 2018-11-05 20:46:33.898160230 -0500 +++ new/src/hotspot/share/runtime/threadSMR.cpp 2018-11-05 20:46:32.314069871 -0500 @@ -36,10 +36,6 @@ #include "utilities/resourceHash.hpp" #include "utilities/vmError.hpp" -Monitor* ThreadsSMRSupport::_delete_lock = - new Monitor(Monitor::special, "Thread_SMR_delete_lock", - false /* allow_vm_block */, - Monitor::_safepoint_check_never); // The '_cnt', '_max' and '_times" fields are enabled via // -XX:+EnableThreadSMRStatistics: --- old/src/hotspot/share/runtime/threadSMR.hpp 2018-11-05 20:46:40.122515277 -0500 +++ new/src/hotspot/share/runtime/threadSMR.hpp 2018-11-05 20:46:38.546425375 -0500 @@ -91,7 +91,8 @@ // The coordination between ThreadsSMRSupport::release_stable_list() and // ThreadsSMRSupport::smr_delete() uses the delete_lock in order to // reduce the traffic on the Threads_lock. - static Monitor* _delete_lock; + static Monitor* delete_lock() { return ThreadsSMRSupport_delete_lock; } + // The '_cnt', '_max' and '_times" fields are enabled via // -XX:+EnableThreadSMRStatistics (see thread.cpp for a // description about each field): @@ -121,7 +122,6 @@ static void add_deleted_thread_times(uint add_value); static void add_tlh_times(uint add_value); static void clear_delete_notify(); - static Monitor* delete_lock() { return _delete_lock; } static bool delete_notify(); static void free_list(ThreadsList* threads); static void inc_deleted_thread_cnt(); --- old/src/hotspot/share/services/diagnosticFramework.cpp 2018-11-05 20:46:45.046796166 -0500 +++ new/src/hotspot/share/services/diagnosticFramework.cpp 2018-11-05 20:46:43.474706492 -0500 @@ -491,11 +491,10 @@ } } -Mutex* DCmdFactory::_dcmdFactory_lock = new Mutex(Mutex::leaf, "DCmdFactory", true, Monitor::_safepoint_check_never); bool DCmdFactory::_send_jmx_notification = false; DCmdFactory* DCmdFactory::factory(DCmdSource source, const char* name, size_t len) { - MutexLockerEx ml(_dcmdFactory_lock, Mutex::_no_safepoint_check_flag); + MutexLockerEx ml(DCmdFactory_lock, Mutex::_no_safepoint_check_flag); DCmdFactory* factory = _DCmdFactoryList; while (factory != NULL) { if (strlen(factory->name()) == len && @@ -512,7 +511,7 @@ } int DCmdFactory::register_DCmdFactory(DCmdFactory* factory) { - MutexLockerEx ml(_dcmdFactory_lock, Mutex::_no_safepoint_check_flag); + MutexLockerEx ml(DCmdFactory_lock, Mutex::_no_safepoint_check_flag); factory->_next = _DCmdFactoryList; _DCmdFactoryList = factory; if (_send_jmx_notification && !factory->_hidden @@ -537,7 +536,7 @@ } GrowableArray* DCmdFactory::DCmd_list(DCmdSource source) { - MutexLockerEx ml(_dcmdFactory_lock, Mutex::_no_safepoint_check_flag); + MutexLockerEx ml(DCmdFactory_lock, Mutex::_no_safepoint_check_flag); GrowableArray* array = new GrowableArray(); DCmdFactory* factory = _DCmdFactoryList; while (factory != NULL) { @@ -550,7 +549,7 @@ } GrowableArray* DCmdFactory::DCmdInfo_list(DCmdSource source ) { - MutexLockerEx ml(_dcmdFactory_lock, Mutex::_no_safepoint_check_flag); + MutexLockerEx ml(DCmdFactory_lock, Mutex::_no_safepoint_check_flag); GrowableArray* array = new GrowableArray(); DCmdFactory* factory = _DCmdFactoryList; while (factory != NULL) { --- old/src/hotspot/share/services/diagnosticFramework.hpp 2018-11-05 20:46:49.963076599 -0500 +++ new/src/hotspot/share/services/diagnosticFramework.hpp 2018-11-05 20:46:48.382986468 -0500 @@ -344,7 +344,6 @@ // management.cpp) class DCmdFactory: public CHeapObj { private: - static Mutex* _dcmdFactory_lock; static bool _send_jmx_notification; static bool _has_pending_jmx_notification; static DCmdFactory* _DCmdFactoryList; --- old/src/hotspot/share/utilities/decoder.cpp 2018-11-05 20:46:54.871356575 -0500 +++ new/src/hotspot/share/utilities/decoder.cpp 2018-11-05 20:46:53.299266901 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,14 +41,9 @@ AbstractDecoder* Decoder::_shared_decoder = NULL; AbstractDecoder* Decoder::_error_handler_decoder = NULL; NullDecoder Decoder::_do_nothing_decoder; -Mutex* Decoder::_shared_decoder_lock = new Mutex(Mutex::native, - "SharedDecoderLock", - false, - Monitor::_safepoint_check_never); AbstractDecoder* Decoder::get_shared_instance() { - assert(_shared_decoder_lock != NULL && _shared_decoder_lock->owned_by_self(), - "Require DecoderLock to enter"); + assert(shared_decoder_lock()->owned_by_self(), "Require DecoderLock to enter"); if (_shared_decoder == NULL) { _shared_decoder = create_decoder(); @@ -89,21 +84,22 @@ DecoderLocker::DecoderLocker() : MutexLockerEx(DecoderLocker::is_first_error_thread() ? - NULL : Decoder::shared_decoder_lock(), true) { + NULL : Decoder::shared_decoder_lock(), + Mutex::_no_safepoint_check_flag) { _decoder = is_first_error_thread() ? Decoder::get_error_handler_instance() : Decoder::get_shared_instance(); assert(_decoder != NULL, "null decoder"); } Mutex* Decoder::shared_decoder_lock() { - assert(_shared_decoder_lock != NULL, "Just check"); - return _shared_decoder_lock; + assert(Decoder_shared_decoder_lock != NULL, "Just check"); + return Decoder_shared_decoder_lock; } bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const char* modulepath, bool demangle) { - assert(_shared_decoder_lock != NULL, "Just check"); bool error_handling_thread = os::current_thread_id() == VMError::first_error_tid; - MutexLockerEx locker(error_handling_thread ? NULL : _shared_decoder_lock, true); + MutexLockerEx locker(error_handling_thread ? NULL : shared_decoder_lock(), + Mutex::_no_safepoint_check_flag); AbstractDecoder* decoder = error_handling_thread ? get_error_handler_instance(): get_shared_instance(); assert(decoder != NULL, "null decoder"); @@ -112,9 +108,9 @@ } bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const void* base) { - assert(_shared_decoder_lock != NULL, "Just check"); bool error_handling_thread = os::current_thread_id() == VMError::first_error_tid; - MutexLockerEx locker(error_handling_thread ? NULL : _shared_decoder_lock, true); + MutexLockerEx locker(error_handling_thread ? NULL : shared_decoder_lock(), + Mutex::_no_safepoint_check_flag); AbstractDecoder* decoder = error_handling_thread ? get_error_handler_instance(): get_shared_instance(); assert(decoder != NULL, "null decoder"); @@ -124,9 +120,9 @@ bool Decoder::demangle(const char* symbol, char* buf, int buflen) { - assert(_shared_decoder_lock != NULL, "Just check"); bool error_handling_thread = os::current_thread_id() == VMError::first_error_tid; - MutexLockerEx locker(error_handling_thread ? NULL : _shared_decoder_lock, true); + MutexLockerEx locker(error_handling_thread ? NULL : shared_decoder_lock(), + Mutex::_no_safepoint_check_flag); AbstractDecoder* decoder = error_handling_thread ? get_error_handler_instance(): get_shared_instance(); assert(decoder != NULL, "null decoder"); --- old/src/hotspot/share/utilities/decoder.hpp 2018-11-05 20:46:59.799637693 -0500 +++ new/src/hotspot/share/utilities/decoder.hpp 2018-11-05 20:46:58.223547790 -0500 @@ -131,7 +131,6 @@ static NullDecoder _do_nothing_decoder; protected: - static Mutex* _shared_decoder_lock; static Mutex* shared_decoder_lock(); friend class DecoderLocker;