Mercurial > hg > graal-jvmci-8
comparison src/share/vm/memory/referenceProcessor.hpp @ 453:c96030fff130
6684579: SoftReference processing can be made more efficient
Summary: 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
author | ysr |
---|---|
date | Thu, 20 Nov 2008 16:56:09 -0800 |
parents | 1ee8caae33af |
children | 27a80744a83b |
comparison
equal
deleted
inserted
replaced
452:00b023ae2d78 | 453:c96030fff130 |
---|---|
21 * have any questions. | 21 * have any questions. |
22 * | 22 * |
23 */ | 23 */ |
24 | 24 |
25 // ReferenceProcessor class encapsulates the per-"collector" processing | 25 // ReferenceProcessor class encapsulates the per-"collector" processing |
26 // of "weak" references for GC. The interface is useful for supporting | 26 // of java.lang.Reference objects for GC. The interface is useful for supporting |
27 // a generational abstraction, in particular when there are multiple | 27 // a generational abstraction, in particular when there are multiple |
28 // generations that are being independently collected -- possibly | 28 // generations that are being independently collected -- possibly |
29 // concurrently and/or incrementally. Note, however, that the | 29 // concurrently and/or incrementally. Note, however, that the |
30 // ReferenceProcessor class abstracts away from a generational setting | 30 // ReferenceProcessor class abstracts away from a generational setting |
31 // by using only a heap interval (called "span" below), thus allowing | 31 // by using only a heap interval (called "span" below), thus allowing |
73 // helps the reference processor determine the reachability | 73 // helps the reference processor determine the reachability |
74 // of an oop (the field is currently initialized to NULL for | 74 // of an oop (the field is currently initialized to NULL for |
75 // all collectors but the CMS collector). | 75 // all collectors but the CMS collector). |
76 BoolObjectClosure* _is_alive_non_header; | 76 BoolObjectClosure* _is_alive_non_header; |
77 | 77 |
78 // Soft ref clearing policies | |
79 // . the default policy | |
80 static ReferencePolicy* _default_soft_ref_policy; | |
81 // . the "clear all" policy | |
82 static ReferencePolicy* _always_clear_soft_ref_policy; | |
83 // . the current policy below is either one of the above | |
84 ReferencePolicy* _current_soft_ref_policy; | |
85 | |
78 // The discovered ref lists themselves | 86 // The discovered ref lists themselves |
79 | 87 |
80 // The MT'ness degree of the queues below | 88 // The MT'ness degree of the queues below |
81 int _num_q; | 89 int _num_q; |
82 // Arrays of lists of oops, one per thread | 90 // Arrays of lists of oops, one per thread |
88 public: | 96 public: |
89 int num_q() { return _num_q; } | 97 int num_q() { return _num_q; } |
90 DiscoveredList* discovered_soft_refs() { return _discoveredSoftRefs; } | 98 DiscoveredList* discovered_soft_refs() { return _discoveredSoftRefs; } |
91 static oop sentinel_ref() { return _sentinelRef; } | 99 static oop sentinel_ref() { return _sentinelRef; } |
92 static oop* adr_sentinel_ref() { return &_sentinelRef; } | 100 static oop* adr_sentinel_ref() { return &_sentinelRef; } |
101 ReferencePolicy* snap_policy(bool always_clear) { | |
102 _current_soft_ref_policy = always_clear ? | |
103 _always_clear_soft_ref_policy : _default_soft_ref_policy; | |
104 _current_soft_ref_policy->snap(); // snapshot the policy threshold | |
105 return _current_soft_ref_policy; | |
106 } | |
93 | 107 |
94 public: | 108 public: |
95 // Process references with a certain reachability level. | 109 // Process references with a certain reachability level. |
96 void process_discovered_reflist(DiscoveredList refs_lists[], | 110 void process_discovered_reflist(DiscoveredList refs_lists[], |
97 ReferencePolicy* policy, | 111 ReferencePolicy* policy, |
295 | 309 |
296 // Discover a Reference object, using appropriate discovery criteria | 310 // Discover a Reference object, using appropriate discovery criteria |
297 bool discover_reference(oop obj, ReferenceType rt); | 311 bool discover_reference(oop obj, ReferenceType rt); |
298 | 312 |
299 // Process references found during GC (called by the garbage collector) | 313 // Process references found during GC (called by the garbage collector) |
300 void process_discovered_references(ReferencePolicy* policy, | 314 void process_discovered_references(BoolObjectClosure* is_alive, |
301 BoolObjectClosure* is_alive, | |
302 OopClosure* keep_alive, | 315 OopClosure* keep_alive, |
303 VoidClosure* complete_gc, | 316 VoidClosure* complete_gc, |
304 AbstractRefProcTaskExecutor* task_executor); | 317 AbstractRefProcTaskExecutor* task_executor); |
305 | 318 |
306 public: | 319 public: |