mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
6684579: SoftReference processing can be made more efficient
For current soft-ref clearing policies, we can decide at marking time if a soft-reference will definitely not be cleared, postponing the decision of whether it will definitely be cleared to the final reference processing phase. This can be especially beneficial in the case of concurrent collectors where the marking is usually concurrent but reference processing is usually not. Reviewed-by: jmasa
This commit is contained in:
parent
db6bef2c70
commit
7d7cf3f8af
18 changed files with 137 additions and 164 deletions
|
@ -23,7 +23,7 @@
|
|||
*/
|
||||
|
||||
// ReferenceProcessor class encapsulates the per-"collector" processing
|
||||
// of "weak" references for GC. The interface is useful for supporting
|
||||
// of java.lang.Reference objects for GC. The interface is useful for supporting
|
||||
// a generational abstraction, in particular when there are multiple
|
||||
// generations that are being independently collected -- possibly
|
||||
// concurrently and/or incrementally. Note, however, that the
|
||||
|
@ -75,6 +75,14 @@ class ReferenceProcessor : public CHeapObj {
|
|||
// all collectors but the CMS collector).
|
||||
BoolObjectClosure* _is_alive_non_header;
|
||||
|
||||
// Soft ref clearing policies
|
||||
// . the default policy
|
||||
static ReferencePolicy* _default_soft_ref_policy;
|
||||
// . the "clear all" policy
|
||||
static ReferencePolicy* _always_clear_soft_ref_policy;
|
||||
// . the current policy below is either one of the above
|
||||
ReferencePolicy* _current_soft_ref_policy;
|
||||
|
||||
// The discovered ref lists themselves
|
||||
|
||||
// The MT'ness degree of the queues below
|
||||
|
@ -90,6 +98,12 @@ class ReferenceProcessor : public CHeapObj {
|
|||
DiscoveredList* discovered_soft_refs() { return _discoveredSoftRefs; }
|
||||
static oop sentinel_ref() { return _sentinelRef; }
|
||||
static oop* adr_sentinel_ref() { return &_sentinelRef; }
|
||||
ReferencePolicy* snap_policy(bool always_clear) {
|
||||
_current_soft_ref_policy = always_clear ?
|
||||
_always_clear_soft_ref_policy : _default_soft_ref_policy;
|
||||
_current_soft_ref_policy->snap(); // snapshot the policy threshold
|
||||
return _current_soft_ref_policy;
|
||||
}
|
||||
|
||||
public:
|
||||
// Process references with a certain reachability level.
|
||||
|
@ -297,8 +311,7 @@ class ReferenceProcessor : public CHeapObj {
|
|||
bool discover_reference(oop obj, ReferenceType rt);
|
||||
|
||||
// Process references found during GC (called by the garbage collector)
|
||||
void process_discovered_references(ReferencePolicy* policy,
|
||||
BoolObjectClosure* is_alive,
|
||||
void process_discovered_references(BoolObjectClosure* is_alive,
|
||||
OopClosure* keep_alive,
|
||||
VoidClosure* complete_gc,
|
||||
AbstractRefProcTaskExecutor* task_executor);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue