8235678: Remove unnecessary calls to Thread::current() in MutexLocker calls

Add THREAD argument when available and make Thread* the first argument to relevant MutexLocker and MonitorLocker constructors

Reviewed-by: lfoltan, coleenp, dholmes
This commit is contained in:
Harold Seigel 2020-01-16 13:48:23 +00:00
parent e2240b714e
commit 7fc58a1020
36 changed files with 122 additions and 121 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, 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
@ -726,7 +726,7 @@ void ClassLoader::add_to_exploded_build_list(Symbol* module_sym, TRAPS) {
ModuleClassPathList* module_cpl = new ModuleClassPathList(module_sym);
module_cpl->add_to_list(new_entry);
{
MutexLocker ml(Module_lock, THREAD);
MutexLocker ml(THREAD, Module_lock);
_exploded_entries->push(module_cpl);
}
log_info(class, load)("path: %s", path);
@ -1090,7 +1090,7 @@ objArrayOop ClassLoader::get_system_packages(TRAPS) {
// List of pointers to PackageEntrys that have loaded classes.
GrowableArray<PackageEntry*>* loaded_class_pkgs = new GrowableArray<PackageEntry*>(50);
{
MutexLocker ml(Module_lock, THREAD);
MutexLocker ml(THREAD, Module_lock);
PackageEntryTable* pe_table =
ClassLoaderData::the_null_class_loader_data()->packages();
@ -1187,7 +1187,7 @@ ClassFileStream* ClassLoader::search_module_entries(const GrowableArray<ModuleCl
// The exploded build entries can be added to at any time so a lock is
// needed when searching them.
assert(!ClassLoader::has_jrt_entry(), "Must be exploded build");
MutexLocker ml(Module_lock, THREAD);
MutexLocker ml(THREAD, Module_lock);
e = find_first_module_cpe(mod_entry, module_list);
} else {
e = find_first_module_cpe(mod_entry, module_list);
@ -1670,7 +1670,7 @@ void ClassLoader::create_javabase() {
}
{
MutexLocker ml(Module_lock, THREAD);
MutexLocker ml(THREAD, Module_lock);
ModuleEntry* jb_module = null_cld_modules->locked_create_entry(Handle(),
false, vmSymbols::java_base(), NULL, NULL, null_cld);
if (jb_module == NULL) {