mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-15 10:23:28 +00:00
8357801: Parallel: Remove deprecated PSVirtualSpace methods
Reviewed-by: tschatzl, iwalulya
This commit is contained in:
parent
72a3022dc6
commit
cdff7b963c
@ -36,9 +36,10 @@ static size_t num_bytes_required(MemRegion mr) {
|
||||
return mr.word_size() / CardTable::card_size_in_words();
|
||||
}
|
||||
|
||||
void ObjectStartArray::initialize(MemRegion reserved_region) {
|
||||
ObjectStartArray::ObjectStartArray(MemRegion covered_region)
|
||||
: _virtual_space(nullptr) {
|
||||
// Calculate how much space must be reserved
|
||||
size_t bytes_to_reserve = num_bytes_required(reserved_region);
|
||||
size_t bytes_to_reserve = num_bytes_required(covered_region);
|
||||
assert(bytes_to_reserve > 0, "Sanity");
|
||||
|
||||
bytes_to_reserve =
|
||||
@ -52,21 +53,21 @@ void ObjectStartArray::initialize(MemRegion reserved_region) {
|
||||
}
|
||||
|
||||
// We do not commit any memory initially
|
||||
_virtual_space.initialize(backing_store);
|
||||
_virtual_space = new PSVirtualSpace(backing_store, os::vm_page_size());
|
||||
|
||||
assert(_virtual_space.low_boundary() != nullptr, "set from the backing_store");
|
||||
assert(_virtual_space->low_boundary() != nullptr, "set from the backing_store");
|
||||
|
||||
_offset_base = (uint8_t*)(_virtual_space.low_boundary() - (uintptr_t(reserved_region.start()) >> CardTable::card_shift()));
|
||||
_offset_base = (uint8_t*)(_virtual_space->low_boundary() - (uintptr_t(covered_region.start()) >> CardTable::card_shift()));
|
||||
}
|
||||
|
||||
void ObjectStartArray::set_covered_region(MemRegion mr) {
|
||||
DEBUG_ONLY(_covered_region = mr;)
|
||||
|
||||
size_t requested_size = num_bytes_required(mr);
|
||||
// Only commit memory in page sized chunks
|
||||
// Only commit memory in page-sized chunks
|
||||
requested_size = align_up(requested_size, os::vm_page_size());
|
||||
|
||||
size_t current_size = _virtual_space.committed_size();
|
||||
size_t current_size = _virtual_space->committed_size();
|
||||
|
||||
if (requested_size == current_size) {
|
||||
return;
|
||||
@ -75,13 +76,13 @@ void ObjectStartArray::set_covered_region(MemRegion mr) {
|
||||
if (requested_size > current_size) {
|
||||
// Expand
|
||||
size_t expand_by = requested_size - current_size;
|
||||
if (!_virtual_space.expand_by(expand_by)) {
|
||||
if (!_virtual_space->expand_by(expand_by)) {
|
||||
vm_exit_out_of_memory(expand_by, OOM_MMAP_ERROR, "object start array expansion");
|
||||
}
|
||||
} else {
|
||||
// Shrink
|
||||
size_t shrink_by = current_size - requested_size;
|
||||
_virtual_space.shrink_by(shrink_by);
|
||||
_virtual_space->shrink_by(shrink_by);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ class ObjectStartArray : public CHeapObj<mtGC> {
|
||||
DEBUG_ONLY(MemRegion _covered_region;)
|
||||
|
||||
// BOT array
|
||||
PSVirtualSpace _virtual_space;
|
||||
PSVirtualSpace* _virtual_space;
|
||||
|
||||
// Biased array-start of BOT array for fast heap-addr / BOT entry translation
|
||||
uint8_t* _offset_base;
|
||||
@ -74,7 +74,7 @@ class ObjectStartArray : public CHeapObj<mtGC> {
|
||||
void verify_for_block(HeapWord* blk_start, HeapWord* blk_end) const;
|
||||
|
||||
public:
|
||||
void initialize(MemRegion reserved_region);
|
||||
ObjectStartArray(MemRegion covered_region);
|
||||
|
||||
// Heap old-gen resizing
|
||||
void set_covered_region(MemRegion mr);
|
||||
|
||||
@ -67,9 +67,6 @@ void PSOldGen::initialize_work(const char* perf_data_name, int level) {
|
||||
MemRegion const reserved_mr = reserved();
|
||||
assert(reserved_mr.byte_size() == max_gen_size(), "invariant");
|
||||
|
||||
// Object start stuff: for all reserved memory
|
||||
start_array()->initialize(reserved_mr);
|
||||
|
||||
// Card table stuff: for all committed memory
|
||||
MemRegion committed_mr((HeapWord*)virtual_space()->low(),
|
||||
(HeapWord*)virtual_space()->high());
|
||||
@ -108,6 +105,7 @@ void PSOldGen::initialize_work(const char* perf_data_name, int level) {
|
||||
&ParallelScavengeHeap::heap()->workers());
|
||||
|
||||
// Update the start_array
|
||||
_start_array = new ObjectStartArray(reserved_mr);
|
||||
start_array()->set_covered_region(committed_mr);
|
||||
}
|
||||
|
||||
@ -282,7 +280,7 @@ void PSOldGen::complete_loaded_archive_space(MemRegion archive_space) {
|
||||
HeapWord* cur = archive_space.start();
|
||||
while (cur < archive_space.end()) {
|
||||
size_t word_size = cast_to_oop(cur)->size();
|
||||
_start_array.update_for_block(cur, cur + word_size);
|
||||
_start_array->update_for_block(cur, cur + word_size);
|
||||
cur += word_size;
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ class PSOldGen : public CHeapObj<mtGC> {
|
||||
friend class VMStructs;
|
||||
private:
|
||||
PSVirtualSpace* _virtual_space; // Controls mapping and unmapping of virtual mem
|
||||
ObjectStartArray _start_array; // Keeps track of where objects start in a 512b block
|
||||
ObjectStartArray* _start_array; // Keeps track of where objects start in a 512b block
|
||||
MutableSpace* _object_space; // Where all the objects live
|
||||
|
||||
// Performance Counters
|
||||
@ -56,7 +56,7 @@ class PSOldGen : public CHeapObj<mtGC> {
|
||||
assert_locked_or_safepoint(Heap_lock);
|
||||
HeapWord* res = object_space()->cas_allocate(word_size);
|
||||
if (res != nullptr) {
|
||||
_start_array.update_for_block(res, res + word_size);
|
||||
_start_array->update_for_block(res, res + word_size);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@ -103,7 +103,7 @@ class PSOldGen : public CHeapObj<mtGC> {
|
||||
}
|
||||
|
||||
MutableSpace* object_space() const { return _object_space; }
|
||||
ObjectStartArray* start_array() { return &_start_array; }
|
||||
ObjectStartArray* start_array() { return _start_array; }
|
||||
PSVirtualSpace* virtual_space() const { return _virtual_space;}
|
||||
|
||||
// Size info
|
||||
|
||||
@ -27,8 +27,6 @@
|
||||
#include "runtime/os.hpp"
|
||||
#include "utilities/align.hpp"
|
||||
|
||||
// PSVirtualSpace
|
||||
|
||||
PSVirtualSpace::PSVirtualSpace(ReservedSpace rs, size_t alignment) :
|
||||
_alignment(alignment)
|
||||
{
|
||||
@ -37,23 +35,6 @@ PSVirtualSpace::PSVirtualSpace(ReservedSpace rs, size_t alignment) :
|
||||
DEBUG_ONLY(verify());
|
||||
}
|
||||
|
||||
// Deprecated.
|
||||
PSVirtualSpace::PSVirtualSpace():
|
||||
_alignment(os::vm_page_size()),
|
||||
_reserved_low_addr(nullptr),
|
||||
_reserved_high_addr(nullptr),
|
||||
_committed_low_addr(nullptr),
|
||||
_committed_high_addr(nullptr),
|
||||
_special(false) {
|
||||
}
|
||||
|
||||
// Deprecated.
|
||||
void PSVirtualSpace::initialize(ReservedSpace rs) {
|
||||
set_reserved(rs);
|
||||
set_committed(reserved_low_addr(), reserved_low_addr());
|
||||
DEBUG_ONLY(verify());
|
||||
}
|
||||
|
||||
PSVirtualSpace::~PSVirtualSpace() {
|
||||
release();
|
||||
}
|
||||
|
||||
@ -58,9 +58,6 @@ class PSVirtualSpace : public CHeapObj<mtGC> {
|
||||
|
||||
~PSVirtualSpace();
|
||||
|
||||
PSVirtualSpace();
|
||||
void initialize(ReservedSpace rs);
|
||||
|
||||
bool is_in_committed(const void* p) const {
|
||||
return (p >= committed_low_addr()) && (p < committed_high_addr());
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user