mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-16 21:35:25 +00:00
8264146: Make Mutex point to rather than embed _name
Reviewed-by: redestad, dholmes
This commit is contained in:
parent
f69afba527
commit
a1e717f13e
@ -281,14 +281,9 @@ bool is_sometimes_ok(const char* name) {
|
||||
}
|
||||
|
||||
Mutex::Mutex(int Rank, const char * name, bool allow_vm_block,
|
||||
SafepointCheckRequired safepoint_check_required) : _owner(NULL) {
|
||||
SafepointCheckRequired safepoint_check_required) : _owner(NULL), _name(name) {
|
||||
assert(os::mutex_init_done(), "Too early!");
|
||||
if (name == NULL) {
|
||||
strcpy(_name, "UNKNOWN");
|
||||
} else {
|
||||
strncpy(_name, name, MUTEX_NAME_LEN - 1);
|
||||
_name[MUTEX_NAME_LEN - 1] = '\0';
|
||||
}
|
||||
assert(name != NULL, "Mutex requires a name");
|
||||
#ifdef ASSERT
|
||||
_allow_vm_block = allow_vm_block;
|
||||
_rank = Rank;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2021, 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
|
||||
@ -39,11 +39,6 @@
|
||||
// The underlying PlatformMutex may support recursive locking but this is not exposed
|
||||
// and we account for that possibility in try_lock.
|
||||
|
||||
// The default length of mutex name was originally chosen to be 64 to avoid
|
||||
// false sharing. Now, PaddedMutex and PaddedMonitor are available for this purpose.
|
||||
// TODO: Check if _name[MUTEX_NAME_LEN] should better get replaced by const char*.
|
||||
static const int MUTEX_NAME_LEN = 64;
|
||||
|
||||
class Mutex : public CHeapObj<mtSynchronizer> {
|
||||
|
||||
public:
|
||||
@ -91,7 +86,7 @@ class Mutex : public CHeapObj<mtSynchronizer> {
|
||||
|
||||
protected: // Monitor-Mutex metadata
|
||||
os::PlatformMonitor _lock; // Native monitor implementation
|
||||
char _name[MUTEX_NAME_LEN]; // Name of mutex/monitor
|
||||
const char* _name; // Name of mutex/monitor
|
||||
|
||||
// Debugging fields for naming, deadlock detection, etc. (some only used in debug mode)
|
||||
#ifndef PRODUCT
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user