1.1 --- a/src/share/vm/memory/referenceProcessor.hpp Thu Nov 20 12:27:41 2008 -0800 1.2 +++ b/src/share/vm/memory/referenceProcessor.hpp Thu Nov 20 16:56:09 2008 -0800 1.3 @@ -23,7 +23,7 @@ 1.4 */ 1.5 1.6 // ReferenceProcessor class encapsulates the per-"collector" processing 1.7 -// of "weak" references for GC. The interface is useful for supporting 1.8 +// of java.lang.Reference objects for GC. The interface is useful for supporting 1.9 // a generational abstraction, in particular when there are multiple 1.10 // generations that are being independently collected -- possibly 1.11 // concurrently and/or incrementally. Note, however, that the 1.12 @@ -75,6 +75,14 @@ 1.13 // all collectors but the CMS collector). 1.14 BoolObjectClosure* _is_alive_non_header; 1.15 1.16 + // Soft ref clearing policies 1.17 + // . the default policy 1.18 + static ReferencePolicy* _default_soft_ref_policy; 1.19 + // . the "clear all" policy 1.20 + static ReferencePolicy* _always_clear_soft_ref_policy; 1.21 + // . the current policy below is either one of the above 1.22 + ReferencePolicy* _current_soft_ref_policy; 1.23 + 1.24 // The discovered ref lists themselves 1.25 1.26 // The MT'ness degree of the queues below 1.27 @@ -90,6 +98,12 @@ 1.28 DiscoveredList* discovered_soft_refs() { return _discoveredSoftRefs; } 1.29 static oop sentinel_ref() { return _sentinelRef; } 1.30 static oop* adr_sentinel_ref() { return &_sentinelRef; } 1.31 + ReferencePolicy* snap_policy(bool always_clear) { 1.32 + _current_soft_ref_policy = always_clear ? 1.33 + _always_clear_soft_ref_policy : _default_soft_ref_policy; 1.34 + _current_soft_ref_policy->snap(); // snapshot the policy threshold 1.35 + return _current_soft_ref_policy; 1.36 + } 1.37 1.38 public: 1.39 // Process references with a certain reachability level. 1.40 @@ -297,8 +311,7 @@ 1.41 bool discover_reference(oop obj, ReferenceType rt); 1.42 1.43 // Process references found during GC (called by the garbage collector) 1.44 - void process_discovered_references(ReferencePolicy* policy, 1.45 - BoolObjectClosure* is_alive, 1.46 + void process_discovered_references(BoolObjectClosure* is_alive, 1.47 OopClosure* keep_alive, 1.48 VoidClosure* complete_gc, 1.49 AbstractRefProcTaskExecutor* task_executor);