changeset 54623:1126f0607c70

8222811: Consolidate MutexLockerEx and MutexLocker Summary: Make MutexLocker be MutexLockerEx implementation, remove MutexLockerEx calls. Reviewed-by: dcubed, dholmes, pliden, rehn
author coleenp
date Thu, 25 Apr 2019 10:56:31 -0400
parents a8dcacf95bff
children beaea3c10b0f
files src/hotspot/os/bsd/os_bsd.cpp src/hotspot/os/linux/os_linux.cpp src/hotspot/share/aot/aotCompiledMethod.cpp src/hotspot/share/aot/aotLoader.cpp src/hotspot/share/c1/c1_Runtime1.cpp src/hotspot/share/classfile/classLoaderData.cpp src/hotspot/share/classfile/dictionary.cpp src/hotspot/share/classfile/packageEntry.cpp src/hotspot/share/classfile/protectionDomainCache.cpp src/hotspot/share/classfile/stringTable.cpp src/hotspot/share/classfile/symbolTable.cpp src/hotspot/share/classfile/systemDictionary.cpp src/hotspot/share/code/codeBlob.cpp src/hotspot/share/code/codeCache.cpp src/hotspot/share/code/icBuffer.cpp src/hotspot/share/code/nmethod.cpp src/hotspot/share/code/stubs.cpp src/hotspot/share/code/vtableStubs.cpp src/hotspot/share/compiler/compileBroker.cpp src/hotspot/share/compiler/compilerDirectives.cpp src/hotspot/share/compiler/oopMap.cpp src/hotspot/share/gc/cms/cmsVMOperations.cpp src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.hpp src/hotspot/share/gc/cms/concurrentMarkSweepThread.cpp src/hotspot/share/gc/cms/yieldingWorkgroup.cpp src/hotspot/share/gc/epsilon/epsilonHeap.cpp src/hotspot/share/gc/g1/g1Allocator.cpp src/hotspot/share/gc/g1/g1CollectedHeap.cpp src/hotspot/share/gc/g1/g1ConcurrentMark.cpp src/hotspot/share/gc/g1/g1ConcurrentMarkThread.cpp src/hotspot/share/gc/g1/g1ConcurrentRefineThread.cpp src/hotspot/share/gc/g1/g1FullGCOopClosures.cpp src/hotspot/share/gc/g1/g1MonitoringSupport.cpp src/hotspot/share/gc/g1/g1RootProcessor.cpp src/hotspot/share/gc/g1/g1SharedDirtyCardQueue.cpp src/hotspot/share/gc/g1/g1StringDedupQueue.cpp src/hotspot/share/gc/g1/g1VMOperations.cpp src/hotspot/share/gc/g1/g1YoungRemSetSamplingThread.cpp src/hotspot/share/gc/g1/heapRegion.cpp src/hotspot/share/gc/g1/heapRegionRemSet.cpp src/hotspot/share/gc/g1/heapRegionRemSet.hpp src/hotspot/share/gc/parallel/gcTaskManager.cpp src/hotspot/share/gc/shared/collectedHeap.cpp src/hotspot/share/gc/shared/concurrentGCPhaseManager.cpp src/hotspot/share/gc/shared/concurrentGCThread.cpp src/hotspot/share/gc/shared/genCollectedHeap.cpp src/hotspot/share/gc/shared/oopStorage.cpp src/hotspot/share/gc/shared/owstTaskTerminator.cpp src/hotspot/share/gc/shared/ptrQueue.cpp src/hotspot/share/gc/shared/satbMarkQueue.cpp src/hotspot/share/gc/shared/stringdedup/stringDedupTable.cpp src/hotspot/share/gc/shared/stringdedup/stringDedupTable.hpp src/hotspot/share/gc/shared/suspendibleThreadSet.cpp src/hotspot/share/gc/shared/workgroup.cpp src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp src/hotspot/share/gc/shenandoah/shenandoahStrDedupQueue.cpp src/hotspot/share/gc/z/zMessagePort.inline.hpp src/hotspot/share/gc/z/zMetronome.cpp src/hotspot/share/gc/z/zNMethodTable.cpp src/hotspot/share/gc/z/zReferenceProcessor.cpp src/hotspot/share/gc/z/zRuntimeWorkers.cpp src/hotspot/share/gc/z/zUnload.cpp src/hotspot/share/gc/z/zWorkers.cpp src/hotspot/share/jfr/periodic/jfrPeriodic.cpp src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeManager.cpp src/hotspot/share/jfr/recorder/repository/jfrEmergencyDump.cpp src/hotspot/share/jfr/recorder/repository/jfrRepository.cpp src/hotspot/share/jfr/recorder/service/jfrPostBox.cpp src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp src/hotspot/share/jfr/recorder/service/jfrRecorderThreadLoop.cpp src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp src/hotspot/share/jfr/recorder/storage/jfrStorage.cpp src/hotspot/share/jvmci/jvmciCompilerToVM.cpp src/hotspot/share/memory/metaspace.cpp src/hotspot/share/memory/metaspace/chunkManager.cpp src/hotspot/share/memory/metaspace/spaceManager.cpp src/hotspot/share/memory/metaspace/virtualSpaceList.cpp src/hotspot/share/memory/universe.cpp src/hotspot/share/oops/instanceKlass.cpp src/hotspot/share/oops/method.cpp src/hotspot/share/prims/jvm.cpp src/hotspot/share/prims/jvmtiCodeBlobEvents.cpp src/hotspot/share/prims/jvmtiEnv.cpp src/hotspot/share/prims/jvmtiEventController.cpp src/hotspot/share/prims/jvmtiExport.cpp src/hotspot/share/prims/methodHandles.cpp src/hotspot/share/prims/resolvedMethodTable.cpp src/hotspot/share/prims/whitebox.cpp src/hotspot/share/runtime/handshake.cpp src/hotspot/share/runtime/init.cpp src/hotspot/share/runtime/java.cpp src/hotspot/share/runtime/jniHandles.cpp src/hotspot/share/runtime/mutex.cpp src/hotspot/share/runtime/mutex.hpp src/hotspot/share/runtime/mutexLocker.hpp src/hotspot/share/runtime/os.cpp src/hotspot/share/runtime/serviceThread.cpp src/hotspot/share/runtime/sharedRuntime.cpp src/hotspot/share/runtime/sweeper.cpp src/hotspot/share/runtime/task.cpp src/hotspot/share/runtime/thread.cpp src/hotspot/share/runtime/thread.hpp src/hotspot/share/runtime/threadSMR.cpp src/hotspot/share/runtime/threadSMR.inline.hpp src/hotspot/share/runtime/vmOperations.cpp src/hotspot/share/runtime/vmThread.cpp src/hotspot/share/services/diagnosticFramework.cpp src/hotspot/share/services/gcNotifier.cpp src/hotspot/share/services/lowMemoryDetector.cpp src/hotspot/share/services/management.cpp src/hotspot/share/services/memoryManager.cpp src/hotspot/share/services/threadService.cpp src/hotspot/share/utilities/decoder.cpp src/hotspot/share/utilities/decoder.hpp src/hotspot/share/utilities/events.cpp src/hotspot/share/utilities/events.hpp src/hotspot/share/utilities/vmError.cpp test/hotspot/gtest/gc/shared/test_oopStorage.cpp test/hotspot/gtest/memory/test_is_metaspace_obj.cpp test/hotspot/gtest/memory/test_metaspace.cpp test/hotspot/gtest/memory/test_metaspace_allocation.cpp test/hotspot/gtest/runtime/test_threads.cpp test/hotspot/gtest/threadHelper.inline.hpp
diffstat 127 files changed, 718 insertions(+), 746 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/os/bsd/os_bsd.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/os/bsd/os_bsd.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -678,7 +678,7 @@
 
   // handshaking with parent thread
   {
-    MutexLockerEx ml(sync, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(sync, Mutex::_no_safepoint_check_flag);
 
     // notify parent thread
     osthread->set_state(INITIALIZED);
@@ -686,7 +686,7 @@
 
     // wait until os::start_thread()
     while (osthread->get_state() == INITIALIZED) {
-      sync->wait(Mutex::_no_safepoint_check_flag);
+      sync->wait_without_safepoint_check();
     }
   }
 
@@ -766,9 +766,9 @@
     // Wait until child thread is either initialized or aborted
     {
       Monitor* sync_with_child = osthread->startThread_lock();
-      MutexLockerEx ml(sync_with_child, Mutex::_no_safepoint_check_flag);
+      MutexLocker ml(sync_with_child, Mutex::_no_safepoint_check_flag);
       while ((state = osthread->get_state()) == ALLOCATED) {
-        sync_with_child->wait(Mutex::_no_safepoint_check_flag);
+        sync_with_child->wait_without_safepoint_check();
       }
     }
 
@@ -840,7 +840,7 @@
   OSThread * osthread = thread->osthread();
   assert(osthread->get_state() != INITIALIZED, "just checking");
   Monitor* sync_with_child = osthread->startThread_lock();
-  MutexLockerEx ml(sync_with_child, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(sync_with_child, Mutex::_no_safepoint_check_flag);
   sync_with_child->notify();
 }
 
--- a/src/hotspot/os/linux/os_linux.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/os/linux/os_linux.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -773,7 +773,7 @@
 
   // handshaking with parent thread
   {
-    MutexLockerEx ml(sync, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(sync, Mutex::_no_safepoint_check_flag);
 
     // notify parent thread
     osthread->set_state(INITIALIZED);
@@ -781,7 +781,7 @@
 
     // wait until os::start_thread()
     while (osthread->get_state() == INITIALIZED) {
-      sync->wait(Mutex::_no_safepoint_check_flag);
+      sync->wait_without_safepoint_check();
     }
   }
 
@@ -881,9 +881,9 @@
     // Wait until child thread is either initialized or aborted
     {
       Monitor* sync_with_child = osthread->startThread_lock();
-      MutexLockerEx ml(sync_with_child, Mutex::_no_safepoint_check_flag);
+      MutexLocker ml(sync_with_child, Mutex::_no_safepoint_check_flag);
       while ((state = osthread->get_state()) == ALLOCATED) {
-        sync_with_child->wait(Mutex::_no_safepoint_check_flag);
+        sync_with_child->wait_without_safepoint_check();
       }
     }
   }
@@ -975,7 +975,7 @@
   OSThread * osthread = thread->osthread();
   assert(osthread->get_state() != INITIALIZED, "just checking");
   Monitor* sync_with_child = osthread->startThread_lock();
-  MutexLockerEx ml(sync_with_child, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(sync_with_child, Mutex::_no_safepoint_check_flag);
   sync_with_child->notify();
 }
 
--- a/src/hotspot/share/aot/aotCompiledMethod.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/aot/aotCompiledMethod.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -167,7 +167,7 @@
 
   {
     // Enter critical section.  Does not block for safepoint.
-    MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag);
 
     if (*_state_adr == new_state) {
       // another thread already performed this transition so nothing
@@ -218,7 +218,7 @@
 
   {
     // Enter critical section.  Does not block for safepoint.
-    MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag);
 
     if (*_state_adr == in_use) {
       // another thread already performed this transition so nothing
--- a/src/hotspot/share/aot/aotLoader.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/aot/aotLoader.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -200,7 +200,7 @@
       if ((*lib)->is_valid()) {
         AOTCodeHeap* heap = new AOTCodeHeap(*lib);
         {
-          MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+          MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
           add_heap(heap);
           CodeCache::add_heap(heap);
         }
--- a/src/hotspot/share/c1/c1_Runtime1.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/c1/c1_Runtime1.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1046,7 +1046,7 @@
   // Now copy code back
 
   {
-    MutexLockerEx ml_patch (Patching_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml_patch (Patching_lock, Mutex::_no_safepoint_check_flag);
     //
     // Deoptimization may have happened while we waited for the lock.
     // In that case we don't bother to do any patching we just return
@@ -1265,7 +1265,7 @@
   // If we are patching in a non-perm oop, make sure the nmethod
   // is on the right list.
   {
-    MutexLockerEx ml_code (CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml_code (CodeCache_lock, Mutex::_no_safepoint_check_flag);
     nmethod* nm = CodeCache::find_nmethod(caller_frame.pc());
     guarantee(nm != NULL, "only nmethods can contain non-perm oops");
 
--- a/src/hotspot/share/classfile/classLoaderData.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/classfile/classLoaderData.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -449,7 +449,7 @@
 
 void ClassLoaderData::add_class(Klass* k, bool publicize /* true */) {
   {
-    MutexLockerEx ml(metaspace_lock(), Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(metaspace_lock(), Mutex::_no_safepoint_check_flag);
     Klass* old_value = _klasses;
     k->set_next_link(old_value);
     // Link the new item into the list, making sure the linked class is stable
@@ -549,7 +549,7 @@
       modules = new ModuleEntryTable(ModuleEntryTable::_moduletable_entry_size);
 
       {
-        MutexLockerEx m1(metaspace_lock(), Mutex::_no_safepoint_check_flag);
+        MutexLocker m1(metaspace_lock(), Mutex::_no_safepoint_check_flag);
         // Ensure _modules is stable, since it is examined without a lock
         OrderAccess::release_store(&_modules, modules);
       }
@@ -743,7 +743,7 @@
   // Lock-free access requires load_acquire.
   ClassLoaderMetaspace* metaspace = OrderAccess::load_acquire(&_metaspace);
   if (metaspace == NULL) {
-    MutexLockerEx ml(_metaspace_lock,  Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(_metaspace_lock,  Mutex::_no_safepoint_check_flag);
     // Check if _metaspace got allocated while we were waiting for this lock.
     if ((metaspace = _metaspace) == NULL) {
       if (this == the_null_class_loader_data()) {
@@ -764,7 +764,7 @@
 }
 
 OopHandle ClassLoaderData::add_handle(Handle h) {
-  MutexLockerEx ml(metaspace_lock(),  Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(metaspace_lock(),  Mutex::_no_safepoint_check_flag);
   record_modified_oops();
   return OopHandle(_handles.add(h()));
 }
@@ -779,7 +779,7 @@
 }
 
 void ClassLoaderData::init_handle_locked(OopHandle& dest, Handle h) {
-  MutexLockerEx ml(metaspace_lock(),  Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(metaspace_lock(),  Mutex::_no_safepoint_check_flag);
   if (dest.resolve() != NULL) {
     return;
   } else {
@@ -792,7 +792,7 @@
 void ClassLoaderData::add_to_deallocate_list(Metadata* m) {
   // Metadata in shared region isn't deleted.
   if (!m->is_shared()) {
-    MutexLockerEx ml(metaspace_lock(),  Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(metaspace_lock(),  Mutex::_no_safepoint_check_flag);
     if (_deallocate_list == NULL) {
       _deallocate_list = new (ResourceObj::C_HEAP, mtClass) GrowableArray<Metadata*>(100, true);
     }
--- a/src/hotspot/share/classfile/dictionary.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/classfile/dictionary.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -151,7 +151,7 @@
 bool DictionaryEntry::contains_protection_domain(oop protection_domain) const {
   // Lock the pd_set list.  This lock cannot safepoint since the caller holds
   // a Dictionary entry, which can be moved if the Dictionary is resized.
-  MutexLockerEx ml(ProtectionDomainSet_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(ProtectionDomainSet_lock, Mutex::_no_safepoint_check_flag);
 #ifdef ASSERT
   if (oopDesc::equals(protection_domain, instance_klass()->protection_domain())) {
     // Ensure this doesn't show up in the pd_set (invariant)
@@ -191,7 +191,7 @@
     ProtectionDomainCacheEntry* entry = SystemDictionary::cache_get(protection_domain);
     // The pd_set in the dictionary entry is protected by a low level lock.
     // With concurrent PD table cleanup, these links could be broken.
-    MutexLockerEx ml(ProtectionDomainSet_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(ProtectionDomainSet_lock, Mutex::_no_safepoint_check_flag);
     ProtectionDomainEntry* new_head =
                 new ProtectionDomainEntry(entry, pd_set());
     set_pd_set(new_head);
@@ -369,7 +369,7 @@
                           probe = probe->next()) {
       Klass* e = probe->instance_klass();
 
-      MutexLockerEx ml(ProtectionDomainSet_lock, Mutex::_no_safepoint_check_flag);
+      MutexLocker ml(ProtectionDomainSet_lock, Mutex::_no_safepoint_check_flag);
       ProtectionDomainEntry* current = probe->pd_set();
       ProtectionDomainEntry* prev = NULL;
       while (current != NULL) {
@@ -460,7 +460,7 @@
 }
 
 void DictionaryEntry::verify_protection_domain_set() {
-  MutexLockerEx ml(ProtectionDomainSet_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(ProtectionDomainSet_lock, Mutex::_no_safepoint_check_flag);
   for (ProtectionDomainEntry* current = pd_set(); // accessed at a safepoint
                               current != NULL;
                               current = current->_next) {
@@ -469,7 +469,7 @@
 }
 
 void DictionaryEntry::print_count(outputStream *st) {
-  MutexLockerEx ml(ProtectionDomainSet_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(ProtectionDomainSet_lock, Mutex::_no_safepoint_check_flag);
   int count = 0;
   for (ProtectionDomainEntry* current = pd_set();  // accessed inside SD lock
                               current != NULL;
--- a/src/hotspot/share/classfile/packageEntry.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/classfile/packageEntry.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -245,7 +245,7 @@
 
 PackageEntry* PackageEntryTable::lookup_only(Symbol* name) {
   assert(!Module_lock->owned_by_self(), "should not have the Module_lock - use locked_lookup_only");
-  MutexLockerEx ml(Module_lock);
+  MutexLocker ml(Module_lock);
   return locked_lookup_only(name);
 }
 
--- a/src/hotspot/share/classfile/protectionDomainCache.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/classfile/protectionDomainCache.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -51,7 +51,7 @@
 }
 
 void ProtectionDomainCacheTable::trigger_cleanup() {
-  MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
   _dead_entries = true;
   Service_lock->notify_all();
 }
--- a/src/hotspot/share/classfile/stringTable.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/classfile/stringTable.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -242,7 +242,7 @@
 }
 
 void StringTable::trigger_concurrent_work() {
-  MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
   the_table()->_has_work = true;
   Service_lock->notify_all();
 }
--- a/src/hotspot/share/classfile/symbolTable.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/classfile/symbolTable.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -150,7 +150,7 @@
 
 void SymbolTable::delete_symbol(Symbol* sym) {
   if (sym->refcount() == PERM_REFCOUNT) {
-    MutexLockerEx ml(SymbolArena_lock, Mutex::_no_safepoint_check_flag); // Protect arena
+    MutexLocker ml(SymbolArena_lock, Mutex::_no_safepoint_check_flag); // Protect arena
     // Deleting permanent symbol should not occur very often (insert race condition),
     // so log it.
     log_trace_symboltable_helper(sym, "Freeing permanent symbol");
@@ -190,7 +190,7 @@
 }
 
 void SymbolTable::trigger_cleanup() {
-  MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
   SymbolTable::the_table()->_has_work = true;
   Service_lock->notify_all();
 }
@@ -208,7 +208,7 @@
     assert(sym != NULL, "new should call vm_exit_out_of_memory if C_HEAP is exhausted");
   } else {
     // Allocate to global arena
-    MutexLockerEx ml(SymbolArena_lock, Mutex::_no_safepoint_check_flag); // Protect arena
+    MutexLocker ml(SymbolArena_lock, Mutex::_no_safepoint_check_flag); // Protect arena
     sym = new (len, arena(), THREAD) Symbol((const u1*)name, len, PERM_REFCOUNT);
   }
   return sym;
--- a/src/hotspot/share/classfile/systemDictionary.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/classfile/systemDictionary.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1824,10 +1824,10 @@
     // First, mark for unload all ClassLoaderData referencing a dead class loader.
     unloading_occurred = ClassLoaderDataGraph::do_unloading();
     if (unloading_occurred) {
-      MutexLockerEx ml2(is_concurrent ? Module_lock : NULL);
+      MutexLocker ml2(is_concurrent ? Module_lock : NULL);
       JFR_ONLY(Jfr::on_unloading_classes();)
 
-      MutexLockerEx ml1(is_concurrent ? SystemDictionary_lock : NULL);
+      MutexLocker ml1(is_concurrent ? SystemDictionary_lock : NULL);
       ClassLoaderDataGraph::clean_module_and_package_info();
       constraints()->purge_loader_constraints();
       resolution_errors()->purge_resolution_errors();
--- a/src/hotspot/share/code/codeBlob.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/code/codeBlob.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, 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
@@ -227,7 +227,7 @@
   size += align_up(buffer_size, oopSize);
   assert(name != NULL, "must provide a name");
   {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     blob = new (size) BufferBlob(name, size);
   }
   // Track memory usage statistic after releasing CodeCache_lock
@@ -248,7 +248,7 @@
   unsigned int size = CodeBlob::allocation_size(cb, sizeof(BufferBlob));
   assert(name != NULL, "must provide a name");
   {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     blob = new (size) BufferBlob(name, size, cb);
   }
   // Track memory usage statistic after releasing CodeCache_lock
@@ -265,7 +265,7 @@
   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   blob->flush();
   {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     CodeCache::free((RuntimeBlob*)blob);
   }
   // Track memory usage statistic after releasing CodeCache_lock
@@ -287,7 +287,7 @@
   AdapterBlob* blob = NULL;
   unsigned int size = CodeBlob::allocation_size(cb, sizeof(AdapterBlob));
   {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     blob = new (size) AdapterBlob(size, cb);
   }
   // Track memory usage statistic after releasing CodeCache_lock
@@ -310,7 +310,7 @@
   size += align_up(buffer_size, oopSize);
   assert(name != NULL, "must provide a name");
   {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     blob = new (size) VtableBlob(name, size);
   }
   // Track memory usage statistic after releasing CodeCache_lock
@@ -331,7 +331,7 @@
   size = CodeBlob::align_code_offset(size);
   size += align_up(buffer_size, oopSize);
   {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     blob = new (size) MethodHandlesAdapterBlob(size);
     if (blob == NULL) {
       vm_exit_out_of_memory(size, OOM_MALLOC_ERROR, "CodeCache: no room for method handle adapter blob");
@@ -369,7 +369,7 @@
   RuntimeStub* stub = NULL;
   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     unsigned int size = CodeBlob::allocation_size(cb, sizeof(RuntimeStub));
     stub = new (size) RuntimeStub(stub_name, cb, size, frame_complete, frame_size, oop_maps, caller_must_gc_arguments);
   }
@@ -428,7 +428,7 @@
   DeoptimizationBlob* blob = NULL;
   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     unsigned int size = CodeBlob::allocation_size(cb, sizeof(DeoptimizationBlob));
     blob = new (size) DeoptimizationBlob(cb,
                                          size,
@@ -467,7 +467,7 @@
   UncommonTrapBlob* blob = NULL;
   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     unsigned int size = CodeBlob::allocation_size(cb, sizeof(UncommonTrapBlob));
     blob = new (size) UncommonTrapBlob(cb, size, oop_maps, frame_size);
   }
@@ -503,7 +503,7 @@
   ExceptionBlob* blob = NULL;
   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     unsigned int size = CodeBlob::allocation_size(cb, sizeof(ExceptionBlob));
     blob = new (size) ExceptionBlob(cb, size, oop_maps, frame_size);
   }
@@ -538,7 +538,7 @@
   SafepointBlob* blob = NULL;
   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     unsigned int size = CodeBlob::allocation_size(cb, sizeof(SafepointBlob));
     blob = new (size) SafepointBlob(cb, size, oop_maps, frame_size);
   }
--- a/src/hotspot/share/code/codeCache.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/code/codeCache.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -531,7 +531,7 @@
           return allocate(size, type, orig_code_blob_type);
         }
       }
-      MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+      MutexUnlocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
       CompileBroker::handle_full_code_cache(orig_code_blob_type);
       return NULL;
     }
@@ -792,7 +792,7 @@
 }
 
 void CodeCache::verify_oops() {
-  MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   VerifyOopClosure voc;
   NMethodIterator iter(NMethodIterator::only_alive_and_not_unloading);
   while(iter.next()) {
@@ -989,7 +989,7 @@
 NOT_PRODUCT(static elapsedTimer dependentCheckTime;)
 
 int CodeCache::mark_for_deoptimization(KlassDepChange& changes) {
-  MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   int number_of_marked_CodeBlobs = 0;
 
   // search the hierarchy looking for nmethods which are affected by the loading of this class
@@ -1154,7 +1154,7 @@
 
 // Deoptimize all methods
 void CodeCache::mark_all_nmethods_for_deoptimization() {
-  MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
   while(iter.next()) {
     CompiledMethod* nm = iter.method();
@@ -1165,7 +1165,7 @@
 }
 
 int CodeCache::mark_for_deoptimization(Method* dependee) {
-  MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   int number_of_marked_CodeBlobs = 0;
 
   CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
@@ -1289,7 +1289,7 @@
     stringStream s;
     // Dump code cache into a buffer before locking the tty.
     {
-      MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+      MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
       print_summary(&s);
     }
     {
@@ -1557,7 +1557,7 @@
 }
 
 void CodeCache::print_codelist(outputStream* st) {
-  MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 
   CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
   while (iter.next()) {
@@ -1572,7 +1572,7 @@
 }
 
 void CodeCache::print_layout(outputStream* st) {
-  MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   ResourceMark rm;
   print_summary(st, true);
 }
--- a/src/hotspot/share/code/icBuffer.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/code/icBuffer.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -258,7 +258,7 @@
 // not safe to free them until them since they might be visible to
 // another thread.
 void InlineCacheBuffer::queue_for_release(CompiledICHolder* icholder) {
-  MutexLockerEx mex(InlineCacheBuffer_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker mex(InlineCacheBuffer_lock, Mutex::_no_safepoint_check_flag);
   icholder->set_next(_pending_released);
   _pending_released = icholder;
   _pending_count++;
--- a/src/hotspot/share/code/nmethod.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/code/nmethod.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -446,7 +446,7 @@
   // create nmethod
   nmethod* nm = NULL;
   {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     int native_nmethod_size = CodeBlob::allocation_size(code_buffer, sizeof(nmethod));
     CodeOffsets offsets;
     offsets.set_value(CodeOffsets::Verified_Entry, vep_offset);
@@ -492,7 +492,7 @@
   code_buffer->finalize_oop_references(method);
   // create nmethod
   nmethod* nm = NULL;
-  { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+  { MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     int nmethod_size =
       CodeBlob::allocation_size(code_buffer, sizeof(nmethod))
       + adjust_pcs_size(debug_info->pcs_size())
@@ -1103,7 +1103,7 @@
 
   // Unregister must be done before the state change
   {
-    MutexLockerEx ml(SafepointSynchronize::is_at_safepoint() ? NULL : CodeCache_lock,
+    MutexLocker ml(SafepointSynchronize::is_at_safepoint() ? NULL : CodeCache_lock,
                      Mutex::_no_safepoint_check_flag);
     Universe::heap()->unregister_nmethod(this);
     CodeCache::unregister_old_nmethod(this);
@@ -1222,7 +1222,7 @@
     }
 
     // Enter critical section.  Does not block for safepoint.
-    MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag);
 
     if (_state == state) {
       // another thread already performed this transition so nothing
@@ -1289,7 +1289,7 @@
       // Flushing dependencies must be done before any possible
       // safepoint can sneak in, otherwise the oops used by the
       // dependency logic could have become stale.
-      MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+      MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
       if (nmethod_needs_unregister) {
         Universe::heap()->unregister_nmethod(this);
         CodeCache::unregister_old_nmethod(this);
@@ -1334,7 +1334,7 @@
 }
 
 void nmethod::flush() {
-  MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   // Note that there are no valid oops in the nmethod anymore.
   assert(!is_osr_method() || is_unloaded() || is_zombie(),
          "osr nmethod must be unloaded or zombie before flushing");
@@ -1452,7 +1452,7 @@
 
   if (JvmtiExport::should_post_compiled_method_load()) {
     // Let the Service thread (which is a real Java thread) post the event
-    MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
     JvmtiDeferredEventQueue::enqueue(
       JvmtiDeferredEvent::compiled_method_load_event(this));
   }
@@ -1490,7 +1490,7 @@
     JvmtiDeferredEvent event =
       JvmtiDeferredEvent::compiled_method_unload_event(this,
           _jmethod_id, insts_begin());
-    MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
     JvmtiDeferredEventQueue::enqueue(event);
   }
 
@@ -2922,7 +2922,7 @@
   nmethodLocker nml(nm);
 #ifdef ASSERT
   {
-    MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag);
     // This relationship can only be checked safely under a lock
     assert(!nm->is_alive() || nm->is_unloading() || nm->jvmci_installed_code() == installedCode(), "sanity check");
   }
@@ -2939,7 +2939,7 @@
   // Multiple threads could reach this point so we now need to
   // lock and re-check the link to the nmethod so that only one
   // thread clears it.
-  MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag);
   if (InstalledCode::address(installedCode) == nativeMethod) {
       InstalledCode::set_address(installedCode, 0);
   }
--- a/src/hotspot/share/code/stubs.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/code/stubs.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -207,7 +207,7 @@
 void StubQueue::verify() {
   // verify only if initialized
   if (_stub_buffer == NULL) return;
-  MutexLockerEx lock(_mutex, Mutex::_no_safepoint_check_flag);
+  MutexLocker lock(_mutex, Mutex::_no_safepoint_check_flag);
   // verify index boundaries
   guarantee(0 <= _buffer_size, "buffer size must be positive");
   guarantee(0 <= _buffer_limit && _buffer_limit <= _buffer_size , "_buffer_limit out of bounds");
@@ -234,7 +234,7 @@
 
 
 void StubQueue::print() {
-  MutexLockerEx lock(_mutex, Mutex::_no_safepoint_check_flag);
+  MutexLocker lock(_mutex, Mutex::_no_safepoint_check_flag);
   for (Stub* s = first(); s != NULL; s = next(s)) {
     stub_print(s);
   }
--- a/src/hotspot/share/code/vtableStubs.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/code/vtableStubs.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -125,7 +125,7 @@
 void VtableStubs::initialize() {
   VtableStub::_receiver_location = SharedRuntime::name_for_receiver();
   {
-    MutexLockerEx ml(VtableStubs_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(VtableStubs_lock, Mutex::_no_safepoint_check_flag);
     assert(_number_of_vtable_stubs == 0, "potential performance bug: VtableStubs initialized more than once");
     assert(is_power_of_2(N), "N must be a power of 2");
     for (int i = 0; i < N; i++) {
@@ -211,7 +211,7 @@
 
   VtableStub* s;
   {
-    MutexLockerEx ml(VtableStubs_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(VtableStubs_lock, Mutex::_no_safepoint_check_flag);
     s = ShareVtableStubs ? lookup(is_vtable_stub, vtable_index) : NULL;
     if (s == NULL) {
       if (is_vtable_stub) {
@@ -271,7 +271,7 @@
 }
 
 VtableStub* VtableStubs::entry_point(address pc) {
-  MutexLockerEx ml(VtableStubs_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(VtableStubs_lock, Mutex::_no_safepoint_check_flag);
   VtableStub* stub = (VtableStub*)(pc - VtableStub::entry_offset());
   uint hash = VtableStubs::hash(stub->is_vtable_stub(), stub->index());
   VtableStub* s;
--- a/src/hotspot/share/compiler/compileBroker.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/compiler/compileBroker.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -423,7 +423,7 @@
     // We need a timed wait here, since compiler threads can exit if compilation
     // is disabled forever. We use 5 seconds wait time; the exiting of compiler threads
     // is not critical and we do not want idle compiler threads to wake up too often.
-    MethodCompileQueue_lock->wait(!Mutex::_no_safepoint_check_flag, 5*1000);
+    MethodCompileQueue_lock->wait(5*1000);
 
     if (UseDynamicNumberOfCompilerThreads && _first == NULL) {
       // Still nothing to compile. Give caller a chance to stop this thread.
@@ -1500,7 +1500,7 @@
   int progress_wait_attempts = 0;
   int methods_compiled = jvmci->methods_compiled();
   while (!task->is_complete() && !is_compilation_disabled_forever() &&
-         task->lock()->wait(!Mutex::_no_safepoint_check_flag, JVMCI_COMPILATION_PROGRESS_WAIT_TIMESLICE)) {
+         task->lock()->wait(JVMCI_COMPILATION_PROGRESS_WAIT_TIMESLICE)) {
     CompilerThread* jvmci_compiler_thread = task->jvmci_compiler_thread();
 
     bool progress;
@@ -1644,7 +1644,7 @@
 void CompileBroker::shutdown_compiler_runtime(AbstractCompiler* comp, CompilerThread* thread) {
   // Free buffer blob, if allocated
   if (thread->get_buffer_blob() != NULL) {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     CodeCache::free(thread->get_buffer_blob());
   }
 
@@ -1780,7 +1780,7 @@
           }
           // Free buffer blob, if allocated
           if (thread->get_buffer_blob() != NULL) {
-            MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+            MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
             CodeCache::free(thread->get_buffer_blob());
           }
           return; // Stop this thread.
@@ -1910,7 +1910,7 @@
   stringStream s;
   // Dump code cache  into a buffer before locking the tty,
   {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     CodeCache::print_summary(&s, detailed);
   }
   ttyLocker ttyl;
@@ -1924,7 +1924,7 @@
 
   // Dump code cache into a buffer
   {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     CodeCache::print_summary(&s, detailed);
   }
 
@@ -2112,9 +2112,9 @@
       ci_env.record_method_not_compilable("no compiler", !TieredCompilation);
     } else {
       if (WhiteBoxAPI && WhiteBox::compilation_locked) {
-        MonitorLockerEx locker(Compilation_lock, Mutex::_no_safepoint_check_flag);
+        MonitorLocker locker(Compilation_lock, Mutex::_no_safepoint_check_flag);
         while (WhiteBox::compilation_locked) {
-          locker.wait(Mutex::_no_safepoint_check_flag);
+          locker.wait();
         }
       }
       comp->compile_method(&ci_env, target, osr_bci, directive);
@@ -2678,7 +2678,7 @@
   // CodeHeapStateAnalytics_lock could be held by a concurrent thread for a long time,
   // leading to an unnecessarily long hold time of the CodeCache_lock.
   ts.update(); // record starting point
-  MutexLockerEx mu1(CodeHeapStateAnalytics_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker mu1(CodeHeapStateAnalytics_lock, Mutex::_no_safepoint_check_flag);
   out->print_cr("\n__ CodeHeapStateAnalytics lock wait took %10.3f seconds _________\n", ts.seconds());
 
   // If we serve an "allFun" call, it is beneficial to hold the CodeCache_lock
@@ -2688,7 +2688,7 @@
   Monitor* global_lock   = allFun ? CodeCache_lock : NULL;
   Monitor* function_lock = allFun ? NULL : CodeCache_lock;
   ts_global.update(); // record starting point
-  MutexLockerEx mu2(global_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker mu2(global_lock, Mutex::_no_safepoint_check_flag);
   if (global_lock != NULL) {
     out->print_cr("\n__ CodeCache (global) lock wait took %10.3f seconds _________\n", ts_global.seconds());
     ts_global.update(); // record starting point
@@ -2696,7 +2696,7 @@
 
   if (aggregate) {
     ts.update(); // record starting point
-    MutexLockerEx mu3(function_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu3(function_lock, Mutex::_no_safepoint_check_flag);
     if (function_lock != NULL) {
       out->print_cr("\n__ CodeCache (function) lock wait took %10.3f seconds _________\n", ts.seconds());
     }
@@ -2716,7 +2716,7 @@
   if (methodNames) {
     // print_names() has shown to be sensitive to concurrent CodeHeap modifications.
     // Therefore, request  the CodeCache_lock before calling...
-    MutexLockerEx mu3(function_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu3(function_lock, Mutex::_no_safepoint_check_flag);
     CodeCache::print_names(out);
   }
   if (discard) CodeCache::discard(out);
--- a/src/hotspot/share/compiler/compilerDirectives.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/compiler/compilerDirectives.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, 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
@@ -456,7 +456,7 @@
 }
 
 DirectiveSet* DirectivesStack::getDefaultDirective(AbstractCompiler* comp) {
-  MutexLockerEx locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
 
   assert(_bottom != NULL, "Must never be empty");
   _bottom->inc_refcount();
@@ -464,7 +464,7 @@
 }
 
 void DirectivesStack::push(CompilerDirectives* directive) {
-  MutexLockerEx locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
 
   directive->inc_refcount();
   if (_top == NULL) {
@@ -478,7 +478,7 @@
 }
 
 void DirectivesStack::pop(int count) {
-  MutexLockerEx locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
   assert(count > -1, "No negative values");
   for (int i = 0; i < count; i++) {
     pop_inner();
@@ -508,14 +508,14 @@
 
 void DirectivesStack::clear() {
   // holding the lock during the whole operation ensuring consistent result
-  MutexLockerEx locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
   while (_top->next() != NULL) {
     pop_inner();
   }
 }
 
 void DirectivesStack::print(outputStream* st) {
-  MutexLockerEx locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
   CompilerDirectives* tmp = _top;
   while (tmp != NULL) {
     tmp->print(st);
@@ -526,7 +526,7 @@
 
 void DirectivesStack::release(DirectiveSet* set) {
   assert(set != NULL, "Never NULL");
-  MutexLockerEx locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
   if (set->is_exclusive_copy()) {
     // Old CompilecCmmands forced us to create an exclusive copy
     delete set;
@@ -550,7 +550,7 @@
 
   DirectiveSet* match = NULL;
   {
-    MutexLockerEx locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
 
     CompilerDirectives* dir = _top;
     assert(dir != NULL, "Must be initialized");
--- a/src/hotspot/share/compiler/oopMap.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/compiler/oopMap.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, 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
@@ -338,7 +338,7 @@
       // Protect the operation on the derived pointers.  This
       // protects the addition of derived pointers to the shared
       // derived pointer table in DerivedPointerTable::add().
-      MutexLockerEx x(DerivedPointerTableGC_lock, Mutex::_no_safepoint_check_flag);
+      MutexLocker x(DerivedPointerTableGC_lock, Mutex::_no_safepoint_check_flag);
       do {
         omv = oms.current();
         oop* loc = fr->oopmapreg_to_location(omv.reg(),reg_map);
--- a/src/hotspot/share/gc/cms/cmsVMOperations.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/cms/cmsVMOperations.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, 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
@@ -45,7 +45,7 @@
     GCTraceTime(Info, gc, phases, verify) tm("Verify Before", _collector->_gc_timer_cm);
     HandleMark hm;
     FreelistLocker x(_collector);
-    MutexLockerEx  y(_collector->bitMapLock(), Mutex::_no_safepoint_check_flag);
+    MutexLocker  y(_collector->bitMapLock(), Mutex::_no_safepoint_check_flag);
     CMSHeap::heap()->prepare_for_verify();
     Universe::verify();
   }
@@ -57,7 +57,7 @@
     GCTraceTime(Info, gc, phases, verify) tm("Verify After", _collector->_gc_timer_cm);
     HandleMark hm;
     FreelistLocker x(_collector);
-    MutexLockerEx  y(_collector->bitMapLock(), Mutex::_no_safepoint_check_flag);
+    MutexLocker  y(_collector->bitMapLock(), Mutex::_no_safepoint_check_flag);
     Universe::verify();
   }
 }
@@ -183,7 +183,7 @@
           && (_gc_count_before == heap->total_collections())),
          "total_collections() should be monotonically increasing");
 
-  MutexLockerEx x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
   assert(_full_gc_count_before <= heap->total_full_collections(), "Error");
   if (heap->total_full_collections() == _full_gc_count_before) {
     // Nudge the CMS thread to start a concurrent collection.
@@ -244,11 +244,11 @@
     // or by the CMS thread, so we do not want to be suspended
     // while holding that lock.
     ThreadToNativeFromVM native(jt);
-    MutexLockerEx ml(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
     // Either a concurrent or a stop-world full gc is sufficient
     // witness to our request.
     while (heap->total_full_collections_completed() <= _full_gc_count_before) {
-      FullGCCount_lock->wait(Mutex::_no_safepoint_check_flag);
+      FullGCCount_lock->wait_without_safepoint_check();
     }
   }
 }
--- a/src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -1340,7 +1340,7 @@
 }
 
 HeapWord* CompactibleFreeListSpace::par_allocate(size_t size) {
-  MutexLockerEx x(freelistLock(), Mutex::_no_safepoint_check_flag);
+  MutexLocker x(freelistLock(), Mutex::_no_safepoint_check_flag);
   return allocate(size);
 }
 
@@ -1524,8 +1524,8 @@
     // If GC is parallel, this might be called by several threads.
     // This should be rare enough that the locking overhead won't affect
     // the sequential code.
-    MutexLockerEx x(parDictionaryAllocLock(),
-                    Mutex::_no_safepoint_check_flag);
+    MutexLocker x(parDictionaryAllocLock(),
+                  Mutex::_no_safepoint_check_flag);
     fc = getChunkFromDictionary(size);
   }
   if (fc != NULL) {
@@ -1868,7 +1868,7 @@
   Mutex* lock = &_parDictionaryAllocLock;
   FreeChunk* ec;
   {
-    MutexLockerEx x(lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker x(lock, Mutex::_no_safepoint_check_flag);
     ec = dictionary()->find_largest_dict();  // get largest block
     if (ec != NULL && ec->end() == (uintptr_t*) chunk) {
       // It's a coterminal block - we can coalesce.
@@ -1885,7 +1885,7 @@
   if (size < SmallForDictionary) {
     lock = _indexedFreeListParLocks[size];
   }
-  MutexLockerEx x(lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(lock, Mutex::_no_safepoint_check_flag);
   addChunkAndRepairOffsetTable((HeapWord*)ec, size, true);
   // record the birth under the lock since the recording involves
   // manipulation of the list on which the chunk lives and
@@ -2682,8 +2682,8 @@
   assert(word_sz == _cfls->adjustObjectSize(word_sz), "Error");
   if (word_sz >=  CompactibleFreeListSpace::IndexSetSize) {
     // This locking manages sync with other large object allocations.
-    MutexLockerEx x(_cfls->parDictionaryAllocLock(),
-                    Mutex::_no_safepoint_check_flag);
+    MutexLocker x(_cfls->parDictionaryAllocLock(),
+                  Mutex::_no_safepoint_check_flag);
     res = _cfls->getChunkFromDictionaryExact(word_sz);
     if (res == NULL) return NULL;
   } else {
@@ -2781,8 +2781,8 @@
       size_t num_retire =  _indexedFreeList[i].count();
       assert(_num_blocks[i] > num_retire, "Should have used at least one");
       {
-        // MutexLockerEx x(_cfls->_indexedFreeListParLocks[i],
-        //                Mutex::_no_safepoint_check_flag);
+        // MutexLocker x(_cfls->_indexedFreeListParLocks[i],
+        //               Mutex::_no_safepoint_check_flag);
 
         // Update globals stats for num_blocks used
         _global_num_blocks[i] += (_num_blocks[i] - num_retire);
@@ -2824,8 +2824,8 @@
       AdaptiveFreeList<FreeChunk> fl_for_cur_sz;  // Empty.
       fl_for_cur_sz.set_size(cur_sz);
       {
-        MutexLockerEx x(_indexedFreeListParLocks[cur_sz],
-                        Mutex::_no_safepoint_check_flag);
+        MutexLocker x(_indexedFreeListParLocks[cur_sz],
+                      Mutex::_no_safepoint_check_flag);
         AdaptiveFreeList<FreeChunk>* gfl = &_indexedFreeList[cur_sz];
         if (gfl->count() != 0) {
           // nn is the number of chunks of size cur_sz that
@@ -2885,8 +2885,8 @@
         }
         // Update birth stats for this block size.
         size_t num = fl->count();
-        MutexLockerEx x(_indexedFreeListParLocks[word_sz],
-                        Mutex::_no_safepoint_check_flag);
+        MutexLocker x(_indexedFreeListParLocks[word_sz],
+                      Mutex::_no_safepoint_check_flag);
         ssize_t births = _indexedFreeList[word_sz].split_births() + num;
         _indexedFreeList[word_sz].set_split_births(births);
         return true;
@@ -2902,8 +2902,8 @@
   FreeChunk* rem_fc = NULL;
   size_t rem;
   {
-    MutexLockerEx x(parDictionaryAllocLock(),
-                    Mutex::_no_safepoint_check_flag);
+    MutexLocker x(parDictionaryAllocLock(),
+                  Mutex::_no_safepoint_check_flag);
     while (n > 0) {
       fc = dictionary()->get_chunk(MAX2(n * word_sz, _dictionary->min_size()));
       if (fc != NULL) {
@@ -2968,8 +2968,8 @@
     }
   }
   if (rem_fc != NULL) {
-    MutexLockerEx x(_indexedFreeListParLocks[rem],
-                    Mutex::_no_safepoint_check_flag);
+    MutexLocker x(_indexedFreeListParLocks[rem],
+                  Mutex::_no_safepoint_check_flag);
     _bt.verify_not_unallocated((HeapWord*)rem_fc, rem_fc->size());
     _indexedFreeList[rem].return_chunk_at_head(rem_fc);
     smallSplitBirth(rem);
@@ -3027,8 +3027,8 @@
   assert((ssize_t)n > 0 && (ssize_t)n == fl->count(), "Incorrect number of blocks");
   {
     // Update the stats for this block size.
-    MutexLockerEx x(_indexedFreeListParLocks[word_sz],
-                    Mutex::_no_safepoint_check_flag);
+    MutexLocker x(_indexedFreeListParLocks[word_sz],
+                  Mutex::_no_safepoint_check_flag);
     const ssize_t births = _indexedFreeList[word_sz].split_births() + n;
     _indexedFreeList[word_sz].set_split_births(births);
     // ssize_t new_surplus = _indexedFreeList[word_sz].surplus() + n;
--- a/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -172,7 +172,7 @@
  private:
   // Note: locks are acquired in textual declaration order
   // and released in the opposite order
-  MutexLockerEx _locker1, _locker2, _locker3;
+  MutexLocker _locker1, _locker2, _locker3;
  public:
   CMSTokenSyncWithLocks(bool is_cms_thread, Mutex* mutex1,
                         Mutex* mutex2 = NULL, Mutex* mutex3 = NULL):
@@ -509,7 +509,7 @@
 
   // Allocate MUT and marking bit map
   {
-    MutexLockerEx x(_markBitMap.lock(), Mutex::_no_safepoint_check_flag);
+    MutexLocker x(_markBitMap.lock(), Mutex::_no_safepoint_check_flag);
     if (!_markBitMap.allocate(_span)) {
       log_warning(gc)("Failed to allocate CMS Bit Map");
       return;
@@ -797,7 +797,7 @@
 
 HeapWord* ConcurrentMarkSweepGeneration::allocate(size_t size, bool tlab) {
   CMSSynchronousYieldRequest yr;
-  MutexLockerEx x(freelistLock(), Mutex::_no_safepoint_check_flag);
+  MutexLocker x(freelistLock(), Mutex::_no_safepoint_check_flag);
   return have_lock_and_allocate(size, tlab);
 }
 
@@ -844,8 +844,8 @@
 void CMSCollector::direct_allocated(HeapWord* start, size_t size) {
   assert(_markBitMap.covers(start, size), "Out of bounds");
   if (_collectorState >= Marking) {
-    MutexLockerEx y(_markBitMap.lock(),
-                    Mutex::_no_safepoint_check_flag);
+    MutexLocker y(_markBitMap.lock(),
+                  Mutex::_no_safepoint_check_flag);
     // [see comments preceding SweepClosure::do_blk() below for details]
     //
     // Can the P-bits be deleted now?  JJJ
@@ -1302,7 +1302,7 @@
   CMSHeap* heap = CMSHeap::heap();
   unsigned int gc_count = heap->total_full_collections();
   if (gc_count == full_gc_count) {
-    MutexLockerEx y(CGC_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker y(CGC_lock, Mutex::_no_safepoint_check_flag);
     _full_gc_requested = true;
     _full_gc_cause = cause;
     CGC_lock->notify();   // nudge CMS thread
@@ -1423,7 +1423,7 @@
   bitMapLock()->unlock();
   releaseFreelistLocks();
   {
-    MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
     if (_foregroundGCShouldWait) {
       // We are going to be waiting for action for the CMS thread;
       // it had better not be gone (for instance at shutdown)!
@@ -1440,7 +1440,7 @@
              "Possible deadlock");
       while (_foregroundGCShouldWait) {
         // wait for notification
-        CGC_lock->wait(Mutex::_no_safepoint_check_flag);
+        CGC_lock->wait_without_safepoint_check();
         // Possibility of delay/starvation here, since CMS token does
         // not know to give priority to VM thread? Actually, i think
         // there wouldn't be any delay/starvation, but the proof of
@@ -1685,7 +1685,7 @@
  public:
   ReleaseForegroundGC(CMSCollector* c) : _c(c) {
     assert(_c->_foregroundGCShouldWait, "Else should not need to call");
-    MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
     // allow a potentially blocked foreground collector to proceed
     _c->_foregroundGCShouldWait = false;
     if (_c->_foregroundGCIsActive) {
@@ -1697,7 +1697,7 @@
 
   ~ReleaseForegroundGC() {
     assert(!_c->_foregroundGCShouldWait, "Usage protocol violation?");
-    MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
     _c->_foregroundGCShouldWait = true;
   }
 };
@@ -1708,10 +1708,9 @@
 
   CMSHeap* heap = CMSHeap::heap();
   {
-    bool safepoint_check = Mutex::_no_safepoint_check_flag;
-    MutexLockerEx hl(Heap_lock, safepoint_check);
+    MutexLocker hl(Heap_lock, Mutex::_no_safepoint_check_flag);
     FreelistLocker fll(this);
-    MutexLockerEx x(CGC_lock, safepoint_check);
+    MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
     if (_foregroundGCIsActive) {
       // The foreground collector is. Skip this
       // background collection.
@@ -1855,7 +1854,7 @@
         // collection was preempted.
         {
           ReleaseForegroundGC x(this);   // unblock FG collection
-          MutexLockerEx       y(Heap_lock, Mutex::_no_safepoint_check_flag);
+          MutexLocker         y(Heap_lock, Mutex::_no_safepoint_check_flag);
           CMSTokenSync        z(true);   // not strictly needed.
           if (_collectorState == Resizing) {
             compute_new_size();
@@ -1898,7 +1897,7 @@
     // Clear _foregroundGCShouldWait and, in the event that the
     // foreground collector is waiting, notify it, before
     // returning.
-    MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
     _foregroundGCShouldWait = false;
     if (_foregroundGCIsActive) {
       CGC_lock->notify();
@@ -1946,7 +1945,7 @@
   // Block the foreground collector until the
   // background collectors decides whether to
   // yield.
-  MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
   _foregroundGCShouldWait = true;
   if (_foregroundGCIsActive) {
     // The background collector yields to the
@@ -1964,7 +1963,7 @@
     log_debug(gc, state)("CMS Thread " INTPTR_FORMAT " waiting at CMS state %d",
                          p2i(Thread::current()), _collectorState);
     while (_foregroundGCIsActive) {
-      CGC_lock->wait(Mutex::_no_safepoint_check_flag);
+      CGC_lock->wait_without_safepoint_check();
     }
     ConcurrentMarkSweepThread::set_CMS_flag(
       ConcurrentMarkSweepThread::CMS_cms_has_token);
@@ -2206,7 +2205,7 @@
                 _markBitMap.isMarked(addr) ? "" : " not");
 
   if (verify_after_remark()) {
-    MutexLockerEx x(verification_mark_bm()->lock(), Mutex::_no_safepoint_check_flag);
+    MutexLocker x(verification_mark_bm()->lock(), Mutex::_no_safepoint_check_flag);
     bool result = verification_mark_bm()->isMarked(addr);
     tty->print_cr("TransitiveMark: Address " PTR_FORMAT " %s marked", p2i(addr),
                   result ? "IS" : "is NOT");
@@ -2266,7 +2265,7 @@
 
 bool CMSCollector::verify_after_remark() {
   GCTraceTime(Info, gc, phases, verify) tm("Verifying CMS Marking.");
-  MutexLockerEx ml(verification_mark_bm()->lock(), Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(verification_mark_bm()->lock(), Mutex::_no_safepoint_check_flag);
   static bool init = false;
 
   assert(SafepointSynchronize::is_at_safepoint(),
@@ -2467,7 +2466,7 @@
   if (freelistLock()->owned_by_self()) {
     Generation::oop_iterate(cl);
   } else {
-    MutexLockerEx x(freelistLock(), Mutex::_no_safepoint_check_flag);
+    MutexLocker x(freelistLock(), Mutex::_no_safepoint_check_flag);
     Generation::oop_iterate(cl);
   }
 }
@@ -2477,7 +2476,7 @@
   if (freelistLock()->owned_by_self()) {
     Generation::object_iterate(cl);
   } else {
-    MutexLockerEx x(freelistLock(), Mutex::_no_safepoint_check_flag);
+    MutexLocker x(freelistLock(), Mutex::_no_safepoint_check_flag);
     Generation::object_iterate(cl);
   }
 }
@@ -2487,7 +2486,7 @@
   if (freelistLock()->owned_by_self()) {
     Generation::safe_object_iterate(cl);
   } else {
-    MutexLockerEx x(freelistLock(), Mutex::_no_safepoint_check_flag);
+    MutexLocker x(freelistLock(), Mutex::_no_safepoint_check_flag);
     Generation::safe_object_iterate(cl);
   }
 }
@@ -2506,7 +2505,7 @@
   if (freelistLock()->owned_by_self()) {
     cmsSpace()->prepare_for_verify();
   } else {
-    MutexLockerEx fll(freelistLock(), Mutex::_no_safepoint_check_flag);
+    MutexLocker fll(freelistLock(), Mutex::_no_safepoint_check_flag);
     cmsSpace()->prepare_for_verify();
   }
 }
@@ -2519,7 +2518,7 @@
   if (freelistLock()->owned_by_self()) {
     cmsSpace()->verify();
   } else {
-    MutexLockerEx fll(freelistLock(), Mutex::_no_safepoint_check_flag);
+    MutexLocker fll(freelistLock(), Mutex::_no_safepoint_check_flag);
     cmsSpace()->verify();
   }
 }
@@ -2629,7 +2628,7 @@
                                                    bool   parallel) {
   CMSSynchronousYieldRequest yr;
   assert(!tlab, "Can't deal with TLAB allocation");
-  MutexLockerEx x(freelistLock(), Mutex::_no_safepoint_check_flag);
+  MutexLocker x(freelistLock(), Mutex::_no_safepoint_check_flag);
   expand_for_gc_cause(word_size*HeapWordSize, MinHeapDeltaBytes, CMSExpansionCause::_satisfy_allocation);
   if (GCExpandToAllocateDelayMillis > 0) {
     os::sleep(Thread::current(), GCExpandToAllocateDelayMillis, false);
@@ -2804,8 +2803,8 @@
   assert(_restart_addr == NULL, "Control point invariant");
   {
     // acquire locks for subsequent manipulations
-    MutexLockerEx x(bitMapLock(),
-                    Mutex::_no_safepoint_check_flag);
+    MutexLocker x(bitMapLock(),
+                  Mutex::_no_safepoint_check_flag);
     checkpointRootsInitialWork();
     // enable ("weak") refs discovery
     rp->enable_discovery();
@@ -3246,8 +3245,8 @@
     return false;
   }
   assert(work_q->size() == 0, "Shouldn't steal");
-  MutexLockerEx ml(ovflw_stk->par_lock(),
-                   Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(ovflw_stk->par_lock(),
+                 Mutex::_no_safepoint_check_flag);
   // Grab up to 1/4 the size of the work queue
   size_t num = MIN2((size_t)(work_q->max_elems() - work_q->size())/4,
                     (size_t)ParGCDesiredObjsFromOverflowList);
@@ -3451,8 +3450,8 @@
 void ParConcMarkingClosure::handle_stack_overflow(HeapWord* lost) {
   // We need to do this under a mutex to prevent other
   // workers from interfering with the work done below.
-  MutexLockerEx ml(_overflow_stack->par_lock(),
-                   Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(_overflow_stack->par_lock(),
+                 Mutex::_no_safepoint_check_flag);
   // Remember the least grey address discarded
   HeapWord* ra = (HeapWord*)_overflow_stack->least_value(lost);
   _collector->lower_restart_addr(ra);
@@ -4169,8 +4168,8 @@
         );
     }
     FreelistLocker x(this);
-    MutexLockerEx y(bitMapLock(),
-                    Mutex::_no_safepoint_check_flag);
+    MutexLocker y(bitMapLock(),
+                  Mutex::_no_safepoint_check_flag);
     checkpointRootsFinalWork();
   }
   verify_work_stacks_empty();
@@ -6725,8 +6724,8 @@
 void ParPushOrMarkClosure::handle_stack_overflow(HeapWord* lost) {
   // We need to do this under a mutex to prevent other
   // workers from interfering with the work done below.
-  MutexLockerEx ml(_overflow_stack->par_lock(),
-                   Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(_overflow_stack->par_lock(),
+                 Mutex::_no_safepoint_check_flag);
   // Remember the least grey address discarded
   HeapWord* ra = (HeapWord*)_overflow_stack->least_value(lost);
   _collector->lower_restart_addr(ra);
@@ -7992,7 +7991,7 @@
 void CMSCollector::par_preserve_mark_if_necessary(oop p) {
   markOop m = p->mark_raw();
   if (m->must_be_preserved(p)) {
-    MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
     // Even though we read the mark word without holding
     // the lock, we are assured that it will not change
     // because we "own" this oop, so no other thread can
--- a/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.hpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.hpp	Thu Apr 25 10:56:31 2019 -0400
@@ -225,13 +225,13 @@
   // "Parallel versions" of some of the above
   oop par_pop() {
     // lock and pop
-    MutexLockerEx x(&_par_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker x(&_par_lock, Mutex::_no_safepoint_check_flag);
     return pop();
   }
 
   bool par_push(oop ptr) {
     // lock and push
-    MutexLockerEx x(&_par_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker x(&_par_lock, Mutex::_no_safepoint_check_flag);
     return push(ptr);
   }
 
--- a/src/hotspot/share/gc/cms/concurrentMarkSweepThread.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/cms/concurrentMarkSweepThread.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -112,7 +112,7 @@
   // Now post a notify on CGC_lock so as to nudge
   // CMS thread(s) that might be slumbering in
   // sleepBeforeNextCycle.
-  MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
   CGC_lock->notify_all();
 }
 
@@ -147,15 +147,14 @@
 void ConcurrentMarkSweepThread::synchronize(bool is_cms_thread) {
   assert(UseConcMarkSweepGC, "just checking");
 
-  MutexLockerEx x(CGC_lock,
-                  Mutex::_no_safepoint_check_flag);
+  MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
   if (!is_cms_thread) {
     assert(Thread::current()->is_VM_thread(), "Not a VM thread");
     CMSSynchronousYieldRequest yr;
     while (CMS_flag_is_set(CMS_cms_has_token)) {
       // indicate that we want to get the token
       set_CMS_flag(CMS_vm_wants_token);
-      CGC_lock->wait(true);
+      CGC_lock->wait_without_safepoint_check();
     }
     // claim the token and proceed
     clear_CMS_flag(CMS_vm_wants_token);
@@ -167,7 +166,7 @@
     // This will need to be modified is there are more CMS threads than one.
     while (CMS_flag_is_set(CMS_vm_has_token | CMS_vm_wants_token)) {
       set_CMS_flag(CMS_cms_wants_token);
-      CGC_lock->wait(true);
+      CGC_lock->wait_without_safepoint_check();
     }
     // claim the token
     clear_CMS_flag(CMS_cms_wants_token);
@@ -178,8 +177,7 @@
 void ConcurrentMarkSweepThread::desynchronize(bool is_cms_thread) {
   assert(UseConcMarkSweepGC, "just checking");
 
-  MutexLockerEx x(CGC_lock,
-                  Mutex::_no_safepoint_check_flag);
+  MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
   if (!is_cms_thread) {
     assert(Thread::current()->is_VM_thread(), "Not a VM thread");
     assert(CMS_flag_is_set(CMS_vm_has_token), "just checking");
@@ -206,13 +204,12 @@
 
 // Wait until any cms_lock event
 void ConcurrentMarkSweepThread::wait_on_cms_lock(long t_millis) {
-  MutexLockerEx x(CGC_lock,
-                  Mutex::_no_safepoint_check_flag);
+  MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
   if (should_terminate() || _collector->_full_gc_requested) {
     return;
   }
   set_CMS_flag(CMS_cms_wants_token);   // to provoke notifies
-  CGC_lock->wait(Mutex::_no_safepoint_check_flag, t_millis);
+  CGC_lock->wait_without_safepoint_check(t_millis);
   clear_CMS_flag(CMS_cms_wants_token);
   assert(!CMS_flag_is_set(CMS_cms_has_token | CMS_cms_wants_token),
          "Should not be set");
@@ -231,7 +228,7 @@
   // Total collections count before waiting loop
   unsigned int before_count;
   {
-    MutexLockerEx hl(Heap_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker hl(Heap_lock, Mutex::_no_safepoint_check_flag);
     before_count = heap->total_collections();
   }
 
@@ -255,14 +252,14 @@
 
     // Wait until the next event or the remaining timeout
     {
-      MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
+      MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
 
       if (should_terminate() || _collector->_full_gc_requested) {
         return;
       }
       set_CMS_flag(CMS_cms_wants_token);   // to provoke notifies
       assert(t_millis == 0 || wait_time_millis > 0, "Sanity");
-      CGC_lock->wait(Mutex::_no_safepoint_check_flag, wait_time_millis);
+      CGC_lock->wait_without_safepoint_check(wait_time_millis);
       clear_CMS_flag(CMS_cms_wants_token);
       assert(!CMS_flag_is_set(CMS_cms_has_token | CMS_cms_wants_token),
              "Should not be set");
@@ -277,7 +274,7 @@
     // Total collections count after the event
     unsigned int after_count;
     {
-      MutexLockerEx hl(Heap_lock, Mutex::_no_safepoint_check_flag);
+      MutexLocker hl(Heap_lock, Mutex::_no_safepoint_check_flag);
       after_count = heap->total_collections();
     }
 
--- a/src/hotspot/share/gc/cms/yieldingWorkgroup.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/cms/yieldingWorkgroup.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, 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
@@ -137,7 +137,7 @@
  */
 /////////////////////
 void YieldingFlexibleWorkGang::start_task(YieldingFlexibleGangTask* new_task) {
-  MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(monitor(), Mutex::_no_safepoint_check_flag);
   assert(task() == NULL, "Gang currently tied to a task");
   assert(new_task != NULL, "Null task");
   // Bind task to gang
@@ -175,7 +175,7 @@
     assert(started_workers() <= active_workers(), "invariant");
     assert(finished_workers() <= active_workers(), "invariant");
     assert(yielded_workers() <= active_workers(), "invariant");
-    monitor()->wait(Mutex::_no_safepoint_check_flag);
+    monitor()->wait_without_safepoint_check();
   }
   switch (yielding_task()->status()) {
     case COMPLETED:
@@ -204,7 +204,7 @@
 void YieldingFlexibleWorkGang::continue_task(
   YieldingFlexibleGangTask* gang_task) {
 
-  MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(monitor(), Mutex::_no_safepoint_check_flag);
   assert(task() != NULL && task() == gang_task, "Incorrect usage");
   assert(_started_workers == _active_workers, "Precondition");
   assert(_yielded_workers > 0 && yielding_task()->status() == YIELDED,
@@ -224,7 +224,7 @@
 
 void YieldingFlexibleWorkGang::yield() {
   assert(task() != NULL, "Inconsistency; should have task binding");
-  MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(monitor(), Mutex::_no_safepoint_check_flag);
   assert(yielded_workers() < active_workers(), "Consistency check");
   if (yielding_task()->status() == ABORTING) {
     // Do not yield; we need to abort as soon as possible
@@ -247,7 +247,7 @@
     switch (yielding_task()->status()) {
       case YIELDING:
       case YIELDED: {
-        monitor()->wait(Mutex::_no_safepoint_check_flag);
+        monitor()->wait_without_safepoint_check();
         break;  // from switch
       }
       case ACTIVE:
@@ -271,7 +271,7 @@
 
 void YieldingFlexibleWorkGang::abort() {
   assert(task() != NULL, "Inconsistency; should have task binding");
-  MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(monitor(), Mutex::_no_safepoint_check_flag);
   assert(yielded_workers() < active_workers(), "Consistency check");
   #ifndef PRODUCT
     switch (yielding_task()->status()) {
@@ -319,7 +319,7 @@
 void YieldingFlexibleGangWorker::loop() {
   int previous_sequence_number = 0;
   Monitor* gang_monitor = yf_gang()->monitor();
-  MutexLockerEx ml(gang_monitor, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(gang_monitor, Mutex::_no_safepoint_check_flag);
   YieldingWorkData data;
   int id;
   while (true) {
@@ -340,7 +340,7 @@
         yf_gang()->internal_note_start();
         // Now, release the gang mutex and do the work.
         {
-          MutexUnlockerEx mul(gang_monitor, Mutex::_no_safepoint_check_flag);
+          MutexUnlocker mul(gang_monitor, Mutex::_no_safepoint_check_flag);
           GCIdMark gc_id_mark(data.task()->gc_id());
           data.task()->work(id);   // This might include yielding
         }
@@ -394,6 +394,6 @@
     // Remember the sequence number
     previous_sequence_number = data.sequence_number();
     // Wait for more work
-    gang_monitor->wait(Mutex::_no_safepoint_check_flag);
+    gang_monitor->wait_without_safepoint_check();
   }
 }
--- a/src/hotspot/share/gc/epsilon/epsilonHeap.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/epsilon/epsilonHeap.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -124,7 +124,7 @@
 
   while (res == NULL) {
     // Allocation failed, attempt expansion, and retry:
-    MutexLockerEx ml(Heap_lock);
+    MutexLocker ml(Heap_lock);
 
     size_t space_left = max_capacity() - capacity();
     size_t want_space = MAX2(size, EpsilonMinHeapExpand);
--- a/src/hotspot/share/gc/g1/g1Allocator.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/g1/g1Allocator.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -196,7 +196,7 @@
                                                                     desired_word_size,
                                                                     actual_word_size);
   if (result == NULL && !survivor_is_full()) {
-    MutexLockerEx x(FreeList_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker x(FreeList_lock, Mutex::_no_safepoint_check_flag);
     result = survivor_gc_alloc_region()->attempt_allocation_locked(min_word_size,
                                                                    desired_word_size,
                                                                    actual_word_size);
@@ -220,7 +220,7 @@
                                                                desired_word_size,
                                                                actual_word_size);
   if (result == NULL && !old_is_full()) {
-    MutexLockerEx x(FreeList_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker x(FreeList_lock, Mutex::_no_safepoint_check_flag);
     result = old_gc_alloc_region()->attempt_allocation_locked(min_word_size,
                                                               desired_word_size,
                                                               actual_word_size);
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -436,7 +436,7 @@
     uint gc_count_before;
 
     {
-      MutexLockerEx x(Heap_lock);
+      MutexLocker x(Heap_lock);
       result = _allocator->attempt_allocation_locked(word_size);
       if (result != NULL) {
         return result;
@@ -575,7 +575,7 @@
   assert(!is_init_completed(), "Expect to be called at JVM init time");
   assert(ranges != NULL, "MemRegion array NULL");
   assert(count != 0, "No MemRegions provided");
-  MutexLockerEx x(Heap_lock);
+  MutexLocker x(Heap_lock);
 
   MemRegion reserved = _hrm->reserved();
   HeapWord* prev_last_addr = NULL;
@@ -685,7 +685,7 @@
   // that contain the address range. The address range actually within the
   // MemRegion will not be modified. That is assumed to have been initialized
   // elsewhere, probably via an mmap of archived heap data.
-  MutexLockerEx x(Heap_lock);
+  MutexLocker x(Heap_lock);
   for (size_t i = 0; i < count; i++) {
     HeapWord* start_address = ranges[i].start();
     HeapWord* last_address = ranges[i].last();
@@ -771,7 +771,7 @@
 
   // For each Memregion, free the G1 regions that constitute it, and
   // notify mark-sweep that the range is no longer to be considered 'archive.'
-  MutexLockerEx x(Heap_lock);
+  MutexLocker x(Heap_lock);
   for (size_t i = 0; i < count; i++) {
     HeapWord* start_address = ranges[i].start();
     HeapWord* last_address = ranges[i].last();
@@ -882,7 +882,7 @@
 
 
     {
-      MutexLockerEx x(Heap_lock);
+      MutexLocker x(Heap_lock);
 
       // Given that humongous objects are not allocated in young
       // regions, we'll first try to do the allocation without doing a
@@ -2066,7 +2066,7 @@
 }
 
 void G1CollectedHeap::increment_old_marking_cycles_completed(bool concurrent) {
-  MonitorLockerEx x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
+  MonitorLocker x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
 
   // We assume that if concurrent == true, then the caller is a
   // concurrent thread that was joined the Suspendible Thread
@@ -2604,7 +2604,7 @@
 }
 
 void G1CollectedHeap::do_concurrent_mark() {
-  MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
   if (!_cm_thread->in_progress()) {
     _cm_thread->set_started();
     CGC_lock->notify();
@@ -3925,7 +3925,7 @@
 void G1CollectedHeap::remove_from_old_sets(const uint old_regions_removed,
                                            const uint humongous_regions_removed) {
   if (old_regions_removed > 0 || humongous_regions_removed > 0) {
-    MutexLockerEx x(OldSets_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker x(OldSets_lock, Mutex::_no_safepoint_check_flag);
     _old_set.bulk_remove(old_regions_removed);
     _humongous_set.bulk_remove(humongous_regions_removed);
   }
@@ -3935,7 +3935,7 @@
 void G1CollectedHeap::prepend_to_freelist(FreeRegionList* list) {
   assert(list != NULL, "list can't be null");
   if (!list->is_empty()) {
-    MutexLockerEx x(FreeList_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker x(FreeList_lock, Mutex::_no_safepoint_check_flag);
     _hrm->insert_list_into_free_list(list);
   }
 }
@@ -4073,7 +4073,7 @@
 
   void do_serial_work() {
     // Need to grab the lock to be allowed to modify the old region list.
-    MutexLockerEx x(OldSets_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker x(OldSets_lock, Mutex::_no_safepoint_check_flag);
     _collection_set->iterate(&_cl);
   }
 
--- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -166,13 +166,13 @@
 }
 
 void G1CMMarkStack::add_chunk_to_chunk_list(TaskQueueEntryChunk* elem) {
-  MutexLockerEx x(MarkStackChunkList_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(MarkStackChunkList_lock, Mutex::_no_safepoint_check_flag);
   add_chunk_to_list(&_chunk_list, elem);
   _chunks_in_chunk_list++;
 }
 
 void G1CMMarkStack::add_chunk_to_free_list(TaskQueueEntryChunk* elem) {
-  MutexLockerEx x(MarkStackFreeList_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(MarkStackFreeList_lock, Mutex::_no_safepoint_check_flag);
   add_chunk_to_list(&_free_list, elem);
 }
 
@@ -185,7 +185,7 @@
 }
 
 G1CMMarkStack::TaskQueueEntryChunk* G1CMMarkStack::remove_chunk_from_chunk_list() {
-  MutexLockerEx x(MarkStackChunkList_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(MarkStackChunkList_lock, Mutex::_no_safepoint_check_flag);
   TaskQueueEntryChunk* result = remove_chunk_from_list(&_chunk_list);
   if (result != NULL) {
     _chunks_in_chunk_list--;
@@ -194,7 +194,7 @@
 }
 
 G1CMMarkStack::TaskQueueEntryChunk* G1CMMarkStack::remove_chunk_from_free_list() {
-  MutexLockerEx x(MarkStackFreeList_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(MarkStackFreeList_lock, Mutex::_no_safepoint_check_flag);
   return remove_chunk_from_list(&_free_list);
 }
 
@@ -311,7 +311,7 @@
 }
 
 void G1CMRootRegions::notify_scan_done() {
-  MutexLockerEx x(RootRegionScan_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(RootRegionScan_lock, Mutex::_no_safepoint_check_flag);
   _scan_in_progress = false;
   RootRegionScan_lock->notify_all();
 }
@@ -338,9 +338,9 @@
   }
 
   {
-    MutexLockerEx x(RootRegionScan_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker x(RootRegionScan_lock, Mutex::_no_safepoint_check_flag);
     while (scan_in_progress()) {
-      RootRegionScan_lock->wait(Mutex::_no_safepoint_check_flag);
+      RootRegionScan_lock->wait_without_safepoint_check();
     }
   }
   return true;
@@ -1288,7 +1288,7 @@
     // Now update the old/humongous region sets
     _g1h->remove_from_old_sets(cl.old_regions_removed(), cl.humongous_regions_removed());
     {
-      MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
+      MutexLocker x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
       _g1h->decrement_summary_bytes(cl.freed_bytes());
 
       _cleanup_list->add_ordered(&local_cleanup_list);
--- a/src/hotspot/share/gc/g1/g1ConcurrentMarkThread.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/g1/g1ConcurrentMarkThread.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -397,7 +397,7 @@
 }
 
 void G1ConcurrentMarkThread::stop_service() {
-  MutexLockerEx ml(CGC_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(CGC_lock, Mutex::_no_safepoint_check_flag);
   CGC_lock->notify_all();
 }
 
@@ -407,9 +407,9 @@
   // below while the world is otherwise stopped.
   assert(!in_progress(), "should have been cleared");
 
-  MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
   while (!started() && !should_terminate()) {
-    CGC_lock->wait(Mutex::_no_safepoint_check_flag);
+    CGC_lock->wait_without_safepoint_check();
   }
 
   if (started()) {
--- a/src/hotspot/share/gc/g1/g1ConcurrentRefineThread.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/g1/g1ConcurrentRefineThread.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -59,9 +59,9 @@
 }
 
 void G1ConcurrentRefineThread::wait_for_completed_buffers() {
-  MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(_monitor, Mutex::_no_safepoint_check_flag);
   while (!should_terminate() && !is_active()) {
-    _monitor->wait(Mutex::_no_safepoint_check_flag);
+    _monitor->wait_without_safepoint_check();
   }
 }
 
@@ -71,7 +71,7 @@
 }
 
 void G1ConcurrentRefineThread::activate() {
-  MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(_monitor, Mutex::_no_safepoint_check_flag);
   if (!is_primary()) {
     set_active(true);
   } else {
@@ -82,7 +82,7 @@
 }
 
 void G1ConcurrentRefineThread::deactivate() {
-  MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(_monitor, Mutex::_no_safepoint_check_flag);
   if (!is_primary()) {
     set_active(false);
   } else {
@@ -140,6 +140,6 @@
 }
 
 void G1ConcurrentRefineThread::stop_service() {
-  MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(_monitor, Mutex::_no_safepoint_check_flag);
   _monitor->notify();
 }
--- a/src/hotspot/share/gc/g1/g1FullGCOopClosures.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/g1/g1FullGCOopClosures.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -62,8 +62,7 @@
     oop obj = CompressedOops::decode_not_null(heap_oop);
     bool failed = false;
     if (!_g1h->is_in(obj) || _g1h->is_obj_dead_cond(obj, _verify_option)) {
-      MutexLockerEx x(ParGCRareEvent_lock,
-          Mutex::_no_safepoint_check_flag);
+      MutexLocker x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
       LogStreamHandle(Error, gc, verify) yy;
       if (!_failures) {
         yy.cr();
--- a/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -203,7 +203,7 @@
 }
 
 MemoryUsage G1MonitoringSupport::memory_usage() {
-  MutexLockerEx x(MonitoringSupport_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(MonitoringSupport_lock, Mutex::_no_safepoint_check_flag);
   return MemoryUsage(InitialHeapSize, _overall_used, _overall_committed, _g1h->max_capacity());
 }
 
@@ -225,7 +225,7 @@
 void G1MonitoringSupport::recalculate_sizes() {
   assert_heap_locked_or_at_safepoint(true);
 
-  MutexLockerEx x(MonitoringSupport_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(MonitoringSupport_lock, Mutex::_no_safepoint_check_flag);
   // Recalculate all the sizes from scratch.
 
   // This never includes used bytes of current allocating heap region.
@@ -317,7 +317,7 @@
 }
 
 MemoryUsage G1MonitoringSupport::eden_space_memory_usage(size_t initial_size, size_t max_size) {
-  MutexLockerEx x(MonitoringSupport_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(MonitoringSupport_lock, Mutex::_no_safepoint_check_flag);
 
   return MemoryUsage(initial_size,
                      _eden_space_used,
@@ -326,7 +326,7 @@
 }
 
 MemoryUsage G1MonitoringSupport::survivor_space_memory_usage(size_t initial_size, size_t max_size) {
-  MutexLockerEx x(MonitoringSupport_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(MonitoringSupport_lock, Mutex::_no_safepoint_check_flag);
 
   return MemoryUsage(initial_size,
                      _survivor_space_used,
@@ -335,7 +335,7 @@
 }
 
 MemoryUsage G1MonitoringSupport::old_gen_memory_usage(size_t initial_size, size_t max_size) {
-  MutexLockerEx x(MonitoringSupport_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(MonitoringSupport_lock, Mutex::_no_safepoint_check_flag);
 
   return MemoryUsage(initial_size,
                      _old_gen_used,
--- a/src/hotspot/share/gc/g1/g1RootProcessor.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/g1/g1RootProcessor.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -50,7 +50,7 @@
   uint new_value = (uint)Atomic::add(1, &_n_workers_discovered_strong_classes);
   if (new_value == n_workers()) {
     // This thread is last. Notify the others.
-    MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag);
+    MonitorLocker ml(&_lock, Mutex::_no_safepoint_check_flag);
     _lock.notify_all();
   }
 }
@@ -59,9 +59,9 @@
   assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading");
 
   if ((uint)_n_workers_discovered_strong_classes != n_workers()) {
-    MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag);
+    MonitorLocker ml(&_lock, Mutex::_no_safepoint_check_flag);
     while ((uint)_n_workers_discovered_strong_classes != n_workers()) {
-      _lock.wait(Mutex::_no_safepoint_check_flag, 0, false);
+      _lock.wait_without_safepoint_check(0);
     }
   }
 }
--- a/src/hotspot/share/gc/g1/g1SharedDirtyCardQueue.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/g1/g1SharedDirtyCardQueue.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -40,7 +40,7 @@
 }
 
 void G1SharedDirtyCardQueue::enqueue(void* card_ptr) {
-  MutexLockerEx ml(Shared_DirtyCardQ_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(Shared_DirtyCardQ_lock, Mutex::_no_safepoint_check_flag);
   if (_index == 0) {
     flush();
     _buffer = _qset->allocate_buffer();
--- a/src/hotspot/share/gc/g1/g1StringDedupQueue.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/g1/g1StringDedupQueue.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -54,14 +54,14 @@
 }
 
 void G1StringDedupQueue::wait_impl() {
-  MonitorLockerEx ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
+  MonitorLocker ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
   while (_empty && !_cancel) {
-    ml.wait(Mutex::_no_safepoint_check_flag);
+    ml.wait();
   }
 }
 
 void G1StringDedupQueue::cancel_wait_impl() {
-  MonitorLockerEx ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
+  MonitorLocker ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
   _cancel = true;
   ml.notify();
 }
@@ -75,7 +75,7 @@
   if (!worker_queue.is_full()) {
     worker_queue.push(java_string);
     if (_empty) {
-      MonitorLockerEx ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
+      MonitorLocker ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
       if (_empty) {
         // Mark non-empty and notify waiter
         _empty = false;
--- a/src/hotspot/share/gc/g1/g1VMOperations.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/g1/g1VMOperations.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -191,10 +191,10 @@
       JavaThread* jt = (JavaThread*)thr;
       ThreadToNativeFromVM native(jt);
 
-      MutexLockerEx x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
+      MutexLocker x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
       while (g1h->old_marking_cycles_completed() <=
                                           _old_marking_cycles_completed_before) {
-        FullGCCount_lock->wait(Mutex::_no_safepoint_check_flag);
+        FullGCCount_lock->wait_without_safepoint_check();
       }
     }
   }
--- a/src/hotspot/share/gc/g1/g1YoungRemSetSamplingThread.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/g1/g1YoungRemSetSamplingThread.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -47,10 +47,10 @@
 }
 
 void G1YoungRemSetSamplingThread::sleep_before_next_cycle() {
-  MutexLockerEx x(&_monitor, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(&_monitor, Mutex::_no_safepoint_check_flag);
   if (!should_terminate()) {
     uintx waitms = G1ConcRefinementServiceIntervalMillis;
-    _monitor.wait(Mutex::_no_safepoint_check_flag, waitms);
+    _monitor.wait_without_safepoint_check(waitms);
   }
 }
 
@@ -124,7 +124,7 @@
 }
 
 void G1YoungRemSetSamplingThread::stop_service() {
-  MutexLockerEx x(&_monitor, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(&_monitor, Mutex::_no_safepoint_check_flag);
   _monitor.notify();
 }
 
--- a/src/hotspot/share/gc/g1/heapRegion.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/g1/heapRegion.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -516,7 +516,7 @@
       oop obj = CompressedOops::decode_not_null(heap_oop);
       bool failed = false;
       if (!_g1h->is_in(obj) || _g1h->is_obj_dead_cond(obj, _vo)) {
-        MutexLockerEx x(ParGCRareEvent_lock,
+        MutexLocker x(ParGCRareEvent_lock,
           Mutex::_no_safepoint_check_flag);
 
         if (!_failures) {
@@ -588,7 +588,7 @@
                 cv_field == dirty :
                 cv_obj == dirty || cv_field == dirty));
         if (is_bad) {
-          MutexLockerEx x(ParGCRareEvent_lock,
+          MutexLocker x(ParGCRareEvent_lock,
             Mutex::_no_safepoint_check_flag);
 
           if (!_failures) {
--- a/src/hotspot/share/gc/g1/heapRegionRemSet.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/g1/heapRegionRemSet.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -361,7 +361,7 @@
   size_t ind = from_hrm_ind & _mod_max_fine_entries_mask;
   PerRegionTable* prt = find_region_table(ind, from_hr);
   if (prt == NULL) {
-    MutexLockerEx x(_m, Mutex::_no_safepoint_check_flag);
+    MutexLocker x(_m, Mutex::_no_safepoint_check_flag);
     // Confirm that it's really not there...
     prt = find_region_table(ind, from_hr);
     if (prt == NULL) {
@@ -577,7 +577,7 @@
 
 bool OtherRegionsTable::contains_reference(OopOrNarrowOopStar from) const {
   // Cast away const in this case.
-  MutexLockerEx x((Mutex*)_m, Mutex::_no_safepoint_check_flag);
+  MutexLocker x((Mutex*)_m, Mutex::_no_safepoint_check_flag);
   return contains_reference_locked(from);
 }
 
@@ -628,7 +628,7 @@
 }
 
 void HeapRegionRemSet::clear(bool only_cardset) {
-  MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(&_m, Mutex::_no_safepoint_check_flag);
   clear_locked(only_cardset);
 }
 
@@ -658,7 +658,7 @@
           BOOL_TO_STR(CodeCache_lock->owned_by_self()), BOOL_TO_STR(SafepointSynchronize::is_at_safepoint()));
   // Optimistic unlocked contains-check
   if (!_code_roots.contains(nm)) {
-    MutexLockerEx ml(&_m, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(&_m, Mutex::_no_safepoint_check_flag);
     add_strong_code_root_locked(nm);
   }
 }
@@ -678,7 +678,7 @@
   assert(nm != NULL, "sanity");
   assert_locked_or_safepoint(CodeCache_lock);
 
-  MutexLockerEx ml(CodeCache_lock->owned_by_self() ? NULL : &_m, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(CodeCache_lock->owned_by_self() ? NULL : &_m, Mutex::_no_safepoint_check_flag);
   _code_roots.remove(nm);
 
   // Check that there were no duplicates
--- a/src/hotspot/share/gc/g1/heapRegionRemSet.hpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/g1/heapRegionRemSet.hpp	Thu Apr 25 10:56:31 2019 -0400
@@ -194,7 +194,7 @@
   }
 
   size_t occupied() {
-    MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag);
+    MutexLocker x(&_m, Mutex::_no_safepoint_check_flag);
     return occupied_locked();
   }
   size_t occupied_locked() {
@@ -274,7 +274,7 @@
   // The actual # of bytes this hr_remset takes up.
   // Note also includes the strong code root set.
   size_t mem_size() {
-    MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag);
+    MutexLocker x(&_m, Mutex::_no_safepoint_check_flag);
     return _other_regions.mem_size()
       // This correction is necessary because the above includes the second
       // part.
--- a/src/hotspot/share/gc/parallel/gcTaskManager.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/parallel/gcTaskManager.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2019, 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
@@ -524,7 +524,7 @@
       // and get the count for additional IdleGCTask's under
       // the GCTaskManager's monitor so that the "more_inactive_workers"
       // count is correct.
-      MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
+      MutexLocker ml(monitor(), Mutex::_no_safepoint_check_flag);
       _wait_helper.set_should_wait(true);
       // active_workers are a number being requested.  idle_workers
       // are the number currently idle.  If all the workers are being
@@ -563,7 +563,7 @@
 
 void  GCTaskManager::release_idle_workers() {
   {
-    MutexLockerEx ml(monitor(),
+    MutexLocker ml(monitor(),
       Mutex::_no_safepoint_check_flag);
     _wait_helper.set_should_wait(false);
     monitor()->notify_all();
@@ -613,7 +613,7 @@
 
 void GCTaskManager::add_task(GCTask* task) {
   assert(task != NULL, "shouldn't have null task");
-  MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(monitor(), Mutex::_no_safepoint_check_flag);
   if (TraceGCTaskManager) {
     tty->print_cr("GCTaskManager::add_task(" INTPTR_FORMAT " [%s])",
                   p2i(task), GCTask::Kind::to_string(task->kind()));
@@ -630,7 +630,7 @@
 
 void GCTaskManager::add_list(GCTaskQueue* list) {
   assert(list != NULL, "shouldn't have null task");
-  MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(monitor(), Mutex::_no_safepoint_check_flag);
   if (TraceGCTaskManager) {
     tty->print_cr("GCTaskManager::add_list(%u)", list->length());
   }
@@ -654,7 +654,7 @@
 GCTask* GCTaskManager::get_task(uint which) {
   GCTask* result = NULL;
   // Grab the queue lock.
-  MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(monitor(), Mutex::_no_safepoint_check_flag);
   // Wait while the queue is block or
   // there is nothing to do, except maybe release resources.
   while (is_blocked() ||
@@ -671,7 +671,7 @@
       tty->print_cr("    => (%s)->wait()",
                     monitor()->name());
     }
-    monitor()->wait(Mutex::_no_safepoint_check_flag, 0);
+    monitor()->wait_without_safepoint_check(0);
   }
   // We've reacquired the queue lock here.
   // Figure out which condition caused us to exit the loop above.
@@ -707,7 +707,7 @@
 }
 
 void GCTaskManager::note_completion(uint which) {
-  MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(monitor(), Mutex::_no_safepoint_check_flag);
   if (TraceGCTaskManager) {
     tty->print_cr("GCTaskManager::note_completion(%u)", which);
   }
@@ -872,7 +872,7 @@
   log_trace(gc, task)("[" INTPTR_FORMAT "] IdleGCTask:::do_it() should_wait: %s",
       p2i(this), wait_helper->should_wait() ? "true" : "false");
 
-  MutexLockerEx ml(manager->monitor(), Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(manager->monitor(), Mutex::_no_safepoint_check_flag);
   log_trace(gc, task)("--- idle %d", which);
   // Increment has to be done when the idle tasks are created.
   // manager->increment_idle_workers();
@@ -880,7 +880,7 @@
   while (wait_helper->should_wait()) {
     log_trace(gc, task)("[" INTPTR_FORMAT "] IdleGCTask::do_it()  [" INTPTR_FORMAT "] (%s)->wait()",
       p2i(this), p2i(manager->monitor()), manager->monitor()->name());
-    manager->monitor()->wait(Mutex::_no_safepoint_check_flag, 0);
+    manager->monitor()->wait_without_safepoint_check(0);
   }
   manager->decrement_idle_workers();
 
@@ -943,7 +943,7 @@
       tty->print_cr("WaitForBarrierGCTask::do_it(%u) waiting on %u workers",
                     which, manager->busy_workers());
     }
-    manager->monitor()->wait(Mutex::_no_safepoint_check_flag, 0);
+    manager->monitor()->wait_without_safepoint_check(0);
   }
 }
 
@@ -955,7 +955,7 @@
   }
   {
     // First, wait for the barrier to arrive.
-    MutexLockerEx ml(manager->lock(), Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(manager->lock(), Mutex::_no_safepoint_check_flag);
     do_it_internal(manager, which);
     // Release manager->lock().
   }
@@ -991,7 +991,7 @@
   }
   {
     // Grab the lock and check again.
-    MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(monitor(), Mutex::_no_safepoint_check_flag);
     while (should_wait()) {
       if (TraceGCTaskManager) {
         tty->print_cr("[" INTPTR_FORMAT "]"
@@ -999,7 +999,7 @@
           "  [" INTPTR_FORMAT "] (%s)->wait()",
           p2i(this), p2i(monitor()), monitor()->name());
       }
-      monitor()->wait(Mutex::_no_safepoint_check_flag, 0);
+      monitor()->wait_without_safepoint_check(0);
     }
     // Reset the flag in case someone reuses this task.
     if (reset) {
@@ -1016,7 +1016,7 @@
 }
 
 void WaitHelper::notify() {
-  MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(monitor(), Mutex::_no_safepoint_check_flag);
   set_should_wait(false);
   // Waiter doesn't miss the notify in the wait_for method
   // since it checks the flag after grabbing the monitor.
@@ -1041,7 +1041,7 @@
                       Mutex::_allow_vm_block_flag);    // allow_vm_block
   }
   {
-    MutexLockerEx ml(lock());
+    MutexLocker ml(lock());
     // Lazy initialization.
     if (freelist() == NULL) {
       _freelist =
@@ -1067,7 +1067,7 @@
   assert(instance != NULL, "shouldn't release NULL");
   assert(!instance->is_locked(), "shouldn't be locked");
   {
-    MutexLockerEx ml(lock());
+    MutexLocker ml(lock());
     freelist()->push(instance);
     // release lock().
   }
--- a/src/hotspot/share/gc/shared/collectedHeap.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/shared/collectedHeap.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -65,7 +65,7 @@
   }
 
   double timestamp = fetch_timestamp();
-  MutexLockerEx ml(&_mutex, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(&_mutex, Mutex::_no_safepoint_check_flag);
   int index = compute_log_index();
   _records[index].thread = NULL; // Its the GC thread so it's not that interesting.
   _records[index].timestamp = timestamp;
--- a/src/hotspot/share/gc/shared/concurrentGCPhaseManager.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/shared/concurrentGCPhaseManager.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, 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
@@ -50,7 +50,7 @@
   assert_ConcurrentGC_thread();
   assert_not_enter_unconstrained(phase);
   assert(stack != NULL, "precondition");
-  MonitorLockerEx ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
+  MonitorLocker ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
   if (stack->_top != NULL) {
     assert(stack->_top->_active, "precondition");
     _prev = stack->_top;
@@ -61,7 +61,7 @@
 
 ConcurrentGCPhaseManager::~ConcurrentGCPhaseManager() {
   assert_ConcurrentGC_thread();
-  MonitorLockerEx ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
+  MonitorLocker ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
   assert_manager_is_tos(this, _stack, "This");
   wait_when_requested_impl();
   _stack->_top = _prev;
@@ -70,7 +70,7 @@
 
 bool ConcurrentGCPhaseManager::is_requested() const {
   assert_ConcurrentGC_thread();
-  MonitorLockerEx ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
+  MonitorLocker ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
   assert_manager_is_tos(this, _stack, "This");
   return _active && (_stack->_requested_phase == _phase);
 }
@@ -81,14 +81,14 @@
   bool waited = false;
   while (_active && (_stack->_requested_phase == _phase)) {
     waited = true;
-    CGCPhaseManager_lock->wait(Mutex::_no_safepoint_check_flag);
+    CGCPhaseManager_lock->wait_without_safepoint_check();
   }
   return waited;
 }
 
 bool ConcurrentGCPhaseManager::wait_when_requested() const {
   assert_ConcurrentGC_thread();
-  MonitorLockerEx ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
+  MonitorLocker ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
   assert_manager_is_tos(this, _stack, "This");
   return wait_when_requested_impl();
 }
@@ -96,7 +96,7 @@
 void ConcurrentGCPhaseManager::set_phase(int phase, bool force) {
   assert_ConcurrentGC_thread();
   assert_not_enter_unconstrained(phase);
-  MonitorLockerEx ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
+  MonitorLocker ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
   assert_manager_is_tos(this, _stack, "This");
   if (!force) wait_when_requested_impl();
   _phase = phase;
@@ -105,7 +105,7 @@
 
 void ConcurrentGCPhaseManager::deactivate() {
   assert_ConcurrentGC_thread();
-  MonitorLockerEx ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
+  MonitorLocker ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
   assert_manager_is_tos(this, _stack, "This");
   _active = false;
   ml.notify_all();
@@ -114,7 +114,7 @@
 bool ConcurrentGCPhaseManager::wait_for_phase(int phase, Stack* stack) {
   assert(Thread::current()->is_Java_thread(), "precondition");
   assert(stack != NULL, "precondition");
-  MonitorLockerEx ml(CGCPhaseManager_lock);
+  MonitorLocker ml(CGCPhaseManager_lock);
   // Update request and notify service of change.
   if (stack->_requested_phase != phase) {
     stack->_requested_phase = phase;
--- a/src/hotspot/share/gc/shared/concurrentGCThread.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/shared/concurrentGCThread.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -50,7 +50,7 @@
   run_service();
 
   // Signal thread has terminated
-  MonitorLockerEx ml(Terminator_lock);
+  MonitorLocker ml(Terminator_lock);
   OrderAccess::release_store(&_has_terminated, true);
   ml.notify_all();
 }
@@ -65,7 +65,7 @@
   stop_service();
 
   // Wait for thread to terminate
-  MonitorLockerEx ml(Terminator_lock);
+  MonitorLocker ml(Terminator_lock);
   while (!_has_terminated) {
     ml.wait();
   }
--- a/src/hotspot/share/gc/shared/genCollectedHeap.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/shared/genCollectedHeap.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -233,7 +233,7 @@
 // Update the _full_collections_completed counter
 // at the end of a stop-world full GC.
 unsigned int GenCollectedHeap::update_full_collections_completed() {
-  MonitorLockerEx ml(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
+  MonitorLocker ml(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
   assert(_full_collections_completed <= _total_full_collections,
          "Can't complete more collections than were started");
   _full_collections_completed = _total_full_collections;
@@ -247,7 +247,7 @@
 // without synchronizing in any manner with the VM thread (which
 // may already have initiated a STW full collection "concurrently").
 unsigned int GenCollectedHeap::update_full_collections_completed(unsigned int count) {
-  MonitorLockerEx ml(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
+  MonitorLocker ml(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
   assert((_full_collections_completed <= _total_full_collections) &&
          (count <= _total_full_collections),
          "Can't complete more collections than were started");
--- a/src/hotspot/share/gc/shared/oopStorage.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/shared/oopStorage.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -412,7 +412,7 @@
 // is empty, for ease of empty block deletion processing.
 
 oop* OopStorage::allocate() {
-  MutexLockerEx ml(_allocation_mutex, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(_allocation_mutex, Mutex::_no_safepoint_check_flag);
 
   // Note: Without this we might never perform cleanup.  As it is,
   // cleanup is only requested here, when completing a concurrent
@@ -447,7 +447,7 @@
   assert_lock_strong(_allocation_mutex);
   Block* block;
   {
-    MutexUnlockerEx ul(_allocation_mutex, Mutex::_no_safepoint_check_flag);
+    MutexUnlocker ul(_allocation_mutex, Mutex::_no_safepoint_check_flag);
     block = Block::new_block(this);
   }
   if (block == NULL) return false;
@@ -481,14 +481,14 @@
     if (block != NULL) {
       return block;
     } else if (reduce_deferred_updates()) {
-      MutexUnlockerEx ul(_allocation_mutex, Mutex::_no_safepoint_check_flag);
+      MutexUnlocker ul(_allocation_mutex, Mutex::_no_safepoint_check_flag);
       notify_needs_cleanup();
     } else if (try_add_block()) {
       block = _allocation_list.head();
       assert(block != NULL, "invariant");
       return block;
     } else if (reduce_deferred_updates()) { // Once more before failure.
-      MutexUnlockerEx ul(_allocation_mutex, Mutex::_no_safepoint_check_flag);
+      MutexUnlocker ul(_allocation_mutex, Mutex::_no_safepoint_check_flag);
       notify_needs_cleanup();
     } else {
       // Attempt to add a block failed, no other thread added a block,
@@ -812,13 +812,13 @@
   // Avoid re-notification if already notified.
   const uint notified = needs_cleanup_notified;
   if (Atomic::xchg(notified, &_needs_cleanup) != notified) {
-    MonitorLockerEx ml(Service_lock, Monitor::_no_safepoint_check_flag);
+    MonitorLocker ml(Service_lock, Monitor::_no_safepoint_check_flag);
     ml.notify_all();
   }
 }
 
 bool OopStorage::delete_empty_blocks() {
-  MutexLockerEx ml(_allocation_mutex, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(_allocation_mutex, Mutex::_no_safepoint_check_flag);
 
   // Clear the request before processing.
   Atomic::store(needs_cleanup_none, &_needs_cleanup);
@@ -837,7 +837,7 @@
     // might become available while we're working.
     if (reduce_deferred_updates()) {
       // Be safepoint-polite while looping.
-      MutexUnlockerEx ul(_allocation_mutex, Mutex::_no_safepoint_check_flag);
+      MutexUnlocker ul(_allocation_mutex, Mutex::_no_safepoint_check_flag);
       ThreadBlockInVM tbiv(JavaThread::current());
     } else {
       Block* block = _allocation_list.tail();
@@ -850,7 +850,7 @@
 
       // Try to delete the block.  First, try to remove from _active_array.
       {
-        MutexLockerEx aml(_active_mutex, Mutex::_no_safepoint_check_flag);
+        MutexLocker aml(_active_mutex, Mutex::_no_safepoint_check_flag);
         // Don't interfere with an active concurrent iteration.
         // Instead, give up immediately.  There is more work to do,
         // but don't re-notify, to avoid useless spinning of the
@@ -861,7 +861,7 @@
       // Remove block from _allocation_list and delete it.
       _allocation_list.unlink(*block);
       // Be safepoint-polite while deleting and looping.
-      MutexUnlockerEx ul(_allocation_mutex, Mutex::_no_safepoint_check_flag);
+      MutexUnlocker ul(_allocation_mutex, Mutex::_no_safepoint_check_flag);
       delete_empty_block(*block);
       ThreadBlockInVM tbiv(JavaThread::current());
     }
@@ -878,7 +878,7 @@
   const Block* block = find_block_or_null(ptr);
   if (block != NULL) {
     // Prevent block deletion and _active_array modification.
-    MutexLockerEx ml(_allocation_mutex, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(_allocation_mutex, Mutex::_no_safepoint_check_flag);
     // Block could be a false positive, so get index carefully.
     size_t index = Block::active_index_safe(block);
     if ((index < _active_array->block_count()) &&
@@ -953,7 +953,7 @@
 
 void OopStorage::BasicParState::update_concurrent_iteration_count(int value) {
   if (_concurrent) {
-    MutexLockerEx ml(_storage->_active_mutex, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(_storage->_active_mutex, Mutex::_no_safepoint_check_flag);
     _storage->_concurrent_iteration_count += value;
     assert(_storage->_concurrent_iteration_count >= 0, "invariant");
   }
--- a/src/hotspot/share/gc/shared/owstTaskTerminator.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/shared/owstTaskTerminator.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -74,7 +74,7 @@
         }
       }
     } else {
-      _blocker->wait(true, WorkStealingSleepMillis);
+      _blocker->wait_without_safepoint_check(WorkStealingSleepMillis);
 
       if (_offered_termination == _n_threads) {
         _blocker->unlock();
@@ -151,9 +151,9 @@
                                   p2i(Thread::current()), yield_count);
       yield_count = 0;
 
-      MonitorLockerEx locker(_blocker, Mutex::_no_safepoint_check_flag);
+      MonitorLocker locker(_blocker, Mutex::_no_safepoint_check_flag);
       _spin_master = NULL;
-      locker.wait(Mutex::_no_safepoint_check_flag, WorkStealingSleepMillis);
+      locker.wait(WorkStealingSleepMillis);
       if (_spin_master == NULL) {
         _spin_master = Thread::current();
       } else {
@@ -167,7 +167,7 @@
     size_t tasks = tasks_in_queue_set();
     bool exit = exit_termination(tasks, terminator);
     {
-      MonitorLockerEx locker(_blocker, Mutex::_no_safepoint_check_flag);
+      MonitorLocker locker(_blocker, Mutex::_no_safepoint_check_flag);
       // Termination condition reached
       if (_offered_termination == _n_threads) {
         _spin_master = NULL;
--- a/src/hotspot/share/gc/shared/ptrQueue.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/shared/ptrQueue.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -305,7 +305,7 @@
 }
 
 void PtrQueueSet::enqueue_completed_buffer(BufferNode* cbn) {
-  MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(_cbl_mon, Mutex::_no_safepoint_check_flag);
   cbn->set_next(NULL);
   if (_completed_buffers_tail == NULL) {
     assert(_completed_buffers_head == NULL, "Well-formedness");
@@ -328,7 +328,7 @@
 }
 
 BufferNode* PtrQueueSet::get_completed_buffer(size_t stop_at) {
-  MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(_cbl_mon, Mutex::_no_safepoint_check_flag);
 
   if (_n_completed_buffers <= stop_at) {
     return NULL;
@@ -354,7 +354,7 @@
 void PtrQueueSet::abandon_completed_buffers() {
   BufferNode* buffers_to_delete = NULL;
   {
-    MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag);
+    MutexLocker x(_cbl_mon, Mutex::_no_safepoint_check_flag);
     buffers_to_delete = _completed_buffers_head;
     _completed_buffers_head = NULL;
     _completed_buffers_tail = NULL;
@@ -389,7 +389,7 @@
 // must share the monitor.
 void PtrQueueSet::merge_bufferlists(PtrQueueSet *src) {
   assert(_cbl_mon == src->_cbl_mon, "Should share the same lock");
-  MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(_cbl_mon, Mutex::_no_safepoint_check_flag);
   if (_completed_buffers_tail == NULL) {
     assert(_completed_buffers_head == NULL, "Well-formedness");
     _completed_buffers_head = src->_completed_buffers_head;
@@ -415,7 +415,7 @@
 }
 
 void PtrQueueSet::notify_if_necessary() {
-  MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag);
+  MutexLocker x(_cbl_mon, Mutex::_no_safepoint_check_flag);
   if (_n_completed_buffers > _process_completed_buffers_threshold) {
     _process_completed_buffers = true;
     if (_notify_when_complete)
--- a/src/hotspot/share/gc/shared/satbMarkQueue.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/shared/satbMarkQueue.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -172,7 +172,7 @@
 #endif // ASSERT
   // Update the global state, synchronized with threads list management.
   {
-    MutexLockerEx ml(NonJavaThreadsList_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(NonJavaThreadsList_lock, Mutex::_no_safepoint_check_flag);
     _all_active = active;
   }
 
--- a/src/hotspot/share/gc/shared/stringdedup/stringDedupTable.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/shared/stringdedup/stringDedupTable.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -477,7 +477,7 @@
 
   // Delayed update to avoid contention on the table lock
   if (removed > 0) {
-    MutexLockerEx ml(StringDedupTable_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(StringDedupTable_lock, Mutex::_no_safepoint_check_flag);
     _table->_entries -= removed;
     _entries_removed += removed;
   }
--- a/src/hotspot/share/gc/shared/stringdedup/stringDedupTable.hpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/shared/stringdedup/stringDedupTable.hpp	Thu Apr 25 10:56:31 2019 -0400
@@ -189,7 +189,7 @@
     // Protect the table from concurrent access. Also note that this lock
     // acts as a fence for _table, which could have been replaced by a new
     // instance if the table was resized or rehashed.
-    MutexLockerEx ml(StringDedupTable_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(StringDedupTable_lock, Mutex::_no_safepoint_check_flag);
     return _table->lookup_or_add_inner(value, latin1, hash);
   }
 
--- a/src/hotspot/share/gc/shared/suspendibleThreadSet.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/shared/suspendibleThreadSet.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -48,9 +48,9 @@
 
 void SuspendibleThreadSet::join() {
   assert(!Thread::current()->is_suspendible_thread(), "Thread already joined");
-  MonitorLockerEx ml(STS_lock, Mutex::_no_safepoint_check_flag);
+  MonitorLocker ml(STS_lock, Mutex::_no_safepoint_check_flag);
   while (_suspend_all) {
-    ml.wait(Mutex::_no_safepoint_check_flag);
+    ml.wait();
   }
   _nthreads++;
   DEBUG_ONLY(Thread::current()->set_suspendible_thread();)
@@ -58,7 +58,7 @@
 
 void SuspendibleThreadSet::leave() {
   assert(Thread::current()->is_suspendible_thread(), "Thread not joined");
-  MonitorLockerEx ml(STS_lock, Mutex::_no_safepoint_check_flag);
+  MonitorLocker ml(STS_lock, Mutex::_no_safepoint_check_flag);
   assert(_nthreads > 0, "Invalid");
   DEBUG_ONLY(Thread::current()->clear_suspendible_thread();)
   _nthreads--;
@@ -70,7 +70,7 @@
 
 void SuspendibleThreadSet::yield() {
   assert(Thread::current()->is_suspendible_thread(), "Must have joined");
-  MonitorLockerEx ml(STS_lock, Mutex::_no_safepoint_check_flag);
+  MonitorLocker ml(STS_lock, Mutex::_no_safepoint_check_flag);
   if (_suspend_all) {
     _nthreads_stopped++;
     if (is_synchronized()) {
@@ -82,7 +82,7 @@
       _synchronize_wakeup->signal();
     }
     while (_suspend_all) {
-      ml.wait(Mutex::_no_safepoint_check_flag);
+      ml.wait();
     }
     assert(_nthreads_stopped > 0, "Invalid");
     _nthreads_stopped--;
@@ -95,7 +95,7 @@
     _suspend_all_start = os::elapsedTime();
   }
   {
-    MonitorLockerEx ml(STS_lock, Mutex::_no_safepoint_check_flag);
+    MonitorLocker ml(STS_lock, Mutex::_no_safepoint_check_flag);
     assert(!_suspend_all, "Only one at a time");
     _suspend_all = true;
     if (is_synchronized()) {
@@ -118,7 +118,7 @@
   _synchronize_wakeup->wait();
 
 #ifdef ASSERT
-  MonitorLockerEx ml(STS_lock, Mutex::_no_safepoint_check_flag);
+  MonitorLocker ml(STS_lock, Mutex::_no_safepoint_check_flag);
   assert(_suspend_all, "STS not synchronizing");
   assert(is_synchronized(), "STS not synchronized");
 #endif
@@ -126,7 +126,7 @@
 
 void SuspendibleThreadSet::desynchronize() {
   assert(Thread::current()->is_VM_thread(), "Must be the VM thread");
-  MonitorLockerEx ml(STS_lock, Mutex::_no_safepoint_check_flag);
+  MonitorLocker ml(STS_lock, Mutex::_no_safepoint_check_flag);
   assert(_suspend_all, "STS not synchronizing");
   assert(is_synchronized(), "STS not synchronized");
   _suspend_all = false;
--- a/src/hotspot/share/gc/shared/workgroup.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/shared/workgroup.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -200,7 +200,7 @@
   }
 
   void coordinator_execute_on_workers(AbstractGangTask* task, uint num_workers) {
-    MutexLockerEx ml(_monitor, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(_monitor, Mutex::_no_safepoint_check_flag);
 
     _task        = task;
     _num_workers = num_workers;
@@ -210,7 +210,7 @@
 
     // Wait for them to finish.
     while (_finished < _num_workers) {
-      _monitor->wait(/* no_safepoint_check */ true);
+      _monitor->wait_without_safepoint_check();
     }
 
     _task        = NULL;
@@ -220,10 +220,10 @@
   }
 
   WorkData worker_wait_for_task() {
-    MonitorLockerEx ml(_monitor, Mutex::_no_safepoint_check_flag);
+    MonitorLocker ml(_monitor, Mutex::_no_safepoint_check_flag);
 
     while (_num_workers == 0 || _started == _num_workers) {
-      _monitor->wait(/* no_safepoint_check */ true);
+      _monitor->wait();
     }
 
     _started++;
@@ -235,7 +235,7 @@
   }
 
   void worker_done_with_task() {
-    MonitorLockerEx ml(_monitor, Mutex::_no_safepoint_check_flag);
+    MonitorLocker ml(_monitor, Mutex::_no_safepoint_check_flag);
 
     _finished++;
 
@@ -300,8 +300,6 @@
   assert(_gang != NULL, "No gang to run in");
   os::set_priority(this, NearMaxPriority);
   log_develop_trace(gc, workgang)("Running gang worker for gang %s id %u", gang()->name(), id());
-  // The VM thread should not execute here because MutexLocker's are used
-  // as (opposed to MutexLockerEx's).
   assert(!Thread::current()->is_VM_thread(), "VM thread should not be part"
          " of a work gang");
 }
@@ -369,7 +367,7 @@
 }
 
 bool WorkGangBarrierSync::enter() {
-  MutexLockerEx x(monitor(), Mutex::_no_safepoint_check_flag);
+  MutexLocker x(monitor(), Mutex::_no_safepoint_check_flag);
   if (should_reset()) {
     // The should_reset() was set and we are the first worker to enter
     // the sync barrier. We will zero the n_completed() count which
@@ -392,14 +390,14 @@
     monitor()->notify_all();
   } else {
     while (n_completed() != n_workers() && !aborted()) {
-      monitor()->wait(/* no_safepoint_check */ true);
+      monitor()->wait_without_safepoint_check();
     }
   }
   return !aborted();
 }
 
 void WorkGangBarrierSync::abort() {
-  MutexLockerEx x(monitor(), Mutex::_no_safepoint_check_flag);
+  MutexLocker x(monitor(), Mutex::_no_safepoint_check_flag);
   set_aborted();
   monitor()->notify_all();
 }
--- a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -360,7 +360,7 @@
   if (ShenandoahConcurrentScanCodeRoots && claim_codecache()) {
     ShenandoahObjToScanQueue* q = task_queues()->queue(worker_id);
     if (!_heap->unload_classes()) {
-      MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+      MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
       // TODO: We can not honor StringDeduplication here, due to lock ranking
       // inversion. So, we may miss some deduplication candidates.
       if (_heap->has_forwarded_objects()) {
--- a/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -508,7 +508,7 @@
 void ShenandoahControlThread::handle_requested_gc(GCCause::Cause cause) {
   _requested_gc_cause = cause;
   _gc_requested.set();
-  MonitorLockerEx ml(&_gc_waiters_lock);
+  MonitorLocker ml(&_gc_waiters_lock);
   while (_gc_requested.is_set()) {
     ml.wait();
   }
@@ -528,7 +528,7 @@
     heap->cancel_gc(GCCause::_allocation_failure);
   }
 
-  MonitorLockerEx ml(&_alloc_failure_waiters_lock);
+  MonitorLocker ml(&_alloc_failure_waiters_lock);
   while (is_alloc_failure_gc()) {
     ml.wait();
   }
@@ -549,7 +549,7 @@
 
 void ShenandoahControlThread::notify_alloc_failure_waiters() {
   _alloc_failure_gc.unset();
-  MonitorLockerEx ml(&_alloc_failure_waiters_lock);
+  MonitorLocker ml(&_alloc_failure_waiters_lock);
   ml.notify_all();
 }
 
@@ -563,7 +563,7 @@
 
 void ShenandoahControlThread::notify_gc_waiters() {
   _gc_requested.unset();
-  MonitorLockerEx ml(&_gc_waiters_lock);
+  MonitorLocker ml(&_gc_waiters_lock);
   ml.notify_all();
 }
 
--- a/src/hotspot/share/gc/shenandoah/shenandoahStrDedupQueue.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/shenandoah/shenandoahStrDedupQueue.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -48,7 +48,7 @@
 }
 
 ShenandoahStrDedupQueue::~ShenandoahStrDedupQueue() {
-  MonitorLockerEx ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
+  MonitorLocker ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
   for (size_t index = 0; index < num_queues(); index ++) {
     release_buffers(queue_at(index));
   }
@@ -58,9 +58,9 @@
 }
 
 void ShenandoahStrDedupQueue::wait_impl() {
-  MonitorLockerEx ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
+  MonitorLocker ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
   while (_consumer_queue == NULL && !_cancel) {
-    ml.wait(Mutex::_no_safepoint_check_flag);
+    ml.wait_without_safepoint_check();
     assert(_consumer_queue == NULL, "Why wait?");
     _consumer_queue = _published_queues;
     _published_queues = NULL;
@@ -68,7 +68,7 @@
 }
 
 void ShenandoahStrDedupQueue::cancel_wait_impl() {
-  MonitorLockerEx ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
+  MonitorLocker ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
   _cancel = true;
   ml.notify();
 }
@@ -105,11 +105,11 @@
   ShenandoahQueueBuffer* buf = queue_at((size_t)worker_id);
 
   if (buf == NULL) {
-    MonitorLockerEx ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
+    MonitorLocker ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
     buf = new_buffer();
     set_producer_buffer(buf, worker_id);
   } else if (buf->is_full()) {
-    MonitorLockerEx ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
+    MonitorLocker ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
     buf->set_next(_published_queues);
     _published_queues = buf;
     buf = new_buffer();
@@ -125,7 +125,7 @@
   assert(Thread::current() == StringDedupThread::thread(), "Must be dedup thread");
   while (true) {
     if (_consumer_queue == NULL) {
-      MonitorLockerEx ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
+      MonitorLocker ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
       _consumer_queue = _published_queues;
       _published_queues = NULL;
     }
@@ -163,7 +163,7 @@
   } while (obj == NULL);
 
   if (to_release != NULL) {
-    MonitorLockerEx ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
+    MonitorLocker ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
     release_buffers(to_release);
   }
 
--- a/src/hotspot/share/gc/z/zMessagePort.inline.hpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/z/zMessagePort.inline.hpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, 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
@@ -79,7 +79,7 @@
 
   {
     // Enqueue message
-    MonitorLockerEx ml(&_monitor, Monitor::_no_safepoint_check_flag);
+    MonitorLocker ml(&_monitor, Monitor::_no_safepoint_check_flag);
     request.initialize(message, _seqnum);
     _queue.insert_last(&request);
     ml.notify();
@@ -96,13 +96,13 @@
     // thread have returned from sem_wait(). To avoid this race we are
     // forcing the waiting thread to acquire/release the lock held by the
     // posting thread. https://sourceware.org/bugzilla/show_bug.cgi?id=12674
-    MonitorLockerEx ml(&_monitor, Monitor::_no_safepoint_check_flag);
+    MonitorLocker ml(&_monitor, Monitor::_no_safepoint_check_flag);
   }
 }
 
 template <typename T>
 inline void ZMessagePort<T>::send_async(T message) {
-  MonitorLockerEx ml(&_monitor, Monitor::_no_safepoint_check_flag);
+  MonitorLocker ml(&_monitor, Monitor::_no_safepoint_check_flag);
   if (!_has_message) {
     // Post message
     _message = message;
@@ -113,11 +113,11 @@
 
 template <typename T>
 inline T ZMessagePort<T>::receive() {
-  MonitorLockerEx ml(&_monitor, Monitor::_no_safepoint_check_flag);
+  MonitorLocker ml(&_monitor, Monitor::_no_safepoint_check_flag);
 
   // Wait for message
   while (!_has_message && _queue.is_empty()) {
-    ml.wait(Monitor::_no_safepoint_check_flag);
+    ml.wait();
   }
 
   // Increment request sequence number
@@ -134,7 +134,7 @@
 
 template <typename T>
 inline void ZMessagePort<T>::ack() {
-  MonitorLockerEx ml(&_monitor, Monitor::_no_safepoint_check_flag);
+  MonitorLocker ml(&_monitor, Monitor::_no_safepoint_check_flag);
 
   if (!_has_message) {
     // Nothing to ack
--- a/src/hotspot/share/gc/z/zMetronome.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/z/zMetronome.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, 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
@@ -53,10 +53,10 @@
     const uint64_t next_ms = _start_ms + (_interval_ms * _nticks);
     const int64_t timeout_ms = next_ms - now_ms;
 
-    MonitorLockerEx ml(&_monitor, Monitor::_no_safepoint_check_flag);
+    MonitorLocker ml(&_monitor, Monitor::_no_safepoint_check_flag);
     if (!_stopped && timeout_ms > 0) {
       // Wait
-      ml.wait(Monitor::_no_safepoint_check_flag, timeout_ms);
+      ml.wait(timeout_ms);
     } else {
       // Tick
       return !_stopped;
@@ -65,7 +65,7 @@
 }
 
 void ZMetronome::stop() {
-  MonitorLockerEx ml(&_monitor, Monitor::_no_safepoint_check_flag);
+  MonitorLocker ml(&_monitor, Monitor::_no_safepoint_check_flag);
   _stopped = true;
   ml.notify();
 }
--- a/src/hotspot/share/gc/z/zNMethodTable.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/z/zNMethodTable.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -195,7 +195,7 @@
   assert(CodeCache_lock->owned_by_self(), "Lock must be held");
 
   while (_iteration.in_progress()) {
-    CodeCache_lock->wait(Monitor::_no_safepoint_check_flag);
+    CodeCache_lock->wait_without_safepoint_check();
   }
 }
 
@@ -209,7 +209,7 @@
 }
 
 void ZNMethodTable::nmethods_do_begin() {
-  MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 
   // Do not allow the table to be deleted while iterating
   _safe_delete.enable_deferred_delete();
@@ -219,7 +219,7 @@
 }
 
 void ZNMethodTable::nmethods_do_end() {
-  MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 
   // Finish iteration
   _iteration.nmethods_do_end();
--- a/src/hotspot/share/gc/z/zReferenceProcessor.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/z/zReferenceProcessor.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -450,7 +450,7 @@
 
   {
     // Heap_lock protects external pending list
-    MonitorLockerEx ml(Heap_lock);
+    MonitorLocker ml(Heap_lock);
 
     // Prepend internal pending list to external pending list
     *_pending_list_tail = Universe::swap_reference_pending_list(_pending_list.get());
--- a/src/hotspot/share/gc/z/zRuntimeWorkers.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/z/zRuntimeWorkers.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -48,13 +48,13 @@
     ZThread::set_runtime_worker();
 
     // Wait for all threads to start
-    MonitorLockerEx ml(&_monitor, Monitor::_no_safepoint_check_flag);
+    MonitorLocker ml(&_monitor, Monitor::_no_safepoint_check_flag);
     if (++_started == _nworkers) {
       // All threads started
       ml.notify_all();
     } else {
       while (_started != _nworkers) {
-        ml.wait(Monitor::_no_safepoint_check_flag);
+        ml.wait();
       }
     }
   }
--- a/src/hotspot/share/gc/z/zUnload.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/z/zUnload.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -130,7 +130,7 @@
   bool unloading_occurred;
 
   {
-    MutexLockerEx ml(ClassLoaderDataGraph_lock);
+    MutexLocker ml(ClassLoaderDataGraph_lock);
     unloading_occurred = SystemDictionary::do_unloading(ZStatPhase::timer());
   }
 
--- a/src/hotspot/share/gc/z/zWorkers.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/gc/z/zWorkers.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, 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
@@ -86,13 +86,13 @@
     ZThread::set_worker();
 
     // Wait for all threads to start
-    MonitorLockerEx ml(&_monitor, Monitor::_no_safepoint_check_flag);
+    MonitorLocker ml(&_monitor, Monitor::_no_safepoint_check_flag);
     if (++_started == _nworkers) {
       // All threads started
       ml.notify_all();
     } else {
       while (_started != _nworkers) {
-        ml.wait(Monitor::_no_safepoint_check_flag);
+        ml.wait();
       }
     }
   }
--- a/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -409,7 +409,7 @@
   JfrTicks time_stamp = JfrTicks::now();
   {
     // Collect allocation statistics while holding threads lock
-    MutexLockerEx ml(Threads_lock);
+    MutexLocker ml(Threads_lock);
     for (JavaThreadIteratorWithHandle jtiwh; JavaThread *jt = jtiwh.next(); ) {
       allocated.append(jt->cooked_allocated_bytes());
       thread_ids.append(JFR_THREAD_ID(jt));
--- a/src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -347,7 +347,7 @@
   jt->clear_trace_flag();
   JfrThreadLocal* const tl = jt->jfr_thread_local();
   if (tl->is_trace_block()) {
-    MutexLockerEx ml(JfrThreadSampler::transition_block(), Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(JfrThreadSampler::transition_block(), Mutex::_no_safepoint_check_flag);
     JfrThreadSampler::transition_block()->notify_all();
   }
 }
@@ -395,9 +395,9 @@
   JfrThreadLocal* const tl = thread->jfr_thread_local();
   tl->set_trace_block();
   {
-    MutexLockerEx ml(transition_block(), Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(transition_block(), Mutex::_no_safepoint_check_flag);
     while (thread->is_trace_suspend()) {
-      transition_block()->wait(true);
+      transition_block()->wait_without_safepoint_check();
     }
     tl->clear_trace_block();
   }
@@ -516,7 +516,7 @@
     elapsedTimer sample_time;
     sample_time.start();
     {
-      MonitorLockerEx tlock(Threads_lock, Mutex::_allow_vm_block_flag);
+      MutexLocker tlock(Threads_lock, Mutex::_no_safepoint_check_flag);
       ThreadsListHandle tlh;
       // Resolve a sample session relative start position index into the thread list array.
       // In cases where the last sampled thread is NULL or not-NULL but stale, find_index() returns -1.
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeManager.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeManager.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, 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
@@ -149,8 +149,8 @@
 
 void JfrTypeManager::write_type_set() {
   // can safepoint here because of Module_lock
-  MutexLockerEx cld_lock(SafepointSynchronize::is_at_safepoint() ? NULL : ClassLoaderDataGraph_lock);
-  MutexLockerEx lock(SafepointSynchronize::is_at_safepoint() ? NULL : Module_lock);
+  MutexLocker cld_lock(SafepointSynchronize::is_at_safepoint() ? NULL : ClassLoaderDataGraph_lock);
+  MutexLocker lock(SafepointSynchronize::is_at_safepoint() ? NULL : Module_lock);
 
   JfrCheckpointWriter writer(true, true, Thread::current());
   TypeSet set;
--- a/src/hotspot/share/jfr/recorder/repository/jfrEmergencyDump.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/jfr/recorder/repository/jfrEmergencyDump.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -325,7 +325,7 @@
 void JfrEmergencyDump::on_vm_error(const char* repository_path) {
   assert(repository_path != NULL, "invariant");
   ResourceMark rm;
-  MutexLockerEx stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
   const fio_fd emergency_fd = emergency_dump_file_descriptor();
   if (emergency_fd != invalid_fd) {
     RepositoryIterator iterator(repository_path, strlen(repository_path));
--- a/src/hotspot/share/jfr/recorder/repository/jfrRepository.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/jfr/recorder/repository/jfrRepository.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -135,7 +135,7 @@
   ResourceMark rm(jt);
   const char* const canonical_chunk_path = JfrJavaSupport::c_str(path, jt);
   {
-    MutexLockerEx stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
     if (NULL == canonical_chunk_path && !_chunkwriter->is_valid()) {
       // new output is NULL and current output is NULL
       return;
--- a/src/hotspot/share/jfr/recorder/service/jfrPostBox.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/jfr/recorder/service/jfrPostBox.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, 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
@@ -110,7 +110,7 @@
 void JfrPostBox::synchronous_post(int msg) {
   assert(is_synchronous(msg), "invariant");
   assert(!JfrMsg_lock->owned_by_self(), "should not hold JfrMsg_lock here!");
-  MutexLockerEx msg_lock(JfrMsg_lock);
+  MutexLocker msg_lock(JfrMsg_lock);
   deposit(msg);
   // serial_id is used to check when what we send in has been processed.
   // _msg_read_serial is read under JfrMsg_lock protection.
@@ -168,6 +168,6 @@
 
 // safeguard to ensure no threads are left waiting
 void JfrPostBox::notify_collection_stop() {
-  MutexLockerEx msg_lock(JfrMsg_lock);
+  MutexLocker msg_lock(JfrMsg_lock);
   JfrMsg_lock->notify_all();
 }
--- a/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, 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
@@ -110,8 +110,8 @@
       }
       if (_thread->is_Java_thread()) {
         // in order to allow the system to move to a safepoint
-        MutexLockerEx msg_lock(JfrMsg_lock);
-        JfrMsg_lock->wait(false, rotation_retry_sleep_millis);
+        MutexLocker msg_lock(JfrMsg_lock);
+        JfrMsg_lock->wait(rotation_retry_sleep_millis);
       }
       else {
         os::naked_short_sleep(rotation_retry_sleep_millis);
@@ -341,7 +341,7 @@
   assert(!_chunkwriter.is_valid(), "invariant");
   assert(!JfrStream_lock->owned_by_self(), "invariant");
   JfrChunkRotation::on_rotation();
-  MutexLockerEx stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
   if (!_repository.open_chunk(vm_error)) {
     assert(!_chunkwriter.is_valid(), "invariant");
     _storage.control().set_to_disk(false);
@@ -363,7 +363,7 @@
 
 void JfrRecorderService::serialize_storage_from_in_memory_recording() {
   assert(!JfrStream_lock->owned_by_self(), "not holding stream lock!");
-  MutexLockerEx stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
   _storage.write();
 }
 
@@ -422,7 +422,7 @@
 //              release stream lock
 //
 void JfrRecorderService::pre_safepoint_write() {
-  MutexLockerEx stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
   assert(_chunkwriter.is_valid(), "invariant");
   _checkpoint_manager.write_types();
   _checkpoint_manager.write_epoch_transition_mspace();
@@ -457,7 +457,7 @@
 //
 void JfrRecorderService::safepoint_write() {
   assert(SafepointSynchronize::is_at_safepoint(), "invariant");
-  MutexLockerEx stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
   write_object_sample_stacktrace(_stack_trace_repository);
   write_stacktrace_checkpoint(_stack_trace_repository, _chunkwriter, true);
   write_stringpool_checkpoint_safepoint(_string_pool, _chunkwriter);
@@ -493,7 +493,7 @@
   // already tagged artifacts for the previous epoch. We can accomplish this concurrently
   // with threads now tagging artifacts in relation to the new, now updated, epoch and remain outside of a safepoint.
   _checkpoint_manager.write_type_set();
-  MutexLockerEx stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
   // serialize any outstanding checkpoint memory
   _checkpoint_manager.write();
   // serialize the metadata descriptor event and close out the chunk
@@ -526,7 +526,7 @@
 void JfrRecorderService::process_full_buffers() {
   if (_chunkwriter.is_valid()) {
     assert(!JfrStream_lock->owned_by_self(), "invariant");
-    MutexLockerEx stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
     _storage.write_full();
   }
 }
--- a/src/hotspot/share/jfr/recorder/service/jfrRecorderThreadLoop.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/jfr/recorder/service/jfrRecorderThreadLoop.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -50,12 +50,12 @@
     bool done = false;
     int msgs = 0;
     JfrRecorderService service;
-    MutexLockerEx msg_lock(JfrMsg_lock);
+    MutexLocker msg_lock(JfrMsg_lock);
 
     // JFR MESSAGE LOOP PROCESSING - BEGIN
     while (!done) {
       if (post_box.is_empty()) {
-        JfrMsg_lock->wait(false);
+        JfrMsg_lock->wait();
       }
       msgs = post_box.collect();
       JfrMsg_lock->unlock();
--- a/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -123,7 +123,7 @@
 }
 
 size_t JfrStackTraceRepository::clear() {
-  MutexLockerEx lock(JfrStacktrace_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker lock(JfrStacktrace_lock, Mutex::_no_safepoint_check_flag);
   if (_entries == 0) {
     return 0;
   }
@@ -142,7 +142,7 @@
 }
 
 traceid JfrStackTraceRepository::add_trace(const JfrStackTrace& stacktrace) {
-  MutexLockerEx lock(JfrStacktrace_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker lock(JfrStacktrace_lock, Mutex::_no_safepoint_check_flag);
   const size_t index = stacktrace._hash % TABLE_SIZE;
   const StackTrace* table_entry = _table[index];
 
@@ -238,7 +238,7 @@
 }
 
 size_t JfrStackTraceRepository::write_impl(JfrChunkWriter& sw, bool clear) {
-  MutexLockerEx lock(JfrStacktrace_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker lock(JfrStacktrace_lock, Mutex::_no_safepoint_check_flag);
   assert(_entries > 0, "invariant");
   int count = 0;
   for (u4 i = 0; i < TABLE_SIZE; ++i) {
--- a/src/hotspot/share/jfr/recorder/storage/jfrStorage.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/jfr/recorder/storage/jfrStorage.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -321,7 +321,7 @@
   assert(buffer != NULL, "invariant");
   assert(buffer->retired(), "invariant");
   assert(age_mspace != NULL, "invariant");
-  MutexLockerEx lock(JfrBuffer_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker lock(JfrBuffer_lock, Mutex::_no_safepoint_check_flag);
   JfrAgeNode* age_node = get_free_age_node(age_mspace, thread);
   if (age_node == NULL) {
     age_node = new_age_node(buffer, age_mspace, thread);
@@ -623,7 +623,7 @@
     assert(tail->next() == NULL, "invariant");
     assert(head != NULL, "invariant");
     assert(head->prev() == NULL, "invariant");
-    MutexLockerEx buffer_lock(JfrBuffer_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker buffer_lock(JfrBuffer_lock, Mutex::_no_safepoint_check_flag);
     age_mspace->insert_free_tail(head, tail, count);
   }
 }
@@ -674,7 +674,7 @@
   JfrAgeNode* head;
   {
     // fetch age list
-    MutexLockerEx buffer_lock(JfrBuffer_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker buffer_lock(JfrBuffer_lock, Mutex::_no_safepoint_check_flag);
     count = age_mspace->full_count();
     head = age_mspace->clear_full();
     control.reset_full();
--- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -691,7 +691,7 @@
     stringStream s;
     // Dump code cache  into a buffer before locking the tty,
     {
-      MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+      MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
       CodeCache::print_summary(&s, false);
     }
     ttyLocker ttyl;
@@ -706,7 +706,7 @@
       nmethod::invalidate_installed_code(installed_code_handle, CHECK_0);
       {
         // Ensure that all updates to the InstalledCode fields are consistent.
-        MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
+        MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag);
         InstalledCode::set_address(installed_code_handle, (jlong) cb);
         InstalledCode::set_version(installed_code_handle, InstalledCode::version(installed_code_handle) + 1);
         if (cb->is_nmethod()) {
--- a/src/hotspot/share/memory/metaspace.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/memory/metaspace.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -841,7 +841,7 @@
 
 // Prints an ASCII representation of the given space.
 void MetaspaceUtils::print_metaspace_map(outputStream* out, Metaspace::MetadataType mdtype) {
-  MutexLockerEx cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
   const bool for_class = mdtype == Metaspace::ClassType ? true : false;
   VirtualSpaceList* const vsl = for_class ? Metaspace::class_space_list() : Metaspace::space_list();
   if (vsl != NULL) {
@@ -906,7 +906,7 @@
 
 // Utils to check if a pointer or range is part of a committed metaspace region.
 metaspace::VirtualSpaceNode* MetaspaceUtils::find_enclosing_virtual_space(const void* p) {
-  MutexLockerEx cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
   VirtualSpaceNode* vsn = Metaspace::space_list()->find_enclosing_space(p);
   if (Metaspace::using_class_space() && vsn == NULL) {
     vsn = Metaspace::class_space_list()->find_enclosing_space(p);
@@ -1402,8 +1402,8 @@
 }
 
 void Metaspace::purge() {
-  MutexLockerEx cl(MetaspaceExpand_lock,
-                   Mutex::_no_safepoint_check_flag);
+  MutexLocker cl(MetaspaceExpand_lock,
+                 Mutex::_no_safepoint_check_flag);
   purge(NonClassType);
   if (using_class_space()) {
     purge(ClassType);
@@ -1480,7 +1480,7 @@
     _class_vsm = new SpaceManager(Metaspace::ClassType, type, lock);
   }
 
-  MutexLockerEx cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
 
   // Allocate chunk for metadata objects
   initialize_first_chunk(type, Metaspace::NonClassType);
@@ -1549,7 +1549,7 @@
 
   DEBUG_ONLY(Atomic::inc(&g_internal_statistics.num_external_deallocs));
 
-  MutexLockerEx ml(vsm()->lock(), Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(vsm()->lock(), Mutex::_no_safepoint_check_flag);
 
   if (is_class && Metaspace::using_class_space()) {
     class_vsm()->deallocate(ptr, word_size);
@@ -1589,7 +1589,7 @@
 }
 
 void ClassLoaderMetaspace::add_to_statistics(ClassLoaderMetaspaceStatistics* out) const {
-  MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag);
+  MutexLocker cl(lock(), Mutex::_no_safepoint_check_flag);
   add_to_statistics_locked(out);
 }
 
@@ -1639,7 +1639,7 @@
 
   static void test_virtual_space_list_large_chunk() {
     VirtualSpaceList* vs_list = new VirtualSpaceList(os::vm_allocation_granularity());
-    MutexLockerEx cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
     // A size larger than VirtualSpaceSize (256k) and add one page to make it _not_ be
     // vm_allocation_granularity aligned on Windows.
     size_t large_size = (size_t)(2*256*K + (os::vm_page_size()/BytesPerWord));
--- a/src/hotspot/share/memory/metaspace/chunkManager.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/memory/metaspace/chunkManager.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -227,7 +227,7 @@
 
 #ifdef ASSERT
 void ChunkManager::verify(bool slow) const {
-  MutexLockerEx cl(MetaspaceExpand_lock,
+  MutexLocker cl(MetaspaceExpand_lock,
                      Mutex::_no_safepoint_check_flag);
   locked_verify(slow);
 }
@@ -630,7 +630,7 @@
 }
 
 void ChunkManager::collect_statistics(ChunkManagerStatistics* out) const {
-  MutexLockerEx cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
   for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
     out->chunk_stats(i).add(num_free_chunks(i), size_free_chunks_in_bytes(i) / sizeof(MetaWord));
   }
--- a/src/hotspot/share/memory/metaspace/spaceManager.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/memory/metaspace/spaceManager.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -179,7 +179,7 @@
   assert(current_chunk() == NULL ||
          current_chunk()->allocate(word_size) == NULL,
          "Don't need to expand");
-  MutexLockerEx cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
 
   if (log_is_enabled(Trace, gc, metaspace, freelist)) {
     size_t words_left = 0;
@@ -284,8 +284,7 @@
   // This call this->_lock which can't be done while holding MetaspaceExpand_lock
   DEBUG_ONLY(verify_metrics());
 
-  MutexLockerEx fcl(MetaspaceExpand_lock,
-                    Mutex::_no_safepoint_check_flag);
+  MutexLocker fcl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
 
   account_for_spacemanager_death();
 
@@ -402,7 +401,7 @@
 }
 
 MetaWord* SpaceManager::allocate(size_t word_size) {
-  MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag);
+  MutexLocker cl(lock(), Mutex::_no_safepoint_check_flag);
   size_t raw_word_size = get_allocation_word_size(word_size);
   BlockFreelist* fl =  block_freelists();
   MetaWord* p = NULL;
@@ -498,7 +497,7 @@
 }
 
 void SpaceManager::add_to_statistics(SpaceManagerStatistics* out) const {
-  MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag);
+  MutexLocker cl(lock(), Mutex::_no_safepoint_check_flag);
   add_to_statistics_locked(out);
 }
 
@@ -519,7 +518,7 @@
 }
 
 void SpaceManager::verify_metrics() const {
-  MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag);
+  MutexLocker cl(lock(), Mutex::_no_safepoint_check_flag);
   verify_metrics_locked();
 }
 #endif // ASSERT
--- a/src/hotspot/share/memory/metaspace/virtualSpaceList.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/memory/metaspace/virtualSpaceList.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -172,8 +172,7 @@
                                    _virtual_space_count(0),
                                    _envelope_lo((address)max_uintx),
                                    _envelope_hi(NULL) {
-  MutexLockerEx cl(MetaspaceExpand_lock,
-                   Mutex::_no_safepoint_check_flag);
+  MutexLocker cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
   create_new_virtual_space(word_size);
 }
 
@@ -186,8 +185,7 @@
                                    _virtual_space_count(0),
                                    _envelope_lo((address)max_uintx),
                                    _envelope_hi(NULL) {
-  MutexLockerEx cl(MetaspaceExpand_lock,
-                   Mutex::_no_safepoint_check_flag);
+  MutexLocker cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
   VirtualSpaceNode* class_entry = new VirtualSpaceNode(is_class(), rs);
   bool succeeded = class_entry->initialize();
   if (succeeded) {
--- a/src/hotspot/share/memory/universe.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/memory/universe.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1205,7 +1205,7 @@
   }
   if (should_verify_subset(Verify_CodeCache)) {
   {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     log_debug(gc, verify)("CodeCache");
     CodeCache::verify();
   }
--- a/src/hotspot/share/oops/instanceKlass.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/oops/instanceKlass.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -2187,7 +2187,7 @@
   for (int m = 0; m < methods()->length(); m++) {
     MethodData* mdo = methods()->at(m)->method_data();
     if (mdo != NULL) {
-      MutexLockerEx ml(SafepointSynchronize::is_at_safepoint() ? NULL : mdo->extra_data_lock());
+      MutexLocker ml(SafepointSynchronize::is_at_safepoint() ? NULL : mdo->extra_data_lock());
       mdo->clean_method_data(/*always_clean*/false);
     }
   }
@@ -2968,7 +2968,7 @@
   // only one compilation can be active
   {
     // This is a short non-blocking critical region, so the no safepoint check is ok.
-    MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
     assert(n->is_osr_method(), "wrong kind of nmethod");
     n->set_osr_link(osr_nmethods_head());
     set_osr_nmethods_head(n);
@@ -2993,7 +2993,7 @@
 // Remove osr nmethod from the list. Return true if found and removed.
 bool InstanceKlass::remove_osr_nmethod(nmethod* n) {
   // This is a short non-blocking critical region, so the no safepoint check is ok.
-  MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
   assert(n->is_osr_method(), "wrong kind of nmethod");
   nmethod* last = NULL;
   nmethod* cur  = osr_nmethods_head();
@@ -3037,7 +3037,7 @@
 
 int InstanceKlass::mark_osr_nmethods(const Method* m) {
   // This is a short non-blocking critical region, so the no safepoint check is ok.
-  MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
   nmethod* osr = osr_nmethods_head();
   int found = 0;
   while (osr != NULL) {
@@ -3053,7 +3053,7 @@
 
 nmethod* InstanceKlass::lookup_osr_nmethod(const Method* m, int bci, int comp_level, bool match_level) const {
   // This is a short non-blocking critical region, so the no safepoint check is ok.
-  MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
   nmethod* osr = osr_nmethods_head();
   nmethod* best = NULL;
   while (osr != NULL) {
--- a/src/hotspot/share/oops/method.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/oops/method.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -928,7 +928,7 @@
 
 // Revert to using the interpreter and clear out the nmethod
 void Method::clear_code(bool acquire_lock /* = true */) {
-  MutexLockerEx pl(acquire_lock ? Patching_lock : NULL, Mutex::_no_safepoint_check_flag);
+  MutexLocker pl(acquire_lock ? Patching_lock : NULL, Mutex::_no_safepoint_check_flag);
   // this may be NULL if c2i adapters have not been made yet
   // Only should happen at allocate time.
   if (adapter() == NULL) {
@@ -1161,7 +1161,7 @@
 
 // Install compiled code.  Instantly it can execute.
 void Method::set_code(const methodHandle& mh, CompiledMethod *code) {
-  MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag);
   assert( code, "use clear_code to remove code" );
   assert( mh->check_code(), "" );
 
@@ -2064,7 +2064,7 @@
     // Have to add jmethod_ids() to class loader data thread-safely.
     // Also have to add the method to the list safely, which the cld lock
     // protects as well.
-    MutexLockerEx ml(cld->metaspace_lock(),  Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(cld->metaspace_lock(),  Mutex::_no_safepoint_check_flag);
     if (cld->jmethod_ids() == NULL) {
       cld->set_jmethod_ids(new JNIMethodBlock(capacity));
     } else {
@@ -2088,7 +2088,7 @@
     // Have to add jmethod_ids() to class loader data thread-safely.
     // Also have to add the method to the list safely, which the cld lock
     // protects as well.
-    MutexLockerEx ml(cld->metaspace_lock(),  Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(cld->metaspace_lock(),  Mutex::_no_safepoint_check_flag);
     if (cld->jmethod_ids() == NULL) {
       cld->set_jmethod_ids(new JNIMethodBlock());
     }
@@ -2382,7 +2382,7 @@
 }
 
 void Method::print_touched_methods(outputStream* out) {
-  MutexLockerEx ml(Thread::current()->is_VM_thread() ? NULL : TouchedMethodLog_lock);
+  MutexLocker ml(Thread::current()->is_VM_thread() ? NULL : TouchedMethodLog_lock);
   out->print_cr("# Method::print_touched_methods version 1");
   if (_touched_method_table) {
     for (int i = 0; i < TOUCHED_METHOD_TABLE_SIZE; i++) {
--- a/src/hotspot/share/prims/jvm.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/prims/jvm.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -2863,7 +2863,7 @@
   if (is_alive) {
     // jthread refers to a live JavaThread.
     {
-      MutexLockerEx ml(receiver->SR_lock(), Mutex::_no_safepoint_check_flag);
+      MutexLocker ml(receiver->SR_lock(), Mutex::_no_safepoint_check_flag);
       if (receiver->is_external_suspend()) {
         // Don't allow nested external suspend requests. We can't return
         // an error from this interface so just ignore the problem.
@@ -3168,7 +3168,7 @@
 JVM_ENTRY(jobject, JVM_GetAndClearReferencePendingList(JNIEnv* env))
   JVMWrapper("JVM_GetAndClearReferencePendingList");
 
-  MonitorLockerEx ml(Heap_lock);
+  MonitorLocker ml(Heap_lock);
   oop ref = Universe::reference_pending_list();
   if (ref != NULL) {
     Universe::set_reference_pending_list(NULL);
@@ -3178,13 +3178,13 @@
 
 JVM_ENTRY(jboolean, JVM_HasReferencePendingList(JNIEnv* env))
   JVMWrapper("JVM_HasReferencePendingList");
-  MonitorLockerEx ml(Heap_lock);
+  MonitorLocker ml(Heap_lock);
   return Universe::has_reference_pending_list();
 JVM_END
 
 JVM_ENTRY(void, JVM_WaitForReferencePendingList(JNIEnv* env))
   JVMWrapper("JVM_WaitForReferencePendingList");
-  MonitorLockerEx ml(Heap_lock);
+  MonitorLocker ml(Heap_lock);
   while (!Universe::has_reference_pending_list()) {
     ml.wait();
   }
--- a/src/hotspot/share/prims/jvmtiCodeBlobEvents.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/prims/jvmtiCodeBlobEvents.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -203,7 +203,7 @@
   // there isn't any safe way to iterate over regular CodeBlobs since
   // they can be freed at any point.
   {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     collector.collect();
   }
 
@@ -225,7 +225,7 @@
   // may be changing while this is happening which is ok since newly
   // created nmethod will notify normally and nmethods which are freed
   // can be safely skipped.
-  MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   // Iterate over non-profiled and profiled nmethods
   NMethodIterator iter(NMethodIterator::only_alive_and_not_unloading);
   while(iter.next()) {
@@ -234,7 +234,7 @@
     nmethodLocker nml(current);
 
     // Don't hold the lock over the notify or jmethodID creation
-    MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexUnlocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     current->get_and_cache_jmethod_id();
     JvmtiExport::post_compiled_method_load(env, current);
   }
--- a/src/hotspot/share/prims/jvmtiEnv.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/prims/jvmtiEnv.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -943,7 +943,7 @@
   }
 
   {
-    MutexLockerEx ml(java_thread->SR_lock(), Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(java_thread->SR_lock(), Mutex::_no_safepoint_check_flag);
     if (java_thread->is_external_suspend()) {
       // don't allow nested external suspend requests.
       return (JVMTI_ERROR_THREAD_SUSPENDED);
@@ -983,7 +983,7 @@
     }
 
     {
-      MutexLockerEx ml(java_thread->SR_lock(), Mutex::_no_safepoint_check_flag);
+      MutexLocker ml(java_thread->SR_lock(), Mutex::_no_safepoint_check_flag);
       if (java_thread->is_external_suspend()) {
         // don't allow nested external suspend requests.
         results[i] = JVMTI_ERROR_THREAD_SUSPENDED;
--- a/src/hotspot/share/prims/jvmtiEventController.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/prims/jvmtiEventController.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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
@@ -997,21 +997,21 @@
 
 void
 JvmtiEventController::set_frame_pop(JvmtiEnvThreadState *ets, JvmtiFramePop fpop) {
-  MutexLockerEx mu(SafepointSynchronize::is_at_safepoint() ? NULL : JvmtiThreadState_lock);
+  MutexLocker mu(SafepointSynchronize::is_at_safepoint() ? NULL : JvmtiThreadState_lock);
   JvmtiEventControllerPrivate::set_frame_pop(ets, fpop);
 }
 
 
 void
 JvmtiEventController::clear_frame_pop(JvmtiEnvThreadState *ets, JvmtiFramePop fpop) {
-  MutexLockerEx mu(SafepointSynchronize::is_at_safepoint() ? NULL : JvmtiThreadState_lock);
+  MutexLocker mu(SafepointSynchronize::is_at_safepoint() ? NULL : JvmtiThreadState_lock);
   JvmtiEventControllerPrivate::clear_frame_pop(ets, fpop);
 }
 
 
 void
 JvmtiEventController::clear_to_frame_pop(JvmtiEnvThreadState *ets, JvmtiFramePop fpop) {
-  MutexLockerEx mu(SafepointSynchronize::is_at_safepoint() ? NULL : JvmtiThreadState_lock);
+  MutexLocker mu(SafepointSynchronize::is_at_safepoint() ? NULL : JvmtiThreadState_lock);
   JvmtiEventControllerPrivate::clear_to_frame_pop(ets, fpop);
 }
 
--- a/src/hotspot/share/prims/jvmtiExport.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/prims/jvmtiExport.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -2239,7 +2239,7 @@
     // It may not be safe to post the event from this thread.  Defer all
     // postings to the service thread so that it can perform them in a safe
     // context and in-order.
-    MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
     JvmtiDeferredEvent event = JvmtiDeferredEvent::dynamic_code_generated_event(
         name, code_begin, code_end);
     JvmtiDeferredEventQueue::enqueue(event);
--- a/src/hotspot/share/prims/methodHandles.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/prims/methodHandles.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1098,7 +1098,7 @@
   CallSiteDepChange changes(call_site, target);
   {
     NoSafepointVerifier nsv;
-    MutexLockerEx mu2(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu2(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 
     oop context = java_lang_invoke_CallSite::context_no_keepalive(call_site());
     DependencyContext deps = java_lang_invoke_MethodHandleNatives_CallSiteContext::vmdependencies(context);
@@ -1497,7 +1497,7 @@
     int marked = 0;
     {
       NoSafepointVerifier nsv;
-      MutexLockerEx mu2(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+      MutexLocker mu2(CodeCache_lock, Mutex::_no_safepoint_check_flag);
       DependencyContext deps = java_lang_invoke_MethodHandleNatives_CallSiteContext::vmdependencies(context());
       marked = deps.remove_all_dependents();
     }
--- a/src/hotspot/share/prims/resolvedMethodTable.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/prims/resolvedMethodTable.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -251,7 +251,7 @@
 }
 
 void ResolvedMethodTable::trigger_concurrent_work() {
-  MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
   _has_work = true;
   Service_lock->notify_all();
 }
--- a/src/hotspot/share/prims/whitebox.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/prims/whitebox.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -817,7 +817,7 @@
 WB_END
 
 WB_ENTRY(void, WB_DeoptimizeAll(JNIEnv* env, jobject o))
-  MutexLockerEx mu(Compile_lock);
+  MutexLocker mu(Compile_lock);
   CodeCache::mark_all_nmethods_for_deoptimization();
   VM_Deoptimize op;
   VMThread::execute(&op);
@@ -827,7 +827,7 @@
   jmethodID jmid = reflected_method_to_jmid(thread, env, method);
   int result = 0;
   CHECK_JNI_EXCEPTION_(env, result);
-  MutexLockerEx mu(Compile_lock);
+  MutexLocker mu(Compile_lock);
   methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
   if (is_osr) {
     result += mh->mark_osr_nmethods();
@@ -846,7 +846,7 @@
 WB_ENTRY(jboolean, WB_IsMethodCompiled(JNIEnv* env, jobject o, jobject method, jboolean is_osr))
   jmethodID jmid = reflected_method_to_jmid(thread, env, method);
   CHECK_JNI_EXCEPTION_(env, JNI_FALSE);
-  MutexLockerEx mu(Compile_lock);
+  MutexLocker mu(Compile_lock);
   methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
   CompiledMethod* code = is_osr ? mh->lookup_osr_nmethod_for(InvocationEntryBci, CompLevel_none, false) : mh->code();
   if (code == NULL) {
@@ -861,7 +861,7 @@
   }
   jmethodID jmid = reflected_method_to_jmid(thread, env, method);
   CHECK_JNI_EXCEPTION_(env, JNI_FALSE);
-  MutexLockerEx mu(Compile_lock);
+  MutexLocker mu(Compile_lock);
   methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
   if (is_osr) {
     return CompilationPolicy::can_be_osr_compiled(mh, comp_level);
@@ -873,7 +873,7 @@
 WB_ENTRY(jboolean, WB_IsMethodQueuedForCompilation(JNIEnv* env, jobject o, jobject method))
   jmethodID jmid = reflected_method_to_jmid(thread, env, method);
   CHECK_JNI_EXCEPTION_(env, JNI_FALSE);
-  MutexLockerEx mu(Compile_lock);
+  MutexLocker mu(Compile_lock);
   methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
   return mh->queued_for_compilation();
 WB_END
@@ -982,7 +982,7 @@
 
   // Compile method and check result
   nmethod* nm = CompileBroker::compile_method(mh, bci, comp_level, mh, mh->invocation_count(), CompileTask::Reason_Whitebox, THREAD);
-  MutexLockerEx mu(Compile_lock);
+  MutexLocker mu(Compile_lock);
   bool is_queued = mh->queued_for_compilation();
   if ((!is_blocking && is_queued) || nm != NULL) {
     return true;
@@ -1082,7 +1082,7 @@
   jmethodID jmid = reflected_method_to_jmid(thread, env, method);
   CHECK_JNI_EXCEPTION(env);
   methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
-  MutexLockerEx mu(Compile_lock);
+  MutexLocker mu(Compile_lock);
   MethodData* mdo = mh->method_data();
   MethodCounters* mcs = mh->method_counters();
 
@@ -1093,7 +1093,7 @@
     for (int i = 0; i < arg_count; i++) {
       mdo->set_arg_modified(i, 0);
     }
-    MutexLockerEx mu(mdo->extra_data_lock());
+    MutexLocker mu(mdo->extra_data_lock());
     mdo->clean_method_data(/*always_clean*/true);
   }
 
@@ -1342,7 +1342,7 @@
 WB_END
 
 WB_ENTRY(void, WB_UnlockCompilation(JNIEnv* env, jobject o))
-  MonitorLockerEx mo(Compilation_lock, Mutex::_no_safepoint_check_flag);
+  MonitorLocker mo(Compilation_lock, Mutex::_no_safepoint_check_flag);
   WhiteBox::compilation_locked = false;
   mo.notify_all();
 WB_END
@@ -1502,7 +1502,7 @@
     full_size += align_up(size - full_size, oopSize);
   }
   {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     blob = (BufferBlob*) CodeCache::allocate(full_size, blob_type);
     if (blob != NULL) {
       ::new (blob) BufferBlob("WB::DummyBlob", full_size);
@@ -1532,7 +1532,7 @@
   ResourceMark rm;
   GrowableArray<CodeBlobStub*> blobs;
   {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     CodeHeap* heap = WhiteBox::get_code_heap(blob_type);
     if (heap == NULL) {
       return NULL;
@@ -1718,8 +1718,11 @@
   Monitor::SafepointCheckRequired sfpt_check_required = mutexSafepointValue ?
                                            Monitor::_safepoint_check_always :
                                            Monitor::_safepoint_check_never;
-  MutexLockerEx ml(new Mutex(Mutex::leaf, "SFPT_Test_lock", true, sfpt_check_required),
-                   attemptedNoSafepointValue == JNI_TRUE);
+  Monitor::SafepointCheckFlag sfpt_check_attempted = attemptedNoSafepointValue ?
+                                           Monitor::_no_safepoint_check_flag :
+                                           Monitor::_safepoint_check_flag;
+  MutexLocker ml(new Mutex(Mutex::leaf, "SFPT_Test_lock", true, sfpt_check_required),
+                 sfpt_check_attempted);
 WB_END
 
 WB_ENTRY(jboolean, WB_IsMonitorInflated(JNIEnv* env, jobject wb, jobject obj))
--- a/src/hotspot/share/runtime/handshake.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/runtime/handshake.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -137,7 +137,7 @@
       // There is an assumption in the code that the Threads_lock should be
       // locked during certain phases.
       {
-        MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag);
+        MutexLocker ml(Threads_lock, Mutex::_no_safepoint_check_flag);
         _target->handshake_process_by_vmthread();
       }
     } while (!poll_for_completed_thread());
@@ -186,7 +186,7 @@
           // There is an assumption in the code that the Threads_lock should
           // be locked during certain phases.
           jtiwh.rewind();
-          MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag);
+          MutexLocker ml(Threads_lock, Mutex::_no_safepoint_check_flag);
           for (JavaThread *thr = jtiwh.next(); thr != NULL; thr = jtiwh.next()) {
             // A new thread on the ThreadsList will not have an operation,
             // hence it is skipped in handshake_process_by_vmthread.
--- a/src/hotspot/share/runtime/init.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/runtime/init.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -191,15 +191,15 @@
 }
 
 void wait_init_completed() {
-  MonitorLockerEx ml(InitCompleted_lock, Monitor::_no_safepoint_check_flag);
+  MonitorLocker ml(InitCompleted_lock, Monitor::_no_safepoint_check_flag);
   while (!_init_completed) {
-    ml.wait(Monitor::_no_safepoint_check_flag);
+    ml.wait();
   }
 }
 
 void set_init_completed() {
   assert(Universe::is_fully_initialized(), "Should have completed initialization");
-  MonitorLockerEx ml(InitCompleted_lock, Monitor::_no_safepoint_check_flag);
+  MonitorLocker ml(InitCompleted_lock, Monitor::_no_safepoint_check_flag);
   OrderAccess::release_store(&_init_completed, true);
   ml.notify_all();
 }
--- a/src/hotspot/share/runtime/java.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/runtime/java.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -302,7 +302,7 @@
   }
 
   if (PrintCodeCache) {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     CodeCache::print();
   }
 
@@ -315,7 +315,7 @@
   }
 
   if (PrintCodeCache2) {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     CodeCache::print_internals();
   }
 
@@ -370,7 +370,7 @@
   }
 
   if (PrintCodeCache) {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     CodeCache::print();
   }
 
--- a/src/hotspot/share/runtime/jniHandles.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/runtime/jniHandles.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, 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
@@ -371,8 +371,8 @@
     // - we would hold JNIHandleBlockFreeList_lock and then Threads_lock
     // - another would hold Threads_lock (jni_AttachCurrentThread) and then
     //   JNIHandleBlockFreeList_lock (JNIHandleBlock::allocate_block)
-    MutexLockerEx ml(JNIHandleBlockFreeList_lock,
-                     Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(JNIHandleBlockFreeList_lock,
+                   Mutex::_no_safepoint_check_flag);
     if (_block_free_list == NULL) {
       // Allocate new block
       block = new JNIHandleBlock();
@@ -427,8 +427,8 @@
     // - we would hold JNIHandleBlockFreeList_lock and then Threads_lock
     // - another would hold Threads_lock (jni_AttachCurrentThread) and then
     //   JNIHandleBlockFreeList_lock (JNIHandleBlock::allocate_block)
-    MutexLockerEx ml(JNIHandleBlockFreeList_lock,
-                     Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(JNIHandleBlockFreeList_lock,
+                   Mutex::_no_safepoint_check_flag);
     while (block != NULL) {
       block->zap();
       JNIHandleBlock* next = block->_next;
--- a/src/hotspot/share/runtime/mutex.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/runtime/mutex.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -140,12 +140,22 @@
   _lock.notify_all();
 }
 
-bool Monitor::wait(bool no_safepoint_check, long timeout,
-                   bool as_suspend_equivalent) {
+#ifdef ASSERT
+void Monitor::assert_wait_lock_state(Thread* self) {
+  Monitor* least = get_least_ranked_lock_besides_this(self->owned_locks());
+  assert(least != this, "Specification of get_least_... call above");
+  if (least != NULL && least->rank() <= special) {
+    ::tty->print("Attempting to wait on monitor %s/%d while holding"
+               " lock %s/%d -- possible deadlock",
+               name(), rank(), least->name(), least->rank());
+    assert(false, "Shouldn't block(wait) while holding a lock of rank special");
+  }
+}
+#endif // ASSERT
+
+bool Monitor::wait_without_safepoint_check(long timeout) {
   // Make sure safepoint checking is used properly.
-  assert(!(_safepoint_check_required == Monitor::_safepoint_check_never && no_safepoint_check == false),
-         "This lock should never have a safepoint check: %s", name());
-  assert(!(_safepoint_check_required == Monitor::_safepoint_check_always && no_safepoint_check == true),
+  assert(_safepoint_check_required != Monitor::_safepoint_check_always,
          "This lock should always have a safepoint check: %s", name());
 
   // timeout is in milliseconds - with zero meaning never timeout
@@ -153,75 +163,76 @@
 
   Thread * const self = Thread::current();
   assert_owner(self);
+  assert_wait_lock_state(self);
 
-  // as_suspend_equivalent logically implies !no_safepoint_check
-  guarantee(!as_suspend_equivalent || !no_safepoint_check, "invariant");
-  // !no_safepoint_check logically implies java_thread
-  guarantee(no_safepoint_check || self->is_Java_thread(), "invariant");
+  // conceptually set the owner to NULL in anticipation of
+  // abdicating the lock in wait
+  set_owner(NULL);
+  int wait_status = _lock.wait(timeout);
+  set_owner(self);
+  return wait_status != 0;          // return true IFF timeout
+}
 
-#ifdef ASSERT
-  Monitor * least = get_least_ranked_lock_besides_this(self->owned_locks());
-  assert(least != this, "Specification of get_least_... call above");
-  if (least != NULL && least->rank() <= special) {
-    ::tty->print("Attempting to wait on monitor %s/%d while holding"
-               " lock %s/%d -- possible deadlock",
-               name(), rank(), least->name(), least->rank());
-    assert(false, "Shouldn't block(wait) while holding a lock of rank special");
-  }
-#endif // ASSERT
+bool Monitor::wait(long timeout, bool as_suspend_equivalent) {
+  // Make sure safepoint checking is used properly.
+  assert(_safepoint_check_required != Monitor::_safepoint_check_never,
+         "This lock should never have a safepoint check: %s", name());
+
+  // timeout is in milliseconds - with zero meaning never timeout
+  assert(timeout >= 0, "negative timeout");
+
+  Thread* const self = Thread::current();
+  assert_owner(self);
+
+  // Safepoint checking logically implies java_thread
+  guarantee(self->is_Java_thread(), "invariant");
+  assert_wait_lock_state(self);
 
 #ifdef CHECK_UNHANDLED_OOPS
   // Clear unhandled oops in JavaThreads so we get a crash right away.
-  if (self->is_Java_thread() && !no_safepoint_check) {
-    self->clear_unhandled_oops();
-  }
+  self->clear_unhandled_oops();
 #endif // CHECK_UNHANDLED_OOPS
 
   int wait_status;
   // conceptually set the owner to NULL in anticipation of
   // abdicating the lock in wait
   set_owner(NULL);
-  if (no_safepoint_check) {
+  JavaThread *jt = (JavaThread *)self;
+  Monitor* in_flight_monitor = NULL;
+
+  {
+    ThreadBlockInVMWithDeadlockCheck tbivmdc(jt, &in_flight_monitor);
+    OSThreadWaitState osts(self->osthread(), false /* not Object.wait() */);
+    if (as_suspend_equivalent) {
+      jt->set_suspend_equivalent();
+      // cleared by handle_special_suspend_equivalent_condition() or
+      // java_suspend_self()
+    }
+
     wait_status = _lock.wait(timeout);
+    in_flight_monitor = this;  // save for ~ThreadBlockInVMWithDeadlockCheck
+
+    // were we externally suspended while we were waiting?
+    if (as_suspend_equivalent && jt->handle_special_suspend_equivalent_condition()) {
+      // Our event wait has finished and we own the lock, but
+      // while we were waiting another thread suspended us. We don't
+      // want to hold the lock while suspended because that
+      // would surprise the thread that suspended us.
+      _lock.unlock();
+      jt->java_suspend_self();
+      _lock.lock();
+    }
+  }
+
+  if (in_flight_monitor != NULL) {
+    // Not unlocked by ~ThreadBlockInVMWithDeadlockCheck
+    assert_owner(NULL);
+    // Conceptually reestablish ownership of the lock.
     set_owner(self);
   } else {
-    assert(self->is_Java_thread(), "invariant");
-    JavaThread *jt = (JavaThread *)self;
-    Monitor* in_flight_monitor = NULL;
+    lock(self);
+  }
 
-    {
-      ThreadBlockInVMWithDeadlockCheck tbivmdc(jt, &in_flight_monitor);
-      OSThreadWaitState osts(self->osthread(), false /* not Object.wait() */);
-      if (as_suspend_equivalent) {
-        jt->set_suspend_equivalent();
-        // cleared by handle_special_suspend_equivalent_condition() or
-        // java_suspend_self()
-      }
-
-      wait_status = _lock.wait(timeout);
-      in_flight_monitor = this;  // save for ~ThreadBlockInVMWithDeadlockCheck
-
-      // were we externally suspended while we were waiting?
-      if (as_suspend_equivalent && jt->handle_special_suspend_equivalent_condition()) {
-        // Our event wait has finished and we own the lock, but
-        // while we were waiting another thread suspended us. We don't
-        // want to hold the lock while suspended because that
-        // would surprise the thread that suspended us.
-        _lock.unlock();
-        jt->java_suspend_self();
-        _lock.lock();
-      }
-    }
-
-    if (in_flight_monitor != NULL) {
-      // Not unlocked by ~ThreadBlockInVMWithDeadlockCheck
-      assert_owner(NULL);
-      // Conceptually reestablish ownership of the lock.
-      set_owner(self);
-    } else {
-      lock(self);
-    }
-  }
   return wait_status != 0;          // return true IFF timeout
 }
 
--- a/src/hotspot/share/runtime/mutex.hpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/runtime/mutex.hpp	Thu Apr 25 10:56:31 2019 -0400
@@ -93,14 +93,19 @@
   void check_prelock_state     (Thread* thread, bool safepoint_check) PRODUCT_RETURN;
   void check_block_state       (Thread* thread)                       PRODUCT_RETURN;
   void assert_owner            (Thread* expected)                     NOT_DEBUG_RETURN;
+  void assert_wait_lock_state  (Thread* self)                         NOT_DEBUG_RETURN;
 
  public:
   enum {
-    _no_safepoint_check_flag    = true,
     _allow_vm_block_flag        = true,
     _as_suspend_equivalent_flag = true
   };
 
+  enum SafepointCheckFlag {
+    _safepoint_check_flag,
+    _no_safepoint_check_flag
+  };
+
   // Locks can be acquired with or without safepoint check.
   // Monitor::lock and Monitor::lock_without_safepoint_check
   // checks these flags when acquiring a lock to ensure
@@ -135,9 +140,9 @@
   // Defaults are to make safepoint checks, wait time is forever (i.e.,
   // zero), and not a suspend-equivalent condition. Returns true if wait
   // times out; otherwise returns false.
-  bool wait(bool no_safepoint_check = !_no_safepoint_check_flag,
-            long timeout = 0,
+  bool wait(long timeout = 0,
             bool as_suspend_equivalent = !_as_suspend_equivalent_flag);
+  bool wait_without_safepoint_check(long timeout = 0);
   void notify();
   void notify_all();
 
@@ -220,21 +225,19 @@
 // An even better alternative is to simply eliminate Mutex:: and use Monitor:: instead.
 // After all, monitors are sufficient for Java-level synchronization.   At one point in time
 // there may have been some benefit to having distinct mutexes and monitors, but that time
-// has past.
+// has passed.
 //
 
 class Mutex : public Monitor {      // degenerate Monitor
  public:
    Mutex(int rank, const char *name, bool allow_vm_block = false,
          SafepointCheckRequired safepoint_check_required = _safepoint_check_always);
-  // default destructor
+   // default destructor
  private:
-   void notify ()    { ShouldNotReachHere(); }
-   void notify_all() { ShouldNotReachHere(); }
-   bool wait (bool no_safepoint_check, long timeout, bool as_suspend_equivalent) {
-     ShouldNotReachHere() ;
-     return false ;
-   }
+   void notify();
+   void notify_all();
+   bool wait(long timeout, bool as_suspend_equivalent);
+   bool wait_without_safepoint_check(long timeout);
 };
 
 class PaddedMutex : public Mutex {
--- a/src/hotspot/share/runtime/mutexLocker.hpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/runtime/mutexLocker.hpp	Thu Apr 25 10:56:31 2019 -0400
@@ -62,7 +62,7 @@
 extern Mutex*   SymbolArena_lock;                // a lock on the symbol table arena
 extern Monitor* StringDedupQueue_lock;           // a lock on the string deduplication queue
 extern Mutex*   StringDedupTable_lock;           // a lock on the string deduplication table
-extern Monitor* CodeCache_lock;                  // a lock on the CodeCache, rank is special, use MutexLockerEx
+extern Monitor* CodeCache_lock;                  // a lock on the CodeCache, rank is special
 extern Mutex*   MethodData_lock;                 // a lock on installation of method data
 extern Mutex*   TouchedMethodLog_lock;           // a lock on allocation of LogExecutedMethods info
 extern Mutex*   RetData_lock;                    // a lock on installation of RetData inside method data
@@ -175,31 +175,6 @@
 
 char *lock_name(Mutex *mutex);
 
-class MutexLocker: StackObj {
- private:
-  Monitor * _mutex;
- public:
-  MutexLocker(Monitor * mutex) {
-    assert(mutex->rank() != Mutex::special,
-      "Special ranked mutex should only use MutexLockerEx");
-    _mutex = mutex;
-    _mutex->lock();
-  }
-
-  // Overloaded constructor passing current thread
-  MutexLocker(Monitor * mutex, Thread *thread) {
-    assert(mutex->rank() != Mutex::special,
-      "Special ranked mutex should only use MutexLockerEx");
-    _mutex = mutex;
-    _mutex->lock(thread);
-  }
-
-  ~MutexLocker() {
-    _mutex->unlock();
-  }
-
-};
-
 // for debugging: check that we're already owning this lock (or are at a safepoint)
 #ifdef ASSERT
 void assert_locked_or_safepoint(const Monitor * lock);
@@ -211,84 +186,89 @@
 #define assert_lock_strong(lock)
 #endif
 
-// A MutexLockerEx behaves like a MutexLocker when its constructor is
-// called with a Mutex.  Unlike a MutexLocker, its constructor can also be
-// called with NULL, in which case the MutexLockerEx is a no-op.  There
-// is also a corresponding MutexUnlockerEx.  We want to keep the
-// basic MutexLocker as fast as possible.  MutexLockerEx can also lock
-// without safepoint check.
-
-class MutexLockerEx: public StackObj {
+class MutexLocker: public StackObj {
+ protected:
+  Monitor* _mutex;
  private:
-  Monitor * _mutex;
  public:
-  MutexLockerEx(Monitor * mutex, bool no_safepoint_check = !Mutex::_no_safepoint_check_flag) {
-    _mutex = mutex;
+  MutexLocker(Monitor* mutex, Mutex::SafepointCheckFlag flag = Mutex::_safepoint_check_flag) :
+    _mutex(mutex) {
+    bool no_safepoint_check = flag == Mutex::_no_safepoint_check_flag;
     if (_mutex != NULL) {
-      assert(mutex->rank() > Mutex::special || no_safepoint_check,
-        "Mutexes with rank special or lower should not do safepoint checks");
-      if (no_safepoint_check)
+      assert(_mutex->rank() > Mutex::special || no_safepoint_check,
+             "Mutexes with rank special or lower should not do safepoint checks");
+      if (no_safepoint_check) {
         _mutex->lock_without_safepoint_check();
-      else
+      } else {
         _mutex->lock();
+      }
     }
   }
 
-  ~MutexLockerEx() {
+  MutexLocker(Monitor* mutex, Thread* thread, Mutex::SafepointCheckFlag flag = Mutex::_safepoint_check_flag) :
+    _mutex(mutex) {
+    bool no_safepoint_check = flag == Mutex::_no_safepoint_check_flag;
     if (_mutex != NULL) {
+      assert(_mutex->rank() > Mutex::special || no_safepoint_check,
+             "Mutexes with rank special or lower should not do safepoint checks");
+      if (no_safepoint_check) {
+        _mutex->lock_without_safepoint_check(thread);
+      } else {
+        _mutex->lock(thread);
+      }
+    }
+  }
+
+  ~MutexLocker() {
+    if (_mutex != NULL) {
+      assert_lock_strong(_mutex);
       _mutex->unlock();
     }
   }
 };
 
-// A MonitorLockerEx is like a MutexLockerEx above, except it takes
-// a possibly null Monitor, and allows wait/notify as well which are
-// delegated to the underlying Monitor.
+// A MonitorLocker is like a MutexLocker above, except it allows
+// wait/notify as well which are delegated to the underlying Monitor.
 
-class MonitorLockerEx: public MutexLockerEx {
- private:
-  Monitor * _monitor;
+class MonitorLocker: public MutexLocker {
+  Mutex::SafepointCheckFlag _flag;
  public:
-  MonitorLockerEx(Monitor* monitor,
-                  bool no_safepoint_check = !Mutex::_no_safepoint_check_flag):
-    MutexLockerEx(monitor, no_safepoint_check),
-    _monitor(monitor) {
+  MonitorLocker(Monitor* monitor, Mutex::SafepointCheckFlag flag = Mutex::_safepoint_check_flag) :
+    MutexLocker(monitor, flag), _flag(flag) {
     // Superclass constructor did locking
   }
 
-  ~MonitorLockerEx() {
-    #ifdef ASSERT
-      if (_monitor != NULL) {
-        assert_lock_strong(_monitor);
-      }
-    #endif  // ASSERT
-    // Superclass destructor will do unlocking
+  MonitorLocker(Monitor* monitor, Thread* thread, Mutex::SafepointCheckFlag flag = Mutex::_safepoint_check_flag) :
+    MutexLocker(monitor, thread, flag), _flag(flag)  {
+    // Superclass constructor did locking
   }
 
-  bool wait(bool no_safepoint_check = !Mutex::_no_safepoint_check_flag,
-            long timeout = 0,
+  bool wait(long timeout = 0,
             bool as_suspend_equivalent = !Mutex::_as_suspend_equivalent_flag) {
-    if (_monitor != NULL) {
-      return _monitor->wait(no_safepoint_check, timeout, as_suspend_equivalent);
+    if (_mutex != NULL) {
+      if (_flag == Mutex::_safepoint_check_flag) {
+        return _mutex->wait(timeout, as_suspend_equivalent);
+      } else {
+        return _mutex->wait_without_safepoint_check(timeout);
+      }
     }
     return false;
   }
 
   void notify_all() {
-    if (_monitor != NULL) {
-      _monitor->notify_all();
+    if (_mutex != NULL) {
+      _mutex->notify_all();
     }
   }
 
   void notify() {
-    if (_monitor != NULL) {
-      _monitor->notify();
+    if (_mutex != NULL) {
+      _mutex->notify();
     }
   }
 };
 
 
-
 // A GCMutexLocker is usually initialized with a mutex that is
 // automatically acquired in order to do GC.  The function that
 // synchronizes using a GCMutexLocker may be called both during and between
@@ -297,50 +277,30 @@
 
 class GCMutexLocker: public StackObj {
 private:
-  Monitor * _mutex;
+  Monitor* _mutex;
   bool _locked;
 public:
-  GCMutexLocker(Monitor * mutex);
+  GCMutexLocker(Monitor* mutex);
   ~GCMutexLocker() { if (_locked) _mutex->unlock(); }
 };
 
-
-
 // A MutexUnlocker temporarily exits a previously
 // entered mutex for the scope which contains the unlocker.
 
 class MutexUnlocker: StackObj {
  private:
-  Monitor * _mutex;
+  Monitor* _mutex;
+  bool _no_safepoint_check;
 
  public:
-  MutexUnlocker(Monitor * mutex) {
-    _mutex = mutex;
+  MutexUnlocker(Monitor* mutex, Mutex::SafepointCheckFlag flag = Mutex::_safepoint_check_flag) :
+    _mutex(mutex),
+    _no_safepoint_check(flag) {
     _mutex->unlock();
   }
 
   ~MutexUnlocker() {
-    _mutex->lock();
-  }
-};
-
-// A MutexUnlockerEx temporarily exits a previously
-// entered mutex for the scope which contains the unlocker.
-
-class MutexUnlockerEx: StackObj {
- private:
-  Monitor * _mutex;
-  bool _no_safepoint_check;
-
- public:
-  MutexUnlockerEx(Monitor * mutex, bool no_safepoint_check = !Mutex::_no_safepoint_check_flag) {
-    _mutex = mutex;
-    _no_safepoint_check = no_safepoint_check;
-    _mutex->unlock();
-  }
-
-  ~MutexUnlockerEx() {
-    if (_no_safepoint_check == Mutex::_no_safepoint_check_flag) {
+    if (_no_safepoint_check) {
       _mutex->lock_without_safepoint_check();
     } else {
       _mutex->lock();
--- a/src/hotspot/share/runtime/os.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/runtime/os.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -858,7 +858,7 @@
 
 void os::start_thread(Thread* thread) {
   // guard suspend/resume
-  MutexLockerEx ml(thread->SR_lock(), Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(thread->SR_lock(), Mutex::_no_safepoint_check_flag);
   OSThread* osthread = thread->osthread();
   osthread->set_state(RUNNABLE);
   pd_start_thread(thread);
--- a/src/hotspot/share/runtime/serviceThread.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/runtime/serviceThread.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -138,7 +138,7 @@
 
       ThreadBlockInVM tbivm(jt);
 
-      MonitorLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
+      MonitorLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
       // Process all available work on each (outer) iteration, rather than
       // only the first recognized bit of work, to avoid frequently true early
       // tests from potentially starving later work.  Hence the use of
@@ -157,7 +157,7 @@
 
              == 0) {
         // Wait until notified that there is some work to do.
-        ml.wait(Mutex::_no_safepoint_check_flag);
+        ml.wait();
       }
 
       if (has_jvmti_events) {
--- a/src/hotspot/share/runtime/sharedRuntime.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/runtime/sharedRuntime.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -2256,7 +2256,7 @@
 
  public:
   MethodArityHistogram() {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     _max_arity = _max_size = 0;
     for (int i = 0; i < MAX_ARITY; i++) _arity_histogram[i] = _size_histogram[i] = 0;
     CodeCache::nmethods_do(add_method_to_histogram);
--- a/src/hotspot/share/runtime/sweeper.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/runtime/sweeper.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -322,7 +322,7 @@
     if (ThreadLocalHandshakes) {
       CodeBlobClosure* code_cl;
       {
-        MutexLockerEx ccl(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+        MutexLocker ccl(CodeCache_lock, Mutex::_no_safepoint_check_flag);
         code_cl = prepare_mark_active_nmethods();
       }
       if (code_cl != NULL) {
@@ -341,9 +341,9 @@
   while (true) {
     {
       ThreadBlockInVM tbivm(JavaThread::current());
-      MutexLockerEx waiter(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+      MutexLocker waiter(CodeCache_lock, Mutex::_no_safepoint_check_flag);
       const long wait_time = 60*60*24 * 1000;
-      timeout = CodeCache_lock->wait(Mutex::_no_safepoint_check_flag, wait_time);
+      timeout = CodeCache_lock->wait_without_safepoint_check(wait_time);
     }
     if (!timeout) {
       possibly_sweep();
@@ -369,7 +369,7 @@
   */
 void NMethodSweeper::force_sweep() {
   ThreadBlockInVM tbivm(JavaThread::current());
-  MutexLockerEx waiter(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker waiter(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   // Request forced sweep
   _force_sweep = true;
   while (_force_sweep) {
@@ -377,7 +377,7 @@
     // In case a sweep currently takes place we timeout and try again because
     // we want to enforce a full sweep.
     CodeCache_lock->notify();
-    CodeCache_lock->wait(Mutex::_no_safepoint_check_flag, 1000);
+    CodeCache_lock->wait_without_safepoint_check(1000);
   }
 }
 
@@ -390,7 +390,7 @@
     if (PrintMethodFlushing && Verbose) {
       tty->print_cr("### Sweep at %d out of %d, yielding to safepoint", _seen, CodeCache::nmethod_count());
     }
-    MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexUnlocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 
     ThreadBlockInVM tbivm(thread);
     thread->java_suspend_self();
@@ -475,7 +475,7 @@
   if (forced) {
     // Notify requester that forced sweep finished
     assert(_force_sweep, "Should be a forced sweep");
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     _force_sweep = false;
     CodeCache_lock->notify();
   }
@@ -519,7 +519,7 @@
 
   int freed_memory = 0;
   {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 
     while (!_current.end()) {
       swept_count++;
@@ -531,7 +531,7 @@
 
       // Now ready to process nmethod and give up CodeCache_lock
       {
-        MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+        MutexUnlocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
         // Save information before potentially flushing the nmethod
         // Only flushing nmethods so size only matters for them.
         int size = nm->is_nmethod() ? ((nmethod*)nm)->total_size() : 0;
@@ -576,7 +576,7 @@
   const Ticks sweep_end_counter = Ticks::now();
   const Tickspan sweep_time = sweep_end_counter - sweep_start_counter;
   {
-    MutexLockerEx mu(NMethodSweeperStats_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(NMethodSweeperStats_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);
--- a/src/hotspot/share/runtime/task.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/runtime/task.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -37,7 +37,7 @@
 
   // The WatcherThread does not participate in the safepoint protocol
   // for the PeriodicTask_lock because it is not a JavaThread.
-  MutexLockerEx ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
   int orig_num_tasks = _num_tasks;
 
   for(int index = 0; index < _num_tasks; index++) {
@@ -84,8 +84,7 @@
   // not already own the PeriodicTask_lock. Otherwise, we don't try to
   // enter it again because VM internal Mutexes do not support recursion.
   //
-  MutexLockerEx ml(PeriodicTask_lock->owned_by_self() ? NULL
-                                                      : PeriodicTask_lock);
+  MutexLocker ml(PeriodicTask_lock->owned_by_self() ? NULL : PeriodicTask_lock);
 
   if (_num_tasks == PeriodicTask::max_tasks) {
     fatal("Overflow in PeriodicTask table");
@@ -107,8 +106,7 @@
   // not already own the PeriodicTask_lock. Otherwise, we don't try to
   // enter it again because VM internal Mutexes do not support recursion.
   //
-  MutexLockerEx ml(PeriodicTask_lock->owned_by_self() ? NULL
-                                                      : PeriodicTask_lock);
+  MutexLocker ml(PeriodicTask_lock->owned_by_self() ? NULL : PeriodicTask_lock);
 
   int index;
   for(index = 0; index < _num_tasks && _tasks[index] != this; index++)
--- a/src/hotspot/share/runtime/thread.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/runtime/thread.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -718,7 +718,11 @@
         // temporarily drops SR_lock while doing wait with safepoint check
         // (if we're a JavaThread - the WatcherThread can also call this)
         // and increase delay with each retry
-        SR_lock()->wait(!Thread::current()->is_Java_thread(), i * delay);
+        if (Thread::current()->is_Java_thread()) {
+          SR_lock()->wait(i * delay);
+        } else {
+          SR_lock()->wait_without_safepoint_check(i * delay);
+        }
 
         // check the actual thread state instead of what we saved above
         if (thread_state() != _thread_in_native_trans) {
@@ -759,7 +763,7 @@
   reset_bits = *bits;
 
   {
-    MutexLockerEx ml(SR_lock(), Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(SR_lock(), Mutex::_no_safepoint_check_flag);
     is_suspended = is_ext_suspend_completed(true /* called_by_wait */,
                                             delay, bits);
     pending = is_external_suspend();
@@ -793,7 +797,11 @@
       MutexLocker ml(SR_lock());
       // wait with safepoint check (if we're a JavaThread - the WatcherThread
       // can also call this)  and increase delay with each retry
-      SR_lock()->wait(!Thread::current()->is_Java_thread(), i * delay);
+      if (Thread::current()->is_Java_thread()) {
+        SR_lock()->wait(i * delay);
+      } else {
+        SR_lock()->wait_without_safepoint_check(i * delay);
+      }
 
       is_suspended = is_ext_suspend_completed(true /* called_by_wait */,
                                               delay, bits);
@@ -1289,7 +1297,7 @@
 NonJavaThread::~NonJavaThread() { }
 
 void NonJavaThread::add_to_the_list() {
-  MutexLockerEx ml(NonJavaThreadsList_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(NonJavaThreadsList_lock, Mutex::_no_safepoint_check_flag);
   // Initialize BarrierSet-related data before adding to list.
   BarrierSet::barrier_set()->on_thread_attach(this);
   OrderAccess::release_store(&_next, _the_list._head);
@@ -1298,7 +1306,7 @@
 
 void NonJavaThread::remove_from_the_list() {
   {
-    MutexLockerEx ml(NonJavaThreadsList_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(NonJavaThreadsList_lock, Mutex::_no_safepoint_check_flag);
     // Cleanup BarrierSet-related data before removing from list.
     BarrierSet::barrier_set()->on_thread_detach(this);
     NonJavaThread* volatile* p = &_the_list._head;
@@ -1312,7 +1320,7 @@
   // Wait for any in-progress iterators.  Concurrent synchronize is not
   // allowed, so do it while holding a dedicated lock.  Outside and distinct
   // from NJTList_lock in case an iteration attempts to lock it.
-  MutexLockerEx ml(NonJavaThreadsListSync_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(NonJavaThreadsListSync_lock, Mutex::_no_safepoint_check_flag);
   _the_list._protect.synchronize();
   _next = NULL;                 // Safe to drop the link now.
 }
@@ -1397,7 +1405,7 @@
 int WatcherThread::sleep() const {
   // The WatcherThread does not participate in the safepoint protocol
   // for the PeriodicTask_lock because it is not a JavaThread.
-  MutexLockerEx ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
 
   if (_should_terminate) {
     // check for termination before we do any housekeeping or wait
@@ -1417,8 +1425,7 @@
   jlong time_before_loop = os::javaTimeNanos();
 
   while (true) {
-    bool timedout = PeriodicTask_lock->wait(Mutex::_no_safepoint_check_flag,
-                                            remaining);
+    bool timedout = PeriodicTask_lock->wait_without_safepoint_check(remaining);
     jlong now = os::javaTimeNanos();
 
     if (remaining == 0) {
@@ -1506,7 +1513,7 @@
 
   // Signal that it is terminated
   {
-    MutexLockerEx mu(Terminator_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker mu(Terminator_lock, Mutex::_no_safepoint_check_flag);
     _watcher_thread = NULL;
     Terminator_lock->notify_all();
   }
@@ -1546,8 +1553,7 @@
   while (watcher_thread() != NULL) {
     // This wait should make safepoint checks, wait without a timeout,
     // and wait as a suspend-equivalent condition.
-    Terminator_lock->wait(!Mutex::_no_safepoint_check_flag, 0,
-                          Mutex::_as_suspend_equivalent_flag);
+    Terminator_lock->wait(0, Mutex::_as_suspend_equivalent_flag);
   }
 }
 
@@ -1990,7 +1996,7 @@
     // in order to not surprise the thread that made the suspend request.
     while (true) {
       {
-        MutexLockerEx ml(SR_lock(), Mutex::_no_safepoint_check_flag);
+        MutexLocker ml(SR_lock(), Mutex::_no_safepoint_check_flag);
         if (!is_external_suspend()) {
           set_terminated(_thread_exiting);
           ThreadService::current_thread_exiting(this, is_daemon(threadObj()));
@@ -2359,7 +2365,7 @@
     return;
   }
 
-  { MutexLockerEx ml(SR_lock(), Mutex::_no_safepoint_check_flag);
+  { MutexLocker ml(SR_lock(), Mutex::_no_safepoint_check_flag);
     if (!is_external_suspend()) {
       // a racing resume has cancelled us; bail out now
       return;
@@ -2418,7 +2424,7 @@
          (is_Java_thread() && !((JavaThread*)this)->has_last_Java_frame()),
          "must have walkable stack");
 
-  MutexLockerEx ml(SR_lock(), Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(SR_lock(), Mutex::_no_safepoint_check_flag);
 
   assert(!this->is_ext_suspended(),
          "a thread trying to self-suspend should not already be suspended");
@@ -2446,7 +2452,7 @@
 
     // _ext_suspended flag is cleared by java_resume()
     while (is_ext_suspended()) {
-      this->SR_lock()->wait(Mutex::_no_safepoint_check_flag);
+      this->SR_lock()->wait_without_safepoint_check();
     }
   }
   return ret;
@@ -2588,7 +2594,7 @@
     return;
   }
 
-  MutexLockerEx ml(SR_lock(), Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(SR_lock(), Mutex::_no_safepoint_check_flag);
 
   clear_external_suspend();
 
@@ -4338,8 +4344,7 @@
     while (Threads::number_of_non_daemon_threads() > 1)
       // This wait should make safepoint checks, wait without a timeout,
       // and wait as a suspend-equivalent condition.
-      Threads_lock->wait(!Mutex::_no_safepoint_check_flag, 0,
-                         Mutex::_as_suspend_equivalent_flag);
+      Threads_lock->wait(0, Mutex::_as_suspend_equivalent_flag);
   }
 
   EventShutdown e;
@@ -4370,7 +4375,7 @@
     // queue until after the vm thread is dead. After this point,
     // we'll never emerge out of the safepoint before the VM exits.
 
-    MutexLockerEx ml(Heap_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(Heap_lock, Mutex::_no_safepoint_check_flag);
 
     VMThread::wait_for_vm_thread_exit();
     assert(SafepointSynchronize::is_at_safepoint(), "VM thread should exit at Safepoint");
--- a/src/hotspot/share/runtime/thread.hpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/runtime/thread.hpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1383,7 +1383,7 @@
 
   bool is_ext_suspend_completed(bool called_by_wait, int delay, uint32_t *bits);
   bool is_ext_suspend_completed_with_lock(uint32_t *bits) {
-    MutexLockerEx ml(SR_lock(), Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(SR_lock(), Mutex::_no_safepoint_check_flag);
     // Warning: is_ext_suspend_completed() may temporarily drop the
     // SR_lock to allow the thread to reach a stable thread state if
     // it is currently in a transient thread state.
@@ -1424,7 +1424,7 @@
   }
 
   bool is_external_suspend_with_lock() const {
-    MutexLockerEx ml(SR_lock(), Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(SR_lock(), Mutex::_no_safepoint_check_flag);
     return is_external_suspend();
   }
 
@@ -1433,7 +1433,7 @@
   bool handle_special_suspend_equivalent_condition() {
     assert(is_suspend_equivalent(),
            "should only be called in a suspend equivalence condition");
-    MutexLockerEx ml(SR_lock(), Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(SR_lock(), Mutex::_no_safepoint_check_flag);
     bool ret = is_external_suspend();
     if (!ret) {
       // not about to self-suspend so clear suspend equivalence
@@ -1450,7 +1450,7 @@
 
   // utility methods to see if we are doing some kind of suspension
   bool is_being_ext_suspended() const            {
-    MutexLockerEx ml(SR_lock(), Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(SR_lock(), Mutex::_no_safepoint_check_flag);
     return is_ext_suspended() || is_external_suspend();
   }
 
--- a/src/hotspot/share/runtime/threadSMR.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/runtime/threadSMR.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -899,7 +899,7 @@
   // safepoint which means this thread can't take too long to get to
   // a safepoint because of being blocked on delete_lock.
   //
-  MonitorLockerEx ml(ThreadsSMRSupport::delete_lock(), Monitor::_no_safepoint_check_flag);
+  MonitorLocker ml(ThreadsSMRSupport::delete_lock(), Monitor::_no_safepoint_check_flag);
   if (ThreadsSMRSupport::delete_notify()) {
     // Notify any exiting JavaThreads that are waiting in smr_delete()
     // that we've released a ThreadsList.
@@ -944,8 +944,8 @@
     {
       // No safepoint check because this JavaThread is not on the
       // Threads list.
-      MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag);
-      // Cannot use a MonitorLockerEx helper here because we have
+      MutexLocker ml(Threads_lock, Mutex::_no_safepoint_check_flag);
+      // Cannot use a MonitorLocker helper here because we have
       // to drop the Threads_lock first if we wait.
       ThreadsSMRSupport::delete_lock()->lock_without_safepoint_check();
       // Set the delete_notify flag after we grab delete_lock
@@ -985,8 +985,7 @@
     // Wait for a release_stable_list() call before we check again. No
     // safepoint check, no timeout, and not as suspend equivalent flag
     // because this JavaThread is not on the Threads list.
-    ThreadsSMRSupport::delete_lock()->wait(Mutex::_no_safepoint_check_flag, 0,
-                                     !Mutex::_as_suspend_equivalent_flag);
+    ThreadsSMRSupport::delete_lock()->wait_without_safepoint_check();
     if (EnableThreadSMRStatistics) {
       _delete_lock_wait_cnt--;
     }
@@ -1078,7 +1077,7 @@
   // block during error reporting or a nested error could leave the
   // Threads_lock held. The classic no win scenario.
   //
-  MutexLockerEx ml((Threads_lock->owned_by_self() || VMError::is_error_reported()) ? NULL : Threads_lock);
+  MutexLocker ml((Threads_lock->owned_by_self() || VMError::is_error_reported()) ? NULL : Threads_lock);
 
   st->print_cr("Threads class SMR info:");
   st->print_cr("_java_thread_list=" INTPTR_FORMAT ", length=%u, "
--- a/src/hotspot/share/runtime/threadSMR.inline.hpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/runtime/threadSMR.inline.hpp	Thu Apr 25 10:56:31 2019 -0400
@@ -82,7 +82,7 @@
 }
 
 inline bool ThreadsSMRSupport::is_a_protected_JavaThread_with_lock(JavaThread *thread) {
-  MutexLockerEx ml(Threads_lock->owned_by_self() ? NULL : Threads_lock);
+  MutexLocker ml(Threads_lock->owned_by_self() ? NULL : Threads_lock);
   return is_a_protected_JavaThread(thread);
 }
 
--- a/src/hotspot/share/runtime/vmOperations.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/runtime/vmOperations.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -450,8 +450,8 @@
 
     attempts++;
 
-    MutexLockerEx ml(&timer, Mutex::_no_safepoint_check_flag);
-    timer.wait(Mutex::_no_safepoint_check_flag, 10);
+    MutexLocker ml(&timer, Mutex::_no_safepoint_check_flag);
+    timer.wait_without_safepoint_check(10);
   }
 }
 
--- a/src/hotspot/share/runtime/vmThread.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/runtime/vmThread.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -342,7 +342,7 @@
     // but before it actually drops the lock and waits, the notification below
     // may get lost and we will have a hang. To avoid this, we need to use
     // Mutex::lock_without_safepoint_check().
-    MutexLockerEx ml(_terminate_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(_terminate_lock, Mutex::_no_safepoint_check_flag);
     _terminated = true;
     _terminate_lock->notify();
   }
@@ -359,7 +359,7 @@
 void VMThread::wait_for_vm_thread_exit() {
   assert(Thread::current()->is_Java_thread(), "Should be a JavaThread");
   assert(((JavaThread*)Thread::current())->is_terminated(), "Should be terminated");
-  { MutexLockerEx mu(VMOperationQueue_lock, Mutex::_no_safepoint_check_flag);
+  { MutexLocker mu(VMOperationQueue_lock, Mutex::_no_safepoint_check_flag);
     _should_terminate = true;
     VMOperationQueue_lock->notify();
   }
@@ -373,9 +373,9 @@
   // Note: it should be OK to use Terminator_lock here. But this is called
   // at a very delicate time (VM shutdown) and we are operating in non- VM
   // thread at Safepoint. It's safer to not share lock with other threads.
-  { MutexLockerEx ml(_terminate_lock, Mutex::_no_safepoint_check_flag);
+  { MutexLocker ml(_terminate_lock, Mutex::_no_safepoint_check_flag);
     while(!VMThread::is_terminated()) {
-        _terminate_lock->wait(Mutex::_no_safepoint_check_flag);
+        _terminate_lock->wait_without_safepoint_check();
     }
   }
 }
@@ -476,8 +476,8 @@
     // Wait for VM operation
     //
     // use no_safepoint_check to get lock without attempting to "sneak"
-    { MutexLockerEx mu_queue(VMOperationQueue_lock,
-                             Mutex::_no_safepoint_check_flag);
+    { MutexLocker mu_queue(VMOperationQueue_lock,
+                           Mutex::_no_safepoint_check_flag);
 
       // Look for new operation
       assert(_cur_vm_operation == NULL, "no current one should be executing");
@@ -494,8 +494,7 @@
       while (!should_terminate() && _cur_vm_operation == NULL) {
         // wait with a timeout to guarantee safepoints at regular intervals
         bool timedout =
-          VMOperationQueue_lock->wait(Mutex::_no_safepoint_check_flag,
-                                      GuaranteedSafepointInterval);
+          VMOperationQueue_lock->wait_without_safepoint_check(GuaranteedSafepointInterval);
 
         // Support for self destruction
         if ((SelfDestructTimer != 0) && !VMError::is_error_reported() &&
@@ -507,7 +506,7 @@
         if (timedout) {
           // Have to unlock VMOperationQueue_lock just in case no_op_safepoint()
           // has to do a handshake.
-          MutexUnlockerEx mul(VMOperationQueue_lock, Mutex::_no_safepoint_check_flag);
+          MutexUnlocker mul(VMOperationQueue_lock, Mutex::_no_safepoint_check_flag);
           if ((_cur_vm_operation = VMThread::no_op_safepoint()) != NULL) {
             // Force a safepoint since we have not had one for at least
             // 'GuaranteedSafepointInterval' milliseconds and we need to clean
@@ -584,8 +583,8 @@
           // the lock.
           if (_vm_queue->peek_at_safepoint_priority()) {
             // must hold lock while draining queue
-            MutexLockerEx mu_queue(VMOperationQueue_lock,
-                                     Mutex::_no_safepoint_check_flag);
+            MutexLocker mu_queue(VMOperationQueue_lock,
+                                 Mutex::_no_safepoint_check_flag);
             safepoint_ops = _vm_queue->drain_at_safepoint_priority();
           } else {
             safepoint_ops = NULL;
@@ -626,8 +625,8 @@
     //
     //  Notify (potential) waiting Java thread(s) - lock without safepoint
     //  check so that sneaking is not possible
-    { MutexLockerEx mu(VMOperationRequest_lock,
-                       Mutex::_no_safepoint_check_flag);
+    { MutexLocker mu(VMOperationRequest_lock,
+                     Mutex::_no_safepoint_check_flag);
       VMOperationRequest_lock->notify_all();
     }
 
@@ -721,7 +720,11 @@
       // Note: only a JavaThread triggers the safepoint check when locking
       MutexLocker mu(VMOperationRequest_lock);
       while(t->vm_operation_completed_count() < ticket) {
-        VMOperationRequest_lock->wait(!t->is_Java_thread());
+        if (t->is_Java_thread()) {
+          VMOperationRequest_lock->wait();
+        } else {
+          VMOperationRequest_lock->wait_without_safepoint_check();
+        }
       }
     }
 
--- a/src/hotspot/share/services/diagnosticFramework.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/services/diagnosticFramework.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, 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
@@ -437,7 +437,7 @@
 }
 
 void DCmdFactory::push_jmx_notification_request() {
-  MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
   _has_pending_jmx_notification = true;
   Service_lock->notify_all();
 }
@@ -455,7 +455,7 @@
   HandleMark hm(THREAD);
   bool notif = false;
   {
-    MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
     notif = _has_pending_jmx_notification;
     _has_pending_jmx_notification = false;
   }
@@ -494,7 +494,7 @@
 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);
+  MutexLocker ml(DCmdFactory_lock, Mutex::_no_safepoint_check_flag);
   DCmdFactory* factory = _DCmdFactoryList;
   while (factory != NULL) {
     if (strlen(factory->name()) == len &&
@@ -511,7 +511,7 @@
 }
 
 int DCmdFactory::register_DCmdFactory(DCmdFactory* factory) {
-  MutexLockerEx ml(DCmdFactory_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(DCmdFactory_lock, Mutex::_no_safepoint_check_flag);
   factory->_next = _DCmdFactoryList;
   _DCmdFactoryList = factory;
   if (_send_jmx_notification && !factory->_hidden
@@ -536,7 +536,7 @@
 }
 
 GrowableArray<const char*>* DCmdFactory::DCmd_list(DCmdSource source) {
-  MutexLockerEx ml(DCmdFactory_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(DCmdFactory_lock, Mutex::_no_safepoint_check_flag);
   GrowableArray<const char*>* array = new GrowableArray<const char*>();
   DCmdFactory* factory = _DCmdFactoryList;
   while (factory != NULL) {
@@ -549,7 +549,7 @@
 }
 
 GrowableArray<DCmdInfo*>* DCmdFactory::DCmdInfo_list(DCmdSource source ) {
-  MutexLockerEx ml(DCmdFactory_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(DCmdFactory_lock, Mutex::_no_safepoint_check_flag);
   GrowableArray<DCmdInfo*>* array = new GrowableArray<DCmdInfo*>();
   DCmdFactory* factory = _DCmdFactoryList;
   while (factory != NULL) {
--- a/src/hotspot/share/services/gcNotifier.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/services/gcNotifier.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, 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
@@ -54,7 +54,7 @@
  }
 
 void GCNotifier::addRequest(GCNotificationRequest *request) {
-  MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
   if(first_request == NULL) {
     first_request = request;
   } else {
@@ -65,7 +65,7 @@
 }
 
 GCNotificationRequest *GCNotifier::getRequest() {
-  MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
   GCNotificationRequest *request = first_request;
   if(first_request != NULL) {
     first_request = first_request->next;
--- a/src/hotspot/share/services/lowMemoryDetector.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/services/lowMemoryDetector.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -80,7 +80,7 @@
 // This method could be called from any Java threads
 // and also VMThread.
 void LowMemoryDetector::detect_low_memory() {
-  MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
 
   bool has_pending_requests = false;
   int num_memory_pools = MemoryService::num_memory_pools();
@@ -113,7 +113,7 @@
   }
 
   {
-    MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
 
     MemoryUsage usage = pool->get_memory_usage();
     sensor->set_gauge_sensor_level(usage,
@@ -135,7 +135,7 @@
   }
 
   {
-    MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
 
     MemoryUsage usage = pool->get_last_collection_usage();
     sensor->set_counter_sensor_level(usage, pool->gc_usage_threshold());
@@ -335,7 +335,7 @@
 
   {
     // Holds Service_lock and update the sensor state
-    MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
     assert(_pending_trigger_count > 0, "Must have pending trigger");
     _sensor_on = true;
     _sensor_count += count;
@@ -346,7 +346,7 @@
 void SensorInfo::clear(int count, TRAPS) {
   {
     // Holds Service_lock and update the sensor state
-    MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
     if (_pending_clear_count == 0) {
       // Bail out if we lost a race to set_*_sensor_level() which may have
       // reactivated the sensor in the meantime because it was triggered again.
--- a/src/hotspot/share/services/management.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/services/management.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -844,7 +844,7 @@
 static jint get_vm_thread_count() {
   VmThreadCountClosure vmtcc;
   {
-    MutexLockerEx ml(Threads_lock);
+    MutexLocker ml(Threads_lock);
     Threads::threads_do(&vmtcc);
   }
 
@@ -1704,7 +1704,7 @@
 
   ThreadTimesClosure ttc(names_ah, times_ah);
   {
-    MutexLockerEx ml(Threads_lock);
+    MutexLocker ml(Threads_lock);
     Threads::threads_do(&ttc);
   }
   ttc.do_unlocked();
--- a/src/hotspot/share/services/memoryManager.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/services/memoryManager.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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
@@ -282,7 +282,7 @@
     _num_collections++;
     // alternately update two objects making one public when complete
     {
-      MutexLockerEx ml(_last_gc_lock, Mutex::_no_safepoint_check_flag);
+      MutexLocker ml(_last_gc_lock, Mutex::_no_safepoint_check_flag);
       GCStatInfo *tmp = _last_gc_stat;
       _last_gc_stat = _current_gc_stat;
       _current_gc_stat = tmp;
@@ -297,7 +297,7 @@
 }
 
 size_t GCMemoryManager::get_last_gc_stat(GCStatInfo* dest) {
-  MutexLockerEx ml(_last_gc_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(_last_gc_lock, Mutex::_no_safepoint_check_flag);
   if (_last_gc_stat->gc_index() != 0) {
     dest->set_index(_last_gc_stat->gc_index());
     dest->set_start_time(_last_gc_stat->start_time());
--- a/src/hotspot/share/services/threadService.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/services/threadService.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -97,7 +97,7 @@
 void ThreadService::reset_peak_thread_count() {
   // Acquire the lock to update the peak thread count
   // to synchronize with thread addition and removal.
-  MutexLockerEx mu(Threads_lock);
+  MutexLocker mu(Threads_lock);
   _peak_threads_count->set_value(get_live_thread_count());
 }
 
--- a/src/hotspot/share/utilities/decoder.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/utilities/decoder.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -83,9 +83,9 @@
 }
 
 DecoderLocker::DecoderLocker() :
-  MutexLockerEx(DecoderLocker::is_first_error_thread() ?
-                NULL : Decoder::shared_decoder_lock(),
-                Mutex::_no_safepoint_check_flag) {
+  MutexLocker(DecoderLocker::is_first_error_thread() ?
+              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");
@@ -98,8 +98,8 @@
 
 bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const char* modulepath, bool demangle) {
   bool error_handling_thread = os::current_thread_id() == VMError::first_error_tid;
-  MutexLockerEx locker(error_handling_thread ? NULL : shared_decoder_lock(),
-                       Mutex::_no_safepoint_check_flag);
+  MutexLocker 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");
@@ -109,8 +109,8 @@
 
 bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const void* base) {
   bool error_handling_thread = os::current_thread_id() == VMError::first_error_tid;
-  MutexLockerEx locker(error_handling_thread ? NULL : shared_decoder_lock(),
-                       Mutex::_no_safepoint_check_flag);
+  MutexLocker 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");
@@ -121,8 +121,8 @@
 
 bool Decoder::demangle(const char* symbol, char* buf, int buflen) {
   bool error_handling_thread = os::current_thread_id() == VMError::first_error_tid;
-  MutexLockerEx locker(error_handling_thread ? NULL : shared_decoder_lock(),
-                       Mutex::_no_safepoint_check_flag);
+  MutexLocker 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");
--- a/src/hotspot/share/utilities/decoder.hpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/utilities/decoder.hpp	Thu Apr 25 10:56:31 2019 -0400
@@ -136,7 +136,7 @@
   friend class DecoderLocker;
 };
 
-class DecoderLocker : public MutexLockerEx {
+class DecoderLocker : public MutexLocker {
   AbstractDecoder* _decoder;
   inline bool is_first_error_thread();
 public:
--- a/src/hotspot/share/utilities/events.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/utilities/events.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -117,7 +117,7 @@
   if (!should_log()) return;
 
   double timestamp = fetch_timestamp();
-  MutexLockerEx ml(&_mutex, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(&_mutex, Mutex::_no_safepoint_check_flag);
   int index = compute_log_index();
   _records[index].thread = thread;
   _records[index].timestamp = timestamp;
--- a/src/hotspot/share/utilities/events.hpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/utilities/events.hpp	Thu Apr 25 10:56:31 2019 -0400
@@ -156,7 +156,7 @@
     if (!this->should_log()) return;
 
     double timestamp = this->fetch_timestamp();
-    MutexLockerEx ml(&this->_mutex, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(&this->_mutex, Mutex::_no_safepoint_check_flag);
     int index = this->compute_log_index();
     this->_records[index].thread = thread;
     this->_records[index].timestamp = timestamp;
@@ -291,7 +291,7 @@
     // Not yet attached? Don't try to use locking
     print_log_impl(out);
   } else {
-    MutexLockerEx ml(&_mutex, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(&_mutex, Mutex::_no_safepoint_check_flag);
     print_log_impl(out);
   }
 }
--- a/src/hotspot/share/utilities/vmError.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/src/hotspot/share/utilities/vmError.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1757,7 +1757,7 @@
   // from racing with Threads::add() or Threads::remove() as we
   // generate the hs_err_pid file. This makes our ErrorHandling tests
   // more stable.
-  MutexLockerEx ml(Threads_lock->owned_by_self() ? NULL : Threads_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(Threads_lock->owned_by_self() ? NULL : Threads_lock, Mutex::_no_safepoint_check_flag);
 
   switch (how) {
     case  1: vmassert(str == NULL, "expected null"); break;
--- a/test/hotspot/gtest/gc/shared/test_oopStorage.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/test/hotspot/gtest/gc/shared/test_oopStorage.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -138,7 +138,7 @@
 }
 
 static bool process_deferred_updates(OopStorage& storage) {
-  MutexLockerEx ml(TestAccess::allocation_mutex(storage), Mutex::_no_safepoint_check_flag);
+  MutexLocker ml(TestAccess::allocation_mutex(storage), Mutex::_no_safepoint_check_flag);
   bool result = false;
   while (TestAccess::reduce_deferred_updates(storage)) {
     result = true;
--- a/test/hotspot/gtest/memory/test_is_metaspace_obj.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/test/hotspot/gtest/memory/test_is_metaspace_obj.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -53,7 +53,7 @@
   void do_test(Metaspace::MetadataType mdType) {
     _lock = new Mutex(Monitor::native, "gtest-IsMetaspaceObjTest-lock", false, Monitor::_safepoint_check_never);
     {
-      MutexLockerEx ml(_lock, Mutex::_no_safepoint_check_flag);
+      MutexLocker ml(_lock, Mutex::_no_safepoint_check_flag);
       _ms = new ClassLoaderMetaspace(_lock, Metaspace::StandardMetaspaceType);
     }
 
--- a/test/hotspot/gtest/memory/test_metaspace.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/test/hotspot/gtest/memory/test_metaspace.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -77,7 +77,7 @@
 
 TEST_VM(MetaspaceUtils, virtual_space_list_large_chunk) {
   VirtualSpaceList* vs_list = new VirtualSpaceList(os::vm_allocation_granularity());
-  MutexLockerEx cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
   // A size larger than VirtualSpaceSize (256k) and add one page to make it _not_ be
   // vm_allocation_granularity aligned on Windows.
   size_t large_size = (size_t)(2*256*K + (os::vm_page_size() / BytesPerWord));
--- a/test/hotspot/gtest/memory/test_metaspace_allocation.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/test/hotspot/gtest/memory/test_metaspace_allocation.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2018, SAP.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -108,7 +108,7 @@
     {
       // Pull lock during space creation, since this is what happens in the VM too
       // (see ClassLoaderData::metaspace_non_null(), which we mimick here).
-      MutexLockerEx ml(_spaces[i].lock,  Mutex::_no_safepoint_check_flag);
+      MutexLocker ml(_spaces[i].lock,  Mutex::_no_safepoint_check_flag);
       _spaces[i].space = new ClassLoaderMetaspace(_spaces[i].lock, msType);
     }
     _spaces[i].allocated = 0;
--- a/test/hotspot/gtest/runtime/test_threads.cpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/test/hotspot/gtest/runtime/test_threads.cpp	Thu Apr 25 10:56:31 2019 -0400
@@ -120,7 +120,7 @@
 public:
   void doit() {
     // Prevent changes to the NJT list while we're conducting our test.
-    MutexLockerEx ml(NonJavaThreadsList_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker ml(NonJavaThreadsList_lock, Mutex::_no_safepoint_check_flag);
 
     _thread_claim_token = max_uintx - 1;
 
--- a/test/hotspot/gtest/threadHelper.inline.hpp	Thu Apr 25 05:54:54 2019 -0700
+++ b/test/hotspot/gtest/threadHelper.inline.hpp	Thu Apr 25 10:56:31 2019 -0400
@@ -105,7 +105,7 @@
       Threads::add(this);
     }
     {
-      MutexLockerEx ml(SR_lock(), Mutex::_no_safepoint_check_flag);
+      MutexLocker ml(SR_lock(), Mutex::_no_safepoint_check_flag);
     }
   }