8309403: Serial: Remove the useless adaptive size policy in GenCollectedHeap

Reviewed-by: ayang, tschatzl
This commit is contained in:
Guoxiong Li 2023-06-12 15:52:08 +00:00
parent 5d5ae35288
commit 6cd166a284
6 changed files with 8 additions and 118 deletions

@ -830,10 +830,6 @@ void DefNewGeneration::collect(bool full,
adjust_desired_tenuring_threshold();
// A successful scavenge should restart the GC time limit count which is
// for full GC's.
AdaptiveSizePolicy* size_policy = heap->size_policy();
size_policy->reset_gc_overhead_limit_count();
assert(!heap->incremental_collection_failed(), "Should be clear");
} else {
assert(_promo_failure_scan_stack.is_empty(), "post condition");

@ -95,8 +95,7 @@ GenCollectedHeap::GenCollectedHeap(Generation::Name young,
MaxOldSize,
GenAlignment)),
_rem_set(nullptr),
_soft_ref_gen_policy(),
_size_policy(nullptr),
_soft_ref_policy(),
_gc_policy_counters(new GCPolicyCounters(policy_counters_name, 2, 2)),
_incremental_collection_failed(false),
_full_collections_completed(0),
@ -139,17 +138,6 @@ CardTableRS* GenCollectedHeap::create_rem_set(const MemRegion& reserved_region)
return new CardTableRS(reserved_region);
}
void GenCollectedHeap::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;
_size_policy = new AdaptiveSizePolicy(init_eden_size,
init_promo_size,
init_survivor_size,
max_gc_pause_sec,
GCTimeRatio);
}
ReservedHeapSpace GenCollectedHeap::allocate(size_t alignment) {
// Now figure out the total size.
const size_t pageSize = UseLargePages ? os::large_page_size() : os::vm_page_size();
@ -194,10 +182,6 @@ void GenCollectedHeap::post_initialize() {
def_new_gen->ref_processor_init();
initialize_size_policy(def_new_gen->eden()->capacity(),
_old_gen->capacity(),
def_new_gen->from()->capacity());
MarkSweep::initialize();
ScavengableNMethods::initialize(&_is_scavengable);

@ -29,7 +29,7 @@
#include "gc/shared/generation.hpp"
#include "gc/shared/oopStorageParState.hpp"
#include "gc/shared/preGCValues.hpp"
#include "gc/shared/softRefGenPolicy.hpp"
#include "gc/shared/softRefPolicy.hpp"
class AdaptiveSizePolicy;
class CardTableRS;
@ -72,10 +72,7 @@ private:
// The singleton CardTable Remembered Set.
CardTableRS* _rem_set;
SoftRefGenPolicy _soft_ref_gen_policy;
// The sizing of the heap is controlled by a sizing policy.
AdaptiveSizePolicy* _size_policy;
SoftRefPolicy _soft_ref_policy;
GCPolicyCounters* _gc_policy_counters;
@ -139,10 +136,6 @@ public:
jint initialize() override;
virtual CardTableRS* create_rem_set(const MemRegion& reserved_region);
void initialize_size_policy(size_t init_eden_size,
size_t init_promo_size,
size_t init_survivor_size);
// Does operations required after initialization has been done.
void post_initialize() override;
@ -158,12 +151,7 @@ public:
GenerationSpec* young_gen_spec() const;
GenerationSpec* old_gen_spec() const;
SoftRefPolicy* soft_ref_policy() override { return &_soft_ref_gen_policy; }
// Adaptive size policy
virtual AdaptiveSizePolicy* size_policy() {
return _size_policy;
}
SoftRefPolicy* soft_ref_policy() override { return &_soft_ref_policy; }
// Performance Counter support
GCPolicyCounters* counters() { return _gc_policy_counters; }

@ -1,40 +0,0 @@
/*
* Copyright (c) 2001, 2023, 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/shared/adaptiveSizePolicy.hpp"
#include "gc/shared/genCollectedHeap.hpp"
#include "gc/shared/softRefGenPolicy.hpp"
void SoftRefGenPolicy::cleared_all_soft_refs() {
// If near gc overhear limit, continue to clear SoftRefs. SoftRefs may
// have been cleared in the last collection but if the gc overhear
// limit continues to be near, SoftRefs should still be cleared.
AdaptiveSizePolicy* size_policy = GenCollectedHeap::heap()->size_policy();
if (size_policy != nullptr) {
set_should_clear_all_soft_refs(size_policy->gc_overhead_limit_near());
}
SoftRefPolicy::cleared_all_soft_refs();
}

@ -1,38 +0,0 @@
/*
* Copyright (c) 2001, 2019, 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_SHARED_SOFTREFGENPOLICY_HPP
#define SHARE_GC_SHARED_SOFTREFGENPOLICY_HPP
#include "gc/shared/softRefPolicy.hpp"
#include "utilities/globalDefinitions.hpp"
class AdaptiveSizePolicy;
class SoftRefGenPolicy : public SoftRefPolicy {
public:
virtual void cleared_all_soft_refs();
};
#endif // SHARE_GC_SHARED_SOFTREFGENPOLICY_HPP

@ -1445,12 +1445,12 @@ WB_END
WB_ENTRY(void, WB_FullGC(JNIEnv* env, jobject o))
Universe::heap()->soft_ref_policy()->set_should_clear_all_soft_refs(true);
Universe::heap()->collect(GCCause::_wb_full_gc);
#if INCLUDE_G1GC
if (UseG1GC) {
// Needs to be cleared explicitly for G1
#if INCLUDE_G1GC || INCLUDE_SERIALGC
if (UseG1GC || UseSerialGC) {
// Needs to be cleared explicitly for G1 and Serial GC.
Universe::heap()->soft_ref_policy()->set_should_clear_all_soft_refs(false);
}
#endif // INCLUDE_G1GC
#endif // INCLUDE_G1GC || INCLUDE_SERIALGC
WB_END
WB_ENTRY(void, WB_YoungGC(JNIEnv* env, jobject o))