8364166: Parallel: Remove the use of soft_ref_policy in Full GC

Reviewed-by: tschatzl, sangheki
This commit is contained in:
Albert Mingkun Yang 2025-07-31 18:53:07 +00:00
parent 443afdc77f
commit e0e82066fe
2 changed files with 4 additions and 21 deletions

View File

@ -958,18 +958,10 @@ void PSParallelCompact::summary_phase()
}
}
// This method should contain all heap-specific policy for invoking a full
// collection. invoke_no_policy() will only attempt to compact the heap; it
// will do nothing further. If we need to bail out for policy reasons, scavenge
// before full gc, or any other specialized behavior, it needs to be added here.
//
// This method invokes a full collection. The argument controls whether
// soft-refs should be cleared or not.
// Note that this method should only be called from the vm_thread while at a
// safepoint.
//
// Note that the all_soft_refs_clear flag in the soft ref policy
// may be true because this method can be called without intervening
// activity. For example when the heap space is tight and full measure
// are being taken to free space.
bool PSParallelCompact::invoke(bool clear_all_soft_refs) {
assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint");
assert(Thread::current() == (Thread*)VMThread::vm_thread(),
@ -978,10 +970,6 @@ bool PSParallelCompact::invoke(bool clear_all_soft_refs) {
SvcGCMarker sgcm(SvcGCMarker::FULL);
IsSTWGCActiveMark mark;
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
clear_all_soft_refs = clear_all_soft_refs
|| heap->soft_ref_policy()->should_clear_all_soft_refs();
return PSParallelCompact::invoke_no_policy(clear_all_soft_refs);
}
@ -1001,11 +989,6 @@ bool PSParallelCompact::invoke_no_policy(bool clear_all_soft_refs) {
PSOldGen* old_gen = heap->old_gen();
PSAdaptiveSizePolicy* size_policy = heap->size_policy();
// The scope of casr should end after code that can change
// SoftRefPolicy::_should_clear_all_soft_refs.
ClearedAllSoftRefs casr(clear_all_soft_refs,
heap->soft_ref_policy());
// Make sure data structures are sane, make the heap parsable, and do other
// miscellaneous bookkeeping.
pre_compact();

View File

@ -761,8 +761,8 @@ private:
public:
static void fill_dead_objs_in_dense_prefix(uint worker_id, uint num_workers);
static bool invoke(bool maximum_heap_compaction);
static bool invoke_no_policy(bool maximum_heap_compaction);
static bool invoke(bool clear_all_soft_refs);
static bool invoke_no_policy(bool clear_all_soft_refs);
template<typename Func>
static void adjust_in_space_helper(SpaceId id, volatile uint* claim_counter, Func&& on_stripe);