mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 18:14:38 +02:00
8280136: Serial: Remove unnecessary use of ExpandHeap_lock
Reviewed-by: iwalulya, kbarrett, sjohanss
This commit is contained in:
parent
2112a9dc49
commit
bc6148407e
7 changed files with 21 additions and 16 deletions
|
@ -163,7 +163,7 @@ bool PSOldGen::expand_for_allocate(size_t word_size) {
|
|||
assert(word_size > 0, "allocating zero words?");
|
||||
bool result = true;
|
||||
{
|
||||
MutexLocker x(ExpandHeap_lock);
|
||||
MutexLocker x(PSOldGenExpand_lock);
|
||||
// Avoid "expand storms" by rechecking available space after obtaining
|
||||
// the lock, because another thread may have already made sufficient
|
||||
// space available. If insufficient space available, that will remain
|
||||
|
@ -181,7 +181,7 @@ bool PSOldGen::expand_for_allocate(size_t word_size) {
|
|||
}
|
||||
|
||||
bool PSOldGen::expand(size_t bytes) {
|
||||
assert_lock_strong(ExpandHeap_lock);
|
||||
assert_lock_strong(PSOldGenExpand_lock);
|
||||
assert_locked_or_safepoint(Heap_lock);
|
||||
assert(bytes > 0, "precondition");
|
||||
const size_t alignment = virtual_space()->alignment();
|
||||
|
@ -219,7 +219,7 @@ bool PSOldGen::expand(size_t bytes) {
|
|||
}
|
||||
|
||||
bool PSOldGen::expand_by(size_t bytes) {
|
||||
assert_lock_strong(ExpandHeap_lock);
|
||||
assert_lock_strong(PSOldGenExpand_lock);
|
||||
assert_locked_or_safepoint(Heap_lock);
|
||||
assert(bytes > 0, "precondition");
|
||||
bool result = virtual_space()->expand_by(bytes);
|
||||
|
@ -255,7 +255,7 @@ bool PSOldGen::expand_by(size_t bytes) {
|
|||
}
|
||||
|
||||
bool PSOldGen::expand_to_reserved() {
|
||||
assert_lock_strong(ExpandHeap_lock);
|
||||
assert_lock_strong(PSOldGenExpand_lock);
|
||||
assert_locked_or_safepoint(Heap_lock);
|
||||
|
||||
bool result = false;
|
||||
|
@ -268,12 +268,11 @@ bool PSOldGen::expand_to_reserved() {
|
|||
}
|
||||
|
||||
void PSOldGen::shrink(size_t bytes) {
|
||||
assert_lock_strong(ExpandHeap_lock);
|
||||
assert_lock_strong(PSOldGenExpand_lock);
|
||||
assert_locked_or_safepoint(Heap_lock);
|
||||
|
||||
size_t size = align_down(bytes, virtual_space()->alignment());
|
||||
if (size > 0) {
|
||||
assert_lock_strong(ExpandHeap_lock);
|
||||
virtual_space()->shrink_by(bytes);
|
||||
post_resize();
|
||||
|
||||
|
@ -312,11 +311,11 @@ void PSOldGen::resize(size_t desired_free_space) {
|
|||
}
|
||||
if (new_size > current_size) {
|
||||
size_t change_bytes = new_size - current_size;
|
||||
MutexLocker x(ExpandHeap_lock);
|
||||
MutexLocker x(PSOldGenExpand_lock);
|
||||
expand(change_bytes);
|
||||
} else {
|
||||
size_t change_bytes = current_size - new_size;
|
||||
MutexLocker x(ExpandHeap_lock);
|
||||
MutexLocker x(PSOldGenExpand_lock);
|
||||
shrink(change_bytes);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue