RFR: 8275162: Replace 'def' macros in mutexLocker.cpp
Ioi Lam
iklam at openjdk.java.net
Fri Oct 22 07:28:02 UTC 2021
On Thu, 21 Oct 2021 15:24:46 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
> This patch removes the 'def' macros from mutexLocker.cpp so it can use the default values for _allow_vm_block when possible and no more macro.
> Tested with tier1-3 with product and debug builds.
src/hotspot/share/runtime/mutexLocker.cpp line 203:
> 201: G1DetachedRefinementStats_lock = new PaddedMutex(Mutex::nosafepoint-2, "G1DetachedRefinementStats_lock");
> 202:
> 203: FreeList_lock = new PaddedMutex(Mutex::service-1, "FreeList_lock");
This makes the code more verbose. You have to type FreeList_lock twice, and there's no guarantee that you didn't have a typo in the quoted string.
If your goal is to use the default value for the `true` parameter, this can be done with VARARG macros, like
def(FreeList_lock, PaddedMutex, service-1);
def(ExceptionCache_lock , PaddedMutex, safepoint, false);
You can also avoid using `Mutex::` everywhere by doing this first:
const Mutex::Rank service = Mutex::service;
const Mutex::Rank nosafepoint = Mutex::nosafepoint;
-------------
PR: https://git.openjdk.java.net/jdk/pull/6066
More information about the hotspot-runtime-dev
mailing list