8365237: Remove unused SoftRefPolicy::_all_soft_refs_clear

Reviewed-by: tschatzl, kbarrett
This commit is contained in:
Albert Mingkun Yang 2025-08-12 11:29:43 +00:00
parent 16e461ef31
commit 95b7a8b3e3
3 changed files with 1 additions and 34 deletions

View file

@ -62,11 +62,6 @@ void VM_Verify::doit() {
Universe::verify();
}
VM_GC_Operation::~VM_GC_Operation() {
CollectedHeap* ch = Universe::heap();
ch->soft_ref_policy()->set_all_soft_refs_clear(false);
}
const char* VM_GC_Operation::cause() const {
return GCCause::to_string(_gc_cause);
}

View file

@ -126,16 +126,7 @@ class VM_GC_Operation: public VM_Heap_Sync_Operation {
_gc_cause = _cause;
_full_gc_count_before = full_gc_count_before;
// In ParallelScavengeHeap::mem_allocate() collections can be
// executed within a loop and _all_soft_refs_clear can be set
// true after they have been cleared by a collection and another
// collection started so that _all_soft_refs_clear can be true
// when this collection is started. Don't assert that
// _all_soft_refs_clear have to be false here even though
// mutators have run. Soft refs will be cleared again in this
// collection.
}
~VM_GC_Operation();
virtual const char* cause() const;

View file

@ -25,37 +25,18 @@
#ifndef SHARE_GC_SHARED_SOFTREFPOLICY_HPP
#define SHARE_GC_SHARED_SOFTREFPOLICY_HPP
#include "memory/allocation.hpp"
class SoftRefPolicy {
private:
// 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
// ParallelScavengeHeap case the latter would be done toward the end of
// mem_allocate() where it returns op.result()
bool _all_soft_refs_clear;
public:
SoftRefPolicy() :
_should_clear_all_soft_refs(false),
_all_soft_refs_clear(false) {}
_should_clear_all_soft_refs(false) {}
bool should_clear_all_soft_refs() { return _should_clear_all_soft_refs; }
void set_should_clear_all_soft_refs(bool v) { _should_clear_all_soft_refs = v; }
bool all_soft_refs_clear() { return _all_soft_refs_clear; }
void set_all_soft_refs_clear(bool v) { _all_soft_refs_clear = v; }
// Called by the GC after Soft Refs have been cleared to indicate
// that the request in _should_clear_all_soft_refs has been fulfilled.
void cleared_all_soft_refs() {
_all_soft_refs_clear = true;
}
};
#endif // SHARE_GC_SHARED_SOFTREFPOLICY_HPP