8243146: Further cleanups after UseAdaptiveGCBoundary removal

Reviewed-by: kbarrett, sjohanss
This commit is contained in:
Stefan Karlsson 2020-04-21 10:10:23 +02:00
parent 74b3243f8c
commit 71b06ed298
13 changed files with 73 additions and 607 deletions

View file

@ -1,86 +0,0 @@
/*
* Copyright (c) 2003, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "gc/parallel/adjoiningGenerations.hpp"
#include "gc/parallel/adjoiningVirtualSpaces.hpp"
#include "gc/parallel/parallelScavengeHeap.hpp"
#include "gc/parallel/parallelArguments.hpp"
#include "gc/shared/genArguments.hpp"
#include "logging/log.hpp"
#include "logging/logStream.hpp"
#include "memory/resourceArea.hpp"
#include "utilities/align.hpp"
#include "utilities/ostream.hpp"
AdjoiningGenerations::AdjoiningGenerations(ReservedSpace old_young_rs) :
_virtual_spaces(new AdjoiningVirtualSpaces(old_young_rs, MinOldSize,
MinNewSize, GenAlignment)) {
size_t init_low_byte_size = OldSize;
size_t min_low_byte_size = MinOldSize;
size_t max_low_byte_size = MaxOldSize;
size_t init_high_byte_size = NewSize;
size_t min_high_byte_size = MinNewSize;
size_t max_high_byte_size = MaxNewSize;
assert(min_low_byte_size <= init_low_byte_size &&
init_low_byte_size <= max_low_byte_size, "Parameter check");
assert(min_high_byte_size <= init_high_byte_size &&
init_high_byte_size <= max_high_byte_size, "Parameter check");
// Layout the reserved space for the generations.
// If OldGen is allocated on nv-dimm, we need to split the reservation (this is required for windows).
ReservedSpace old_rs =
virtual_spaces()->reserved_space().first_part(max_low_byte_size, ParallelArguments::is_heterogeneous_heap() /* split */);
ReservedSpace heap_rs =
virtual_spaces()->reserved_space().last_part(max_low_byte_size);
ReservedSpace young_rs = heap_rs.first_part(max_high_byte_size);
assert(young_rs.size() == heap_rs.size(), "Didn't reserve all of the heap");
// Create the generations. Virtual spaces are not passed in.
_young_gen = new PSYoungGen(init_high_byte_size,
min_high_byte_size,
max_high_byte_size);
_old_gen = new PSOldGen(init_low_byte_size,
min_low_byte_size,
max_low_byte_size,
"old", 1);
// The virtual spaces are created by the initialization of the gens.
_young_gen->initialize(young_rs, GenAlignment);
assert(young_gen()->gen_size_limit() == young_rs.size(),
"Consistency check");
_old_gen->initialize(old_rs, GenAlignment, "old", 1);
assert(old_gen()->gen_size_limit() == old_rs.size(), "Consistency check");
}
AdjoiningGenerations::AdjoiningGenerations(): _young_gen(NULL), _old_gen(NULL), _virtual_spaces(NULL) { }
size_t AdjoiningGenerations::reserved_byte_size() {
return virtual_spaces()->reserved_space().size();
}
AdjoiningGenerations* AdjoiningGenerations::create_adjoining_generations(ReservedSpace old_young_rs) {
return new AdjoiningGenerations(old_young_rs);
}

View file

