mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 03:24:38 +02:00
8026853: Prepare GC code for collector policy regression fix
Cleanup related to the NewSize and MaxNewSize bugs Reviewed-by: tschatzl, jcoomes, ehelin
This commit is contained in:
parent
5976b6915a
commit
9705a6e3f9
12 changed files with 39 additions and 55 deletions
|
@ -160,7 +160,7 @@ size_t GenCollectorPolicy::bound_minus_alignment(size_t desired_size,
|
|||
void GenCollectorPolicy::initialize_size_policy(size_t init_eden_size,
|
||||
size_t init_promo_size,
|
||||
size_t init_survivor_size) {
|
||||
const double max_gc_pause_sec = ((double) MaxGCPauseMillis)/1000.0;
|
||||
const double max_gc_pause_sec = ((double) MaxGCPauseMillis) / 1000.0;
|
||||
_size_policy = new AdaptiveSizePolicy(init_eden_size,
|
||||
init_promo_size,
|
||||
init_survivor_size,
|
||||
|
@ -192,6 +192,7 @@ void GenCollectorPolicy::initialize_flags() {
|
|||
// make sure there room for eden and two survivor spaces
|
||||
vm_exit_during_initialization("Too small new size specified");
|
||||
}
|
||||
|
||||
if (SurvivorRatio < 1 || NewRatio < 1) {
|
||||
vm_exit_during_initialization("Invalid young gen ratio specified");
|
||||
}
|
||||
|
@ -465,7 +466,7 @@ void TwoGenerationCollectorPolicy::initialize_size_info() {
|
|||
"generation sizes: using minimum heap = " SIZE_FORMAT,
|
||||
_min_heap_byte_size);
|
||||
}
|
||||
if ((OldSize > _max_gen1_size)) {
|
||||
if (OldSize > _max_gen1_size) {
|
||||
warning("Inconsistency between maximum heap size and maximum "
|
||||
"generation sizes: using maximum heap = " SIZE_FORMAT
|
||||
" -XX:OldSize flag is being ignored",
|
||||
|
@ -596,9 +597,7 @@ HeapWord* GenCollectorPolicy::mem_allocate_work(size_t size,
|
|||
gc_count_before = Universe::heap()->total_collections();
|
||||
}
|
||||
|
||||
VM_GenCollectForAllocation op(size,
|
||||
is_tlab,
|
||||
gc_count_before);
|
||||
VM_GenCollectForAllocation op(size, is_tlab, gc_count_before);
|
||||
VMThread::execute(&op);
|
||||
if (op.prologue_succeeded()) {
|
||||
result = op.result();
|
||||
|
@ -833,8 +832,9 @@ MarkSweepPolicy::MarkSweepPolicy() {
|
|||
|
||||
void MarkSweepPolicy::initialize_generations() {
|
||||
_generations = NEW_C_HEAP_ARRAY3(GenerationSpecPtr, number_of_generations(), mtGC, 0, AllocFailStrategy::RETURN_NULL);
|
||||
if (_generations == NULL)
|
||||
if (_generations == NULL) {
|
||||
vm_exit_during_initialization("Unable to allocate gen spec");
|
||||
}
|
||||
|
||||
if (UseParNewGC) {
|
||||
_generations[0] = new GenerationSpec(Generation::ParNew, _initial_gen0_size, _max_gen0_size);
|
||||
|
@ -843,8 +843,9 @@ void MarkSweepPolicy::initialize_generations() {
|
|||
}
|
||||
_generations[1] = new GenerationSpec(Generation::MarkSweepCompact, _initial_gen1_size, _max_gen1_size);
|
||||
|
||||
if (_generations[0] == NULL || _generations[1] == NULL)
|
||||
if (_generations[0] == NULL || _generations[1] == NULL) {
|
||||
vm_exit_during_initialization("Unable to allocate gen spec");
|
||||
}
|
||||
}
|
||||
|
||||
void MarkSweepPolicy::initialize_gc_policy_counters() {
|
||||
|
|
|
@ -79,6 +79,7 @@ class CollectorPolicy : public CHeapObj<mtGC> {
|
|||
// Set to true when policy wants soft refs cleared.
|
||||
// Reset to false by gc after it clears all soft refs.
|
||||
bool _should_clear_all_soft_refs;
|
||||
|
||||
// Set to true by the GC if the just-completed gc cleared all
|
||||
// softrefs. This is set to true whenever a gc clears all softrefs, and
|
||||
// set to false each time gc returns to the mutator. For example, in the
|
||||
|
@ -101,8 +102,8 @@ class CollectorPolicy : public CHeapObj<mtGC> {
|
|||
// Return maximum heap alignment that may be imposed by the policy
|
||||
static size_t compute_max_alignment();
|
||||
|
||||
size_t min_alignment() { return _min_alignment; }
|
||||
size_t max_alignment() { return _max_alignment; }
|
||||
size_t min_alignment() { return _min_alignment; }
|
||||
size_t max_alignment() { return _max_alignment; }
|
||||
|
||||
size_t initial_heap_byte_size() { return _initial_heap_byte_size; }
|
||||
size_t max_heap_byte_size() { return _max_heap_byte_size; }
|
||||
|
@ -248,7 +249,7 @@ class GenCollectorPolicy : public CollectorPolicy {
|
|||
|
||||
virtual int number_of_generations() = 0;
|
||||
|
||||
virtual GenerationSpec **generations() {
|
||||
virtual GenerationSpec **generations() {
|
||||
assert(_generations != NULL, "Sanity check");
|
||||
return _generations;
|
||||
}
|
||||
|
@ -273,6 +274,12 @@ class GenCollectorPolicy : public CollectorPolicy {
|
|||
virtual void initialize_size_policy(size_t init_eden_size,
|
||||
size_t init_promo_size,
|
||||
size_t init_survivor_size);
|
||||
|
||||
// The alignment used for eden and survivors within the young gen
|
||||
// and for boundary between young gen and old gen.
|
||||
static size_t intra_heap_alignment() {
|
||||
return 64 * K * HeapWordSize;
|
||||
}
|
||||
};
|
||||
|
||||
// All of hotspot's current collectors are subtypes of this
|
||||
|
@ -300,8 +307,8 @@ class TwoGenerationCollectorPolicy : public GenCollectorPolicy {
|
|||
// Inherited methods
|
||||
TwoGenerationCollectorPolicy* as_two_generation_policy() { return this; }
|
||||
|
||||
int number_of_generations() { return 2; }
|
||||
BarrierSet::Name barrier_set_name() { return BarrierSet::CardTableModRef; }
|
||||
int number_of_generations() { return 2; }
|
||||
BarrierSet::Name barrier_set_name() { return BarrierSet::CardTableModRef; }
|
||||
|
||||
virtual CollectorPolicy::Name kind() {
|
||||
return CollectorPolicy::TwoGenerationCollectorPolicyKind;
|
||||
|
|
|
@ -1053,12 +1053,6 @@ void GenCollectedHeap::save_marks() {
|
|||
}
|
||||
}
|
||||
|
||||
void GenCollectedHeap::compute_new_generation_sizes(int collectedGen) {
|
||||
for (int i = 0; i <= collectedGen; i++) {
|
||||
_gens[i]->compute_new_size();
|
||||
}
|
||||
}
|
||||
|
||||
GenCollectedHeap* GenCollectedHeap::heap() {
|
||||
assert(_gch != NULL, "Uninitialized access to GenCollectedHeap::heap()");
|
||||
assert(_gch->kind() == CollectedHeap::GenCollectedHeap, "not a generational heap");
|
||||
|
|
|
@ -86,10 +86,6 @@ public:
|
|||
NOT_PRODUCT(static size_t _skip_header_HeapWords;)
|
||||
|
||||
protected:
|
||||
// Directs each generation up to and including "collectedGen" to recompute
|
||||
// its desired size.
|
||||
void compute_new_generation_sizes(int collectedGen);
|
||||
|
||||
// Helper functions for allocation
|
||||
HeapWord* attempt_allocation(size_t size,
|
||||
bool is_tlab,
|
||||
|
|
|
@ -1021,7 +1021,7 @@ bool universe_post_init() {
|
|||
Universe::_virtual_machine_error_instance =
|
||||
InstanceKlass::cast(k)->allocate_instance(CHECK_false);
|
||||
|
||||
Universe::_vm_exception = InstanceKlass::cast(k)->allocate_instance(CHECK_false);
|
||||
Universe::_vm_exception = InstanceKlass::cast(k)->allocate_instance(CHECK_false);
|
||||
|
||||
if (!DumpSharedSpaces) {
|
||||
// These are the only Java fields that are currently set during shared space dumping.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue