8243393: Improve ReservedSpace constructor resolution

Remove possibly ambiguous constructor and use directly in ReservedCodeHeap

Reviewed-by: stuefe
This commit is contained in:
Coleen Phillimore 2020-04-28 07:35:28 -04:00
parent a8ffbb350d
commit 3ed0849504
5 changed files with 14 additions and 22 deletions

View File

@ -79,7 +79,7 @@ void CardTable::initialize() {
const size_t rs_align = _page_size == (size_t) os::vm_page_size() ? 0 :
MAX2(_page_size, (size_t) os::vm_allocation_granularity());
ReservedSpace heap_rs(_byte_map_size, rs_align, false);
ReservedSpace heap_rs(_byte_map_size, rs_align);
MemTracker::record_virtual_memory_type((address)heap_rs.base(), mtGC);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -104,8 +104,7 @@ bool JfrVirtualMemorySegment::initialize(size_t reservation_size_request_bytes)
assert(is_aligned(reservation_size_request_bytes, os::vm_allocation_granularity()), "invariant");
_rs = ReservedSpace(reservation_size_request_bytes,
os::vm_allocation_granularity(),
UseLargePages && os::can_commit_large_page_memory(),
false);
UseLargePages && os::can_commit_large_page_memory());
if (!_rs.is_reserved()) {
return false;
}

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
@ -66,12 +66,6 @@ ReservedSpace::ReservedSpace(size_t size, size_t alignment,
initialize(size, alignment, large, requested_address, false);
}
ReservedSpace::ReservedSpace(size_t size, size_t alignment,
bool large,
bool executable) : _fd_for_heap(-1) {
initialize(size, alignment, large, NULL, executable);
}
ReservedSpace::ReservedSpace(char* base, size_t size, size_t alignment,
bool special, bool executable) : _fd_for_heap(-1) {
assert((size % os::vm_allocation_granularity()) == 0,
@ -646,8 +640,8 @@ MemRegion ReservedHeapSpace::region() const {
// executable.
ReservedCodeSpace::ReservedCodeSpace(size_t r_size,
size_t rs_align,
bool large) :
ReservedSpace(r_size, rs_align, large, /*executable*/ true) {
bool large) : ReservedSpace() {
initialize(r_size, rs_align, large, /*requested address*/ NULL, /*executable*/ true);
MemTracker::record_virtual_memory_type((address)base(), mtCode);
}
@ -1127,7 +1121,7 @@ class TestReservedSpace : AllStatic {
bool large = maybe_large && UseLargePages && size >= os::large_page_size();
ReservedSpace rs(size, alignment, large, false);
ReservedSpace rs(size, alignment, large);
assert(rs.base() != NULL, "Must be");
assert(rs.size() == size, "Must be");
@ -1255,7 +1249,7 @@ class TestVirtualSpace : AllStatic {
case Commit:
return ReservedSpace(reserve_size_aligned,
os::vm_allocation_granularity(),
/* large */ false, /* exec */ false);
/* large */ false);
}
}
@ -1310,7 +1304,7 @@ class TestVirtualSpace : AllStatic {
size_t large_page_size = os::large_page_size();
ReservedSpace reserved(large_page_size, large_page_size, true, false);
ReservedSpace reserved(large_page_size, large_page_size, true);
assert(reserved.is_reserved(), "Must be");

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
@ -62,7 +62,6 @@ class ReservedSpace {
ReservedSpace(size_t size, size_t preferred_page_size = 0);
ReservedSpace(size_t size, size_t alignment, bool large,
char* requested_address = NULL);
ReservedSpace(size_t size, size_t alignment, bool large, bool executable);
// Accessors
char* base() const { return _base; }

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 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
@ -104,7 +104,7 @@ namespace {
bool large = maybe_large && UseLargePages && size >= os::large_page_size();
ReservedSpace rs(size, alignment, large, false);
ReservedSpace rs(size, alignment, large);
MemoryReleaser releaser(&rs);
EXPECT_TRUE(rs.base() != NULL) << "rs.special: " << rs.special();
@ -218,7 +218,7 @@ namespace {
case Commit:
return ReservedSpace(reserve_size_aligned,
os::vm_allocation_granularity(),
/* large */ false, /* exec */ false);
/* large */ false);
}
}
@ -297,7 +297,7 @@ TEST_VM(VirtualSpace, actual_committed_space_one_large_page) {
size_t large_page_size = os::large_page_size();
ReservedSpace reserved(large_page_size, large_page_size, true, false);
ReservedSpace reserved(large_page_size, large_page_size, true);
ReservedSpaceReleaser releaser(&reserved);
ASSERT_TRUE(reserved.is_reserved());