@ -1,70 +0,0 @@
/*
* Copyright (c) 2003, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_GC_PARALLEL_ADJOININGGENERATIONS_HPP
#define SHARE_GC_PARALLEL_ADJOININGGENERATIONS_HPP
#include "gc/parallel/adjoiningVirtualSpaces.hpp"
class PSOldGen;
class PSYoungGen;
// Contains two generations that both use an AdjoiningVirtualSpaces.
// The two generations are adjacent in the reserved space for the
// heap. Each generation has a virtual space and shrinking and
// expanding of the generations can still be down with that
// virtual space as was previously done. If expanding of reserved
// size of a generation is required, the adjacent generation
// must be shrunk. Adjusting the boundary between the generations
// is called for in this class.
class AdjoiningGenerations : public CHeapObj<mtGC> {
friend class VMStructs;
protected:
AdjoiningGenerations();
// The young generation and old generation, respectively
PSYoungGen* _young_gen;
PSOldGen* _old_gen;
// The spaces used by the two generations.
AdjoiningVirtualSpaces* _virtual_spaces;
public:
AdjoiningGenerations(ReservedSpace rs);
// Accessors
PSYoungGen* young_gen() { return _young_gen; }
PSOldGen* old_gen() { return _old_gen; }
AdjoiningVirtualSpaces* virtual_spaces() { return _virtual_spaces; }
// Return the total byte size of the reserved space
// for the adjoining generations.
size_t reserved_byte_size();
// Return new AdjoiningGenerations instance.
static AdjoiningGenerations* create_adjoining_generations(ReservedSpace rs);
};
#endif // SHARE_GC_PARALLEL_ADJOININGGENERATIONS_HPP

View file

@ -1,60 +0,0 @@
/*
* Copyright (c) 2003, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "gc/parallel/adjoiningVirtualSpaces.hpp"
#include "memory/allocation.inline.hpp"
#include "runtime/java.hpp"
AdjoiningVirtualSpaces::AdjoiningVirtualSpaces(ReservedSpace rs,
size_t min_low_byte_size,
size_t min_high_byte_size,
size_t alignment) :
_high(NULL), _low(NULL),
_reserved_space(rs), _min_low_byte_size(min_low_byte_size),
_min_high_byte_size(min_high_byte_size),
_alignment(alignment) {}
// The maximum byte sizes are for the initial layout of the
// virtual spaces and are not the limit on the maximum bytes sizes.
void AdjoiningVirtualSpaces::initialize(size_t max_low_byte_size,
size_t init_low_byte_size,
size_t init_high_byte_size) {
// The reserved spaces for the two parts of the virtual space.
ReservedSpace old_rs = _reserved_space.first_part(max_low_byte_size);
ReservedSpace young_rs = _reserved_space.last_part(max_low_byte_size);
_low = new PSVirtualSpace(old_rs, alignment());
if (!_low->expand_by(init_low_byte_size)) {
vm_exit_during_initialization("Could not reserve enough space for "
"object heap");
}
_high = new PSVirtualSpaceHighToLow(young_rs, alignment());
if (!_high->expand_by(init_high_byte_size)) {
vm_exit_during_initialization("Could not reserve enough space for "
"object heap");
}
}

View file

@ -1,110 +0,0 @@
/*
* Copyright (c) 2003, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_GC_PARALLEL_ADJOININGVIRTUALSPACES_HPP
#define SHARE_GC_PARALLEL_ADJOININGVIRTUALSPACES_HPP
#include "gc/parallel/psVirtualspace.hpp"
// Contains two virtual spaces that each can individually span
// most of the reserved region but committed parts of which
// cannot overlap.
//
// +-------+ <--- high_boundary for H
// | |
// | H |
// | |
// | |
// | |
// --------- <--- low for H
// | |
// ========= <--- low_boundary for H, high_boundary for L
// | |
// | |
// | |
// --------- <--- high for L
// | |
// | L |
// | |
// | |
// | |
// +-------+ <--- low_boundary for L
//
// Each virtual space in the AdjoiningVirtualSpaces grows and shrink
// within its reserved region (between the low_boundary and the
// boundary) independently. If L want to grow above its high_boundary,
// then the high_boundary of L and the low_boundary of H must be
// moved up consistently. AdjoiningVirtualSpaces provide the
// interfaces for moving the this boundary.
class AdjoiningVirtualSpaces : public CHeapObj<mtGC> {
protected:
// space at the high end and the low end, respectively
PSVirtualSpace* _high;
PSVirtualSpace* _low;
// The reserved space spanned by the two spaces.
ReservedSpace _reserved_space;
// The minimum byte size for the low space. It will not
// be shrunk below this value.
size_t _min_low_byte_size;
// Same for the high space
size_t _min_high_byte_size;
const size_t _alignment;
public:
// Allocates two virtual spaces that will be located at the
// high and low ends. Does no initialization.
AdjoiningVirtualSpaces(ReservedSpace rs,
size_t min_low_byte_size,
size_t min_high_byte_size,
size_t alignment);
// accessors
PSVirtualSpace* high() { return _high; }
PSVirtualSpace* low() { return _low; }
ReservedSpace reserved_space() { return _reserved_space; }
size_t min_low_byte_size() { return _min_low_byte_size; }
size_t min_high_byte_size() { return _min_high_byte_size; }
size_t alignment() const { return _alignment; }
// Maximum byte size for the high space.
size_t high_byte_size_limit() {
return _reserved_space.size() - _min_low_byte_size;
}
// Maximum byte size for the low space.
size_t low_byte_size_limit() {
return _reserved_space.size() - _min_high_byte_size;
}
// Sets the boundaries for the virtual spaces and commits and
// initial size;
void initialize(size_t max_low_byte_size,
size_t init_low_byte_size,
size_t init_high_byte_size);
};
#endif // SHARE_GC_PARALLEL_ADJOININGVIRTUALSPACES_HPP

View file

@ -24,8 +24,6 @@
#include "precompiled.hpp"
#include "code/codeCache.hpp"
#include "gc/parallel/adjoiningGenerations.hpp"
#include "gc/parallel/adjoiningVirtualSpaces.hpp"
#include "gc/parallel/parallelArguments.hpp"
#include "gc/parallel/objectStartArray.inline.hpp"
#include "gc/parallel/parallelScavengeHeap.inline.hpp"
@ -80,19 +78,34 @@ jint ParallelScavengeHeap::initialize() {
BarrierSet::set_barrier_set(barrier_set);
// Make up the generations
// Calculate the maximum size that a generation can grow. This
// includes growth into the other generation. Note that the
// parameter _max_gen_size is kept as the maximum
// size of the generation as the boundaries currently stand.
// _max_gen_size is still used as that value.
assert(MinOldSize <= OldSize && OldSize <= MaxOldSize, "Parameter check");
assert(MinNewSize <= NewSize && NewSize <= MaxNewSize, "Parameter check");
// Layout the reserved space for the generations.
// If OldGen is allocated on nv-dimm, we need to split the reservation (this is required for windows).
ReservedSpace old_rs = heap_rs.first_part(MaxOldSize, ParallelArguments::is_heterogeneous_heap() /* split */);
ReservedSpace young_rs = heap_rs.last_part(MaxOldSize);
assert(young_rs.size() == MaxNewSize, "Didn't reserve all of the heap");
// Create and initialize the generations.
_young_gen = new PSYoungGen(
young_rs,
NewSize,
MinNewSize,
MaxNewSize);
_old_gen = new PSOldGen(
old_rs,
OldSize,
MinOldSize,
MaxOldSize,
"old", 1);
assert(young_gen()->gen_size_limit() == young_rs.size(),"Consistency check");
assert(old_gen()->gen_size_limit() == old_rs.size(), "Consistency check");
double max_gc_pause_sec = ((double) MaxGCPauseMillis)/1000.0;
double max_gc_minor_pause_sec = ((double) MaxGCMinorPauseMillis)/1000.0;
_gens = AdjoiningGenerations::create_adjoining_generations(heap_rs);
_old_gen = _gens->old_gen();
_young_gen = _gens->young_gen();
const size_t eden_capacity = _young_gen->eden_space()->capacity_in_bytes();
const size_t old_capacity = _old_gen->capacity_in_bytes();
const size_t initial_promo_size = MIN2(eden_capacity, old_capacity);

