Skip to content

Commit b7b391b

Browse files
committed
8260625: Rename MetaspaceExpand_lock
Reviewed-by: shade
1 parent 22bfa5b commit b7b391b

10 files changed

+71
-71
lines changed

src/hotspot/share/memory/metaspace/chunkManager.cpp

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
3-
* Copyright (c) 2018, 2020 SAP SE. All rights reserved.
2+
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2018, 2021 SAP SE. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
66
* This code is free software; you can redistribute it and/or modify it
@@ -47,7 +47,7 @@ namespace metaspace {
4747

4848
// Return a single chunk to the freelist and adjust accounting. No merge is attempted.
4949
void ChunkManager::return_chunk_simple_locked(Metachunk* c) {
50-
assert_lock_strong(MetaspaceExpand_lock);
50+
assert_lock_strong(Metaspace_lock);
5151
DEBUG_ONLY(c->verify());
5252
_chunks.add(c);
5353
c->reset_used_words();
@@ -75,7 +75,7 @@ ChunkManager::ChunkManager(const char* name, VirtualSpaceList* space_list) :
7575
// The committed areas within the original chunk carry over to the resulting
7676
// chunks.
7777
void ChunkManager::split_chunk_and_add_splinters(Metachunk* c, chunklevel_t target_level) {
78-
assert_lock_strong(MetaspaceExpand_lock);
78+
assert_lock_strong(Metaspace_lock);
7979
assert(c->is_free(), "chunk to be split must be free.");
8080
assert(c->level() < target_level, "Target level must be higher than current level.");
8181
assert(c->prev() == NULL && c->next() == NULL, "Chunk must be outside of any list.");
@@ -121,7 +121,7 @@ Metachunk* ChunkManager::get_chunk(chunklevel_t preferred_level, chunklevel_t ma
121121
assert(preferred_level <= max_level, "Sanity");
122122
assert(chunklevel::level_fitting_word_size(min_committed_words) >= max_level, "Sanity");
123123

124-
MutexLocker fcl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
124+
MutexLocker fcl(Metaspace_lock, Mutex::_no_safepoint_check_flag);
125125

126126
DEBUG_ONLY(verify_locked();)
127127
DEBUG_ONLY(chunklevel::check_valid_level(max_level);)
@@ -232,13 +232,13 @@ Metachunk* ChunkManager::get_chunk(chunklevel_t preferred_level, chunklevel_t ma
232232
// !! Note: this may invalidate the chunk. Do not access the chunk after
233233
// this function returns !!
234234
void ChunkManager::return_chunk(Metachunk* c) {
235-
MutexLocker fcl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
235+
MutexLocker fcl(Metaspace_lock, Mutex::_no_safepoint_check_flag);
236236
return_chunk_locked(c);
237237
}
238238

239239
// See return_chunk().
240240
void ChunkManager::return_chunk_locked(Metachunk* c) {
241-
assert_lock_strong(MetaspaceExpand_lock);
241+
assert_lock_strong(Metaspace_lock);
242242
UL2(debug, ": returning chunk " METACHUNK_FORMAT ".", METACHUNK_FORMAT_ARGS(c));
243243
DEBUG_ONLY(c->verify();)
244244
assert(contains_chunk(c) == false, "A chunk to be added to the freelist must not be in the freelist already.");
@@ -286,7 +286,7 @@ void ChunkManager::return_chunk_locked(Metachunk* c) {
286286
//
287287
// On success, true is returned, false otherwise.
288288
bool ChunkManager::attempt_enlarge_chunk(Metachunk* c) {
289-
MutexLocker fcl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
289+
MutexLocker fcl(Metaspace_lock, Mutex::_no_safepoint_check_flag);
290290
return c->vsnode()->attempt_enlarge_chunk(c, &_chunks);
291291
}
292292

@@ -311,7 +311,7 @@ static void print_word_size_delta(outputStream* st, size_t word_size_1, size_t w
311311
}
312312

313313
void ChunkManager::purge() {
314-
MutexLocker fcl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
314+
MutexLocker fcl(Metaspace_lock, Mutex::_no_safepoint_check_flag);
315315
UL(info, ": reclaiming memory...");
316316

317317
const size_t reserved_before = _vslist->reserved_words();
@@ -384,18 +384,18 @@ ChunkManager* ChunkManager::chunkmanager_nonclass() {
384384

385385
// Calculates the total number of committed words over all chunks. Walks chunks.
386386
size_t ChunkManager::calc_committed_word_size() const {
387-
MutexLocker fcl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
387+
MutexLocker fcl(Metaspace_lock, Mutex::_no_safepoint_check_flag);
388388
return calc_committed_word_size_locked();
389389
}
390390

391391
size_t ChunkManager::calc_committed_word_size_locked() const {
392-
assert_lock_strong(MetaspaceExpand_lock);
392+
assert_lock_strong(Metaspace_lock);
393393
return _chunks.calc_committed_word_size();
394394
}
395395

396396
// Update statistics.
397397
void ChunkManager::add_to_statistics(ChunkManagerStats* out) const {
398-
MutexLocker fcl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
398+
MutexLocker fcl(Metaspace_lock, Mutex::_no_safepoint_check_flag);
399399
for (chunklevel_t l = chunklevel::ROOT_CHUNK_LEVEL; l <= chunklevel::HIGHEST_CHUNK_LEVEL; l++) {
400400
out->_num_chunks[l] += _chunks.num_chunks_at_level(l);
401401
out->_committed_word_size[l] += _chunks.calc_committed_word_size_at_level(l);
@@ -406,12 +406,12 @@ void ChunkManager::add_to_statistics(ChunkManagerStats* out) const {
406406
#ifdef ASSERT
407407

408408
void ChunkManager::verify() const {
409-
MutexLocker fcl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
409+
MutexLocker fcl(Metaspace_lock, Mutex::_no_safepoint_check_flag);
410410
verify_locked();
411411
}
412412

413413
void ChunkManager::verify_locked() const {
414-
assert_lock_strong(MetaspaceExpand_lock);
414+
assert_lock_strong(Metaspace_lock);
415415
assert(_vslist != NULL, "No vslist");
416416
_chunks.verify();
417417
}
@@ -423,12 +423,12 @@ bool ChunkManager::contains_chunk(Metachunk* c) const {
423423
#endif // ASSERT
424424

425425
void ChunkManager::print_on(outputStream* st) const {
426-
MutexLocker fcl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
426+
MutexLocker fcl(Metaspace_lock, Mutex::_no_safepoint_check_flag);
427427
print_on_locked(st);
428428
}
429429

430430
void ChunkManager::print_on_locked(outputStream* st) const {
431-
assert_lock_strong(MetaspaceExpand_lock);
431+
assert_lock_strong(Metaspace_lock);
432432
st->print_cr("cm %s: %d chunks, total word size: " SIZE_FORMAT ".", _name,
433433
total_num_chunks(), total_word_size());
434434
_chunks.print_on(st);

src/hotspot/share/memory/metaspace/metachunk.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
3-
* Copyright (c) 2017, 2020 SAP SE. All rights reserved.
2+
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2017, 2021 SAP SE. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
66
* This code is free software; you can redistribute it and/or modify it
@@ -48,7 +48,7 @@ char Metachunk::get_state_char() const {
4848

4949
#ifdef ASSERT
5050
void Metachunk::assert_have_expand_lock() {
51-
assert_lock_strong(MetaspaceExpand_lock);
51+
assert_lock_strong(Metaspace_lock);
5252
}
5353
#endif
5454

@@ -91,7 +91,7 @@ bool Metachunk::commit_up_to(size_t new_committed_words) {
9191
#endif
9292

9393
// We should hold the expand lock at this point.
94-
assert_lock_strong(MetaspaceExpand_lock);
94+
assert_lock_strong(Metaspace_lock);
9595

9696
const size_t commit_from = _committed_words;
9797
const size_t commit_to = MIN2(align_up(new_committed_words, Settings::commit_granule_words()), word_size());
@@ -117,15 +117,15 @@ bool Metachunk::commit_up_to(size_t new_committed_words) {
117117
bool Metachunk::ensure_committed(size_t new_committed_words) {
118118
bool rc = true;
119119
if (new_committed_words > committed_words()) {
120-
MutexLocker cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
120+
MutexLocker cl(Metaspace_lock, Mutex::_no_safepoint_check_flag);
121121
rc = commit_up_to(new_committed_words);
122122
}
123123
return rc;
124124
}
125125

126126
bool Metachunk::ensure_committed_locked(size_t new_committed_words) {
127127
// the .._locked() variant should be called if we own the lock already.
128-
assert_lock_strong(MetaspaceExpand_lock);
128+
assert_lock_strong(Metaspace_lock);
129129
bool rc = true;
130130
if (new_committed_words > committed_words()) {
131131
rc = commit_up_to(new_committed_words);
@@ -137,13 +137,13 @@ bool Metachunk::ensure_committed_locked(size_t new_committed_words) {
137137
// commit granule size (in other words, we cannot uncommit chunks smaller than
138138
// a commit granule size).
139139
void Metachunk::uncommit() {
140-
MutexLocker cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
140+
MutexLocker cl(Metaspace_lock, Mutex::_no_safepoint_check_flag);
141141
uncommit_locked();
142142
}
143143

144144
void Metachunk::uncommit_locked() {
145145
// Only uncommit chunks which are free, have no used words set (extra precaution) and are equal or larger in size than a single commit granule.
146-
assert_lock_strong(MetaspaceExpand_lock);
146+
assert_lock_strong(Metaspace_lock);
147147
assert(_state == State::Free && _used_words == 0 && word_size() >= Settings::commit_granule_words(),
148148
"Only free chunks equal or larger than commit granule size can be uncommitted "
149149
"(chunk " METACHUNK_FULL_FORMAT ").", METACHUNK_FULL_FORMAT_ARGS(this));
@@ -184,7 +184,7 @@ void Metachunk::zap_header(uint8_t c) {
184184
// Verifies linking with neighbors in virtual space.
185185
// Can only be done under expand lock protection.
186186
void Metachunk::verify_neighborhood() const {
187-
assert_lock_strong(MetaspaceExpand_lock);
187+
assert_lock_strong(Metaspace_lock);
188188
assert(!is_dead(), "Do not call on dead chunks.");
189189
if (is_root_chunk()) {
190190
// Root chunks are all alone in the world.

src/hotspot/share/memory/metaspace/rootChunkArea.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3-
* Copyright (c) 2020 SAP SE. All rights reserved.
2+
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2020, 2021 SAP SE. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
66
* This code is free software; you can redistribute it and/or modify it
@@ -377,7 +377,7 @@ bool RootChunkArea::is_free() const {
377377
}
378378

379379
void RootChunkArea::verify() const {
380-
assert_lock_strong(MetaspaceExpand_lock);
380+
assert_lock_strong(Metaspace_lock);
381381
assert_is_aligned(_base, chunklevel::MAX_CHUNK_BYTE_SIZE);
382382

383383
// Iterate thru all chunks in this area. They must be ordered correctly,
@@ -415,7 +415,7 @@ void RootChunkArea::verify() const {
415415
}
416416

417417
void RootChunkArea::verify_area_is_ideally_merged() const {
418-
SOMETIMES(assert_lock_strong(MetaspaceExpand_lock);)
418+
SOMETIMES(assert_lock_strong(Metaspace_lock);)
419419
int num_chunk = 0;
420420
for (const Metachunk* c = _first_chunk; c != NULL; c = c->next_in_vs()) {
421421
if (!c->is_root_chunk() && c->is_free()) {

src/hotspot/share/memory/metaspace/testHelpers.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3-
* Copyright (c) 2020 SAP SE. All rights reserved.
2+
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2020, 2021 SAP SE. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
66
* This code is free software; you can redistribute it and/or modify it
@@ -82,7 +82,7 @@ MetaspaceTestContext::MetaspaceTestContext(const char* name, size_t commit_limit
8282

8383
MetaspaceTestContext::~MetaspaceTestContext() {
8484
DEBUG_ONLY(verify();)
85-
MutexLocker fcl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
85+
MutexLocker fcl(Metaspace_lock, Mutex::_no_safepoint_check_flag);
8686
delete _context;
8787
if (_rs.is_reserved()) {
8888
_rs.release();

src/hotspot/share/memory/metaspace/virtualSpaceList.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
3-
* Copyright (c) 2018, 2020 SAP SE. All rights reserved.
2+
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2018, 2021 SAP SE. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
66
* This code is free software; you can redistribute it and/or modify it
@@ -73,7 +73,7 @@ VirtualSpaceList::VirtualSpaceList(const char* name, ReservedSpace rs, CommitLim
7373
}
7474

7575
VirtualSpaceList::~VirtualSpaceList() {
76-
assert_lock_strong(MetaspaceExpand_lock);
76+
assert_lock_strong(Metaspace_lock);
7777
// Note: normally, there is no reason ever to delete a vslist since they are
7878
// global objects, but for gtests it makes sense to allow this.
7979
VirtualSpaceNode* vsn = _first_node;
@@ -90,7 +90,7 @@ VirtualSpaceList::~VirtualSpaceList() {
9090
// List must be expandable for this to work.
9191
void VirtualSpaceList::create_new_node() {
9292
assert(_can_expand, "List is not expandable");
93-
assert_lock_strong(MetaspaceExpand_lock);
93+
assert_lock_strong(Metaspace_lock);
9494

9595
VirtualSpaceNode* vsn = VirtualSpaceNode::create_node(Settings::virtual_space_node_default_word_size(),
9696
_commit_limiter,
@@ -105,7 +105,7 @@ void VirtualSpaceList::create_new_node() {
105105
// Hence, before using this chunk, it must be committed.
106106
// Also, no limits are checked, since no committing takes place.
107107
Metachunk* VirtualSpaceList::allocate_root_chunk() {
108-
assert_lock_strong(MetaspaceExpand_lock);
108+
assert_lock_strong(Metaspace_lock);
109109

110110
if (_first_node == NULL ||
111111
_first_node->free_words() < chunklevel::MAX_CHUNK_WORD_SIZE) {
@@ -138,7 +138,7 @@ Metachunk* VirtualSpaceList::allocate_root_chunk() {
138138
// The free chunks are removed from the freelists before the nodes are deleted.
139139
// Return number of purged nodes.
140140
int VirtualSpaceList::purge(FreeChunkListVector* freelists) {
141-
assert_lock_strong(MetaspaceExpand_lock);
141+
assert_lock_strong(Metaspace_lock);
142142
UL(debug, "purging.");
143143

144144
VirtualSpaceNode* vsn = _first_node;
@@ -173,7 +173,7 @@ int VirtualSpaceList::purge(FreeChunkListVector* freelists) {
173173

174174
// Print all nodes in this space list.
175175
void VirtualSpaceList::print_on(outputStream* st) const {
176-
MutexLocker fcl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
176+
MutexLocker fcl(Metaspace_lock, Mutex::_no_safepoint_check_flag);
177177

178178
st->print_cr("vsl %s:", _name);
179179
const VirtualSpaceNode* vsn = _first_node;
@@ -190,7 +190,7 @@ void VirtualSpaceList::print_on(outputStream* st) const {
190190

191191
#ifdef ASSERT
192192
void VirtualSpaceList::verify_locked() const {
193-
assert_lock_strong(MetaspaceExpand_lock);
193+
assert_lock_strong(Metaspace_lock);
194194
assert(_name != NULL, "Sanity");
195195

196196
int n = 0;
@@ -216,7 +216,7 @@ void VirtualSpaceList::verify_locked() const {
216216
}
217217

218218
void VirtualSpaceList::verify() const {
219-
MutexLocker fcl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
219+
MutexLocker fcl(Metaspace_lock, Mutex::_no_safepoint_check_flag);
220220
verify_locked();
221221
}
222222
#endif

0 commit comments

Comments
 (0)