View file

@ -63,9 +63,6 @@ class ParallelScavengeHeap : public CollectedHeap {
SoftRefPolicy _soft_ref_policy;
// Collection of generations that are adjacent in the
// space reserved for the heap.
AdjoiningGenerations* _gens;
unsigned int _death_march_count;
GCMemoryManager* _young_manager;
@ -92,7 +89,6 @@ class ParallelScavengeHeap : public CollectedHeap {
public:
ParallelScavengeHeap() :
CollectedHeap(),
_gens(NULL),
_death_march_count(0),
_young_manager(NULL),
_old_manager(NULL),
@ -135,8 +131,6 @@ class ParallelScavengeHeap : public CollectedHeap {
CardTableBarrierSet* barrier_set();
PSCardTable* card_table();
AdjoiningGenerations* gens() { return _gens; }
// Returns JNI_OK on success
virtual jint initialize();

View file

@ -38,22 +38,14 @@
#include "runtime/java.hpp"
#include "utilities/align.hpp"
PSOldGen::PSOldGen(ReservedSpace rs, size_t alignment,
size_t initial_size, size_t min_size, size_t max_size,
const char* perf_data_name, int level):
PSOldGen::PSOldGen(ReservedSpace rs, size_t initial_size, size_t min_size,
size_t max_size, const char* perf_data_name, int level):
_init_gen_size(initial_size), _min_gen_size(min_size),
_max_gen_size(max_size)
{
initialize(rs, alignment, perf_data_name, level);
initialize(rs, GenAlignment, perf_data_name, level);
}
PSOldGen::PSOldGen(size_t initial_size,
size_t min_size, size_t max_size,
const char* perf_data_name, int level):
_init_gen_size(initial_size), _min_gen_size(min_size),
_max_gen_size(max_size)
{}
void PSOldGen::initialize(ReservedSpace rs, size_t alignment,
const char* perf_data_name, int level) {
initialize_virtual_space(rs, alignment);
@ -158,10 +150,6 @@ bool PSOldGen::is_allocated() {
return virtual_space()->reserved_size() != 0;
}
size_t PSOldGen::contiguous_available() const {
return object_space()->free_in_bytes() + virtual_space()->uncommitted_size();
}
// Allocation. We report all successful allocations to the size policy
// Note that the perm gen does not use this method, and should not!
HeapWord* PSOldGen::allocate(size_t word_size) {
@ -374,21 +362,6 @@ size_t PSOldGen::gen_size_limit() {
return _max_gen_size;
}
void PSOldGen::reset_after_change() {
ShouldNotReachHere();
return;
}
size_t PSOldGen::available_for_expansion() {
ShouldNotReachHere();
return 0;
}
size_t PSOldGen::available_for_contraction() {
ShouldNotReachHere();
return 0;
}
void PSOldGen::print() const { print_on(tty);}
void PSOldGen::print_on(outputStream* st) const {
st->print(" %-15s", name());
@ -409,29 +382,10 @@ void PSOldGen::update_counters() {
}
}
#ifndef PRODUCT
void PSOldGen::space_invariants() {
assert(object_space()->end() == (HeapWord*) virtual_space()->high(),
"Space invariant");
assert(object_space()->bottom() == (HeapWord*) virtual_space()->low(),
"Space invariant");
assert(virtual_space()->low_boundary() <= virtual_space()->low(),
"Space invariant");
assert(virtual_space()->high_boundary() >= virtual_space()->high(),
"Space invariant");
assert(virtual_space()->low_boundary() == (char*) _reserved.start(),
"Space invariant");
assert(virtual_space()->high_boundary() == (char*) _reserved.end(),
"Space invariant");
assert(virtual_space()->committed_size() <= virtual_space()->reserved_size(),
"Space invariant");
}
#endif
void PSOldGen::verify() {
object_space()->verify();
}
class VerifyObjectStartArrayClosure : public ObjectClosure {
PSOldGen* _old_gen;
ObjectStartArray* _start_array;

View file

@ -38,7 +38,7 @@ class PSOldGen : public CHeapObj<mtGC> {
friend class ParallelScavengeHeap;
friend class AdjoiningGenerations;
protected:
private:
MemRegion _reserved; // Used for simple containment tests
PSVirtualSpace* _virtual_space; // Controls mapping and unmapping of virtual mem
ObjectStartArray _start_array; // Keeps track of where objects start in a 512b block
@ -110,20 +110,16 @@ class PSOldGen : public CHeapObj<mtGC> {
void post_resize();
public:
// Initialize the generation.
PSOldGen(ReservedSpace rs, size_t alignment,
size_t initial_size, size_t min_size, size_t max_size,
const char* perf_data_name, int level);
PSOldGen(size_t initial_size, size_t min_size, size_t max_size,
const char* perf_data_name, int level);
virtual void initialize(ReservedSpace rs, size_t alignment,
void initialize(ReservedSpace rs, size_t alignment,
const char* perf_data_name, int level);
void initialize_virtual_space(ReservedSpace rs, size_t alignment);
virtual void initialize_work(const char* perf_data_name, int level);
virtual void initialize_performance_counters(const char* perf_data_name, int level);
void initialize_work(const char* perf_data_name, int level);
void initialize_performance_counters(const char* perf_data_name, int level);
public:
// Initialize the generation.
PSOldGen(ReservedSpace rs, size_t initial_size, size_t min_size,
size_t max_size, const char* perf_data_name, int level);
MemRegion reserved() const { return _reserved; }
virtual size_t max_gen_size() { return _max_gen_size; }
@ -158,9 +154,6 @@ class PSOldGen : public CHeapObj<mtGC> {
size_t used_in_words() const { return object_space()->used_in_words(); }
size_t free_in_words() const { return object_space()->free_in_words(); }
// Includes uncommitted memory
size_t contiguous_available() const;
bool is_maximal_no_gc() const {
return virtual_space()->uncommitted_size() == 0;
}
@ -177,26 +170,17 @@ class PSOldGen : public CHeapObj<mtGC> {
void object_iterate(ObjectClosure* cl) { object_space()->object_iterate(cl); }
// Debugging - do not use for time critical operations
virtual void print() const;
void print() const;
virtual void print_on(outputStream* st) const;
void verify();
void verify_object_start_array();
// These should not used
virtual void reset_after_change();
// These should not used
virtual size_t available_for_expansion();
virtual size_t available_for_contraction();
void space_invariants() PRODUCT_RETURN;
// Performance Counter support
void update_counters();
// Printing support
virtual const char* name() const { return "ParOldGen"; }
const char* name() const { return "ParOldGen"; }
// Debugging support
// Save the tops of all spaces for later use during mangling.

View file

@ -225,120 +225,3 @@ void PSVirtualSpace::print_space_boundaries_on(outputStream* st) const {
st->print_cr(" [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ")",
p2i(low_boundary()), p2i(high()), p2i(high_boundary()));
}
PSVirtualSpaceHighToLow::PSVirtualSpaceHighToLow(ReservedSpace rs,
size_t alignment) :
PSVirtualSpace(alignment)
{
set_reserved(rs);
set_committed(reserved_high_addr(), reserved_high_addr());
DEBUG_ONLY(verify());
}
PSVirtualSpaceHighToLow::PSVirtualSpaceHighToLow(ReservedSpace rs) {
set_reserved(rs);
set_committed(reserved_high_addr(), reserved_high_addr());
DEBUG_ONLY(verify());
}
bool PSVirtualSpaceHighToLow::expand_by(size_t bytes) {
assert(is_aligned(bytes), "arg not aligned");
DEBUG_ONLY(PSVirtualSpaceVerifier this_verifier(this));
if (uncommitted_size() < bytes) {
return false;
}
char* const base_addr = committed_low_addr() - bytes;
bool result = special() ||
os::commit_memory(base_addr, bytes, alignment(), !ExecMem);
if (result) {
_committed_low_addr -= bytes;
}
return result;
}
bool PSVirtualSpaceHighToLow::shrink_by(size_t bytes) {
assert(is_aligned(bytes), "arg not aligned");
DEBUG_ONLY(PSVirtualSpaceVerifier this_verifier(this));
if (committed_size() < bytes) {
return false;
}
char* const base_addr = committed_low_addr();
bool result = special() || os::uncommit_memory(base_addr, bytes);
if (result) {
_committed_low_addr += bytes;
}
return result;
}
size_t PSVirtualSpaceHighToLow::expand_into(PSVirtualSpace* other_space,
size_t bytes) {
assert(is_aligned(bytes), "arg not aligned");
assert(grows_down(), "this space must grow down");
assert(other_space->grows_up(), "other space must grow up");
assert(reserved_low_addr() == other_space->reserved_high_addr(),
"spaces not contiguous");
assert(special() == other_space->special(), "one space is special in memory, the other is not");
DEBUG_ONLY(PSVirtualSpaceVerifier this_verifier(this));
DEBUG_ONLY(PSVirtualSpaceVerifier other_verifier(other_space));
size_t bytes_needed = bytes;
// First use the uncommitted region in this space.
size_t tmp_bytes = MIN2(uncommitted_size(), bytes_needed);
if (tmp_bytes > 0) {
if (expand_by(tmp_bytes)) {
bytes_needed -= tmp_bytes;
} else {
return 0;
}
}
// Next take from the uncommitted region in the other space, and commit it.
tmp_bytes = MIN2(other_space->uncommitted_size(), bytes_needed);
if (tmp_bytes > 0) {
char* const commit_base = committed_low_addr() - tmp_bytes;
if (other_space->special() ||
os::commit_memory(commit_base, tmp_bytes, alignment(), !ExecMem)) {
// Reduce the reserved region in the other space.
other_space->set_reserved(other_space->reserved_low_addr(),
other_space->reserved_high_addr() - tmp_bytes,
other_space->special());
// Grow both reserved and committed in this space.
_reserved_low_addr -= tmp_bytes;
_committed_low_addr -= tmp_bytes;
bytes_needed -= tmp_bytes;
} else {
return bytes - bytes_needed;
}
}
// Finally take from the already committed region in the other space.
tmp_bytes = bytes_needed;
if (tmp_bytes > 0) {
// Reduce both committed and reserved in the other space.
other_space->set_committed(other_space->committed_low_addr(),
other_space->committed_high_addr() - tmp_bytes);
other_space->set_reserved(other_space->reserved_low_addr(),
other_space->reserved_high_addr() - tmp_bytes,
other_space->special());
// Grow both reserved and committed in this space.
_reserved_low_addr -= tmp_bytes;
_committed_low_addr -= tmp_bytes;
}
return bytes;
}
void
PSVirtualSpaceHighToLow::print_space_boundaries_on(outputStream* st) const {
st->print_cr(" (" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT "]",
p2i(high_boundary()), p2i(low()), p2i(low_boundary()));
}

View file

@ -132,25 +132,6 @@ class PSVirtualSpace : public CHeapObj<mtGC> {
char* high_boundary() const { return reserved_high_addr(); }
};
// A virtual space that grows from high addresses to low addresses.
class PSVirtualSpaceHighToLow : public PSVirtualSpace {
friend class VMStructs;
public:
PSVirtualSpaceHighToLow(ReservedSpace rs, size_t alignment);
PSVirtualSpaceHighToLow(ReservedSpace rs);
virtual bool expand_by(size_t bytes);
virtual bool shrink_by(size_t bytes);
virtual size_t expand_into(PSVirtualSpace* space, size_t bytes);
virtual void print_space_boundaries_on(outputStream* st) const;
#ifndef PRODUCT
// Debugging
virtual bool grows_up() const { return false; }
#endif
};
//
// PSVirtualSpace inlines.
//

View file

@ -35,7 +35,7 @@
#include "runtime/java.hpp"
#include "utilities/align.hpp"
PSYoungGen::PSYoungGen(size_t initial_size, size_t min_size, size_t max_size) :
PSYoungGen::PSYoungGen(ReservedSpace rs, size_t initial_size, size_t min_size, size_t max_size) :
_reserved(),
_virtual_space(NULL),
_eden_space(NULL),
@ -48,7 +48,9 @@ PSYoungGen::PSYoungGen(size_t initial_size, size_t min_size, size_t max_size) :
_eden_counters(NULL),
_from_counters(NULL),
_to_counters(NULL)
{}
{
initialize(rs, GenAlignment);
}
void PSYoungGen::initialize_virtual_space(ReservedSpace rs, size_t alignment) {
assert(_init_gen_size != 0, "Should have a finite size");
@ -711,16 +713,6 @@ void PSYoungGen::print_on(outputStream* st) const {
st->print(" to "); to_space()->print_on(st);
}
size_t PSYoungGen::available_for_expansion() {
ShouldNotReachHere();
return 0;
}
size_t PSYoungGen::available_for_contraction() {
ShouldNotReachHere();
return 0;
}
size_t PSYoungGen::available_to_min_gen() {
assert(virtual_space()->committed_size() >= min_gen_size(), "Invariant");
return virtual_space()->committed_size() - min_gen_size();
@ -773,10 +765,6 @@ size_t PSYoungGen::limit_gen_shrink(size_t bytes) {
return align_down(bytes, virtual_space()->alignment());
}
void PSYoungGen::reset_after_change() {
ShouldNotReachHere();
}
void PSYoungGen::reset_survivors_after_shrink() {
_reserved = MemRegion((HeapWord*)virtual_space()->low_boundary(),
(HeapWord*)virtual_space()->high_boundary());

View file

@ -36,7 +36,7 @@ class PSYoungGen : public CHeapObj<mtGC> {
friend class ParallelScavengeHeap;
friend class AdjoiningGenerations;
protected:
private:
MemRegion _reserved;
PSVirtualSpace* _virtual_space;
@ -62,35 +62,32 @@ class PSYoungGen : public CHeapObj<mtGC> {
// Space boundary helper
void set_space_boundaries(size_t eden_size, size_t survivor_size);
virtual bool resize_generation(size_t eden_size, size_t survivor_size);
virtual void resize_spaces(size_t eden_size, size_t survivor_size);
bool resize_generation(size_t eden_size, size_t survivor_size);
void resize_spaces(size_t eden_size, size_t survivor_size);
// Adjust the spaces to be consistent with the virtual space.
void post_resize();
// Return number of bytes that the generation can change.
// These should not be used by PSYoungGen
virtual size_t available_for_expansion();
virtual size_t available_for_contraction();
// Given a desired shrinkage in the size of the young generation,
// return the actual size available for shrinkage.
virtual size_t limit_gen_shrink(size_t desired_change);
size_t limit_gen_shrink(size_t desired_change);
// returns the number of bytes available from the current size
// down to the minimum generation size.
size_t available_to_min_gen();
// Return the number of bytes available for shrinkage considering
// the location the live data in the generation.
virtual size_t available_to_live();
size_t available_to_live();
void initialize(ReservedSpace rs, size_t alignment);
void initialize_work();
void initialize_virtual_space(ReservedSpace rs, size_t alignment);
public:
// Initialize the generation.
PSYoungGen(size_t initial_byte_size,
PSYoungGen(ReservedSpace rs,
size_t initial_byte_size,
size_t minimum_byte_size,
size_t maximum_byte_size);
void initialize_work();
virtual void initialize(ReservedSpace rs, size_t alignment);
virtual void initialize_virtual_space(ReservedSpace rs, size_t alignment);
MemRegion reserved() const { return _reserved; }
@ -151,16 +148,15 @@ class PSYoungGen : public CHeapObj<mtGC> {
void oop_iterate(OopIterateClosure* cl);
void object_iterate(ObjectClosure* cl);
virtual void reset_after_change();
virtual void reset_survivors_after_shrink();
void reset_survivors_after_shrink();
// Performance Counter support
void update_counters();
// Debugging - do not use for time critical operations
void print() const;
void print_on(outputStream* st) const;
virtual const char* name() const { return "PSYoungGen"; }
virtual void print_on(outputStream* st) const;
const char* name() const { return "PSYoungGen"; }
void verify();

View file

@ -94,7 +94,6 @@
#endif // INCLUDE_G1GC
#if INCLUDE_PARALLELGC
#include "gc/parallel/parallelScavengeHeap.inline.hpp"
#include "gc/parallel/adjoiningGenerations.hpp"
#endif // INCLUDE_PARALLELGC
#if INCLUDE_NMT
#include "services/mallocSiteTable.hpp"
@ -607,7 +606,7 @@ WB_END
WB_ENTRY(jlong, WB_PSVirtualSpaceAlignment(JNIEnv* env, jobject o))
if (UseParallelGC) {
return ParallelScavengeHeap::heap()->gens()->virtual_spaces()->alignment();
return GenAlignment;
}
THROW_MSG_0(vmSymbols::java_lang_UnsupportedOperationException(), "WB_PSVirtualSpaceAlignment: Parallel GC is not enabled");
WB_END