Mercurial > hg > graal-jvmci-8
comparison src/share/vm/memory/referenceProcessor.hpp @ 3917:eca1193ca245
4965777: GC changes to support use of discovered field for pending references
Summary: If and when the reference handler thread is able to use the discovered field to link reference objects in its pending list, so will GC. In that case, GC will scan through this field once a reference object has been placed on the pending list, but not scan that field before that stage, as the field is used by the concurrent GC thread to link discovered objects. When ReferenceHandleR thread does not use the discovered field for the purpose of linking the elements in the pending list, as would be the case in older JDKs, the JVM will fall back to the old behaviour of using the next field for that purpose.
Reviewed-by: jcoomes, mchung, stefank
author | ysr |
---|---|
date | Wed, 07 Sep 2011 13:55:42 -0700 |
parents | c2bf0120ee5d |
children | 4dfb2df418f2 |
comparison
equal
deleted
inserted
replaced
3916:05550041d664 | 3917:eca1193ca245 |
---|---|
50 class AbstractRefProcTaskExecutor; | 50 class AbstractRefProcTaskExecutor; |
51 class DiscoveredList; | 51 class DiscoveredList; |
52 | 52 |
53 class ReferenceProcessor : public CHeapObj { | 53 class ReferenceProcessor : public CHeapObj { |
54 protected: | 54 protected: |
55 // Compatibility with pre-4965777 JDK's | |
56 static bool _pending_list_uses_discovered_field; | |
55 MemRegion _span; // (right-open) interval of heap | 57 MemRegion _span; // (right-open) interval of heap |
56 // subject to wkref discovery | 58 // subject to wkref discovery |
57 bool _discovering_refs; // true when discovery enabled | 59 bool _discovering_refs; // true when discovery enabled |
58 bool _discovery_is_atomic; // if discovery is atomic wrt | 60 bool _discovery_is_atomic; // if discovery is atomic wrt |
59 // other collectors in configuration | 61 // other collectors in configuration |
109 _always_clear_soft_ref_policy : _default_soft_ref_policy; | 111 _always_clear_soft_ref_policy : _default_soft_ref_policy; |
110 _current_soft_ref_policy->setup(); // snapshot the policy threshold | 112 _current_soft_ref_policy->setup(); // snapshot the policy threshold |
111 return _current_soft_ref_policy; | 113 return _current_soft_ref_policy; |
112 } | 114 } |
113 | 115 |
114 public: | |
115 // Process references with a certain reachability level. | 116 // Process references with a certain reachability level. |
116 void process_discovered_reflist(DiscoveredList refs_lists[], | 117 void process_discovered_reflist(DiscoveredList refs_lists[], |
117 ReferencePolicy* policy, | 118 ReferencePolicy* policy, |
118 bool clear_referent, | 119 bool clear_referent, |
119 BoolObjectClosure* is_alive, | 120 BoolObjectClosure* is_alive, |
295 | 296 |
296 // whether discovery is atomic wrt other collectors | 297 // whether discovery is atomic wrt other collectors |
297 bool discovery_is_atomic() const { return _discovery_is_atomic; } | 298 bool discovery_is_atomic() const { return _discovery_is_atomic; } |
298 void set_atomic_discovery(bool atomic) { _discovery_is_atomic = atomic; } | 299 void set_atomic_discovery(bool atomic) { _discovery_is_atomic = atomic; } |
299 | 300 |
301 // whether the JDK in which we are embedded is a pre-4965777 JDK, | |
302 // and thus whether or not it uses the discovered field to chain | |
303 // the entries in the pending list. | |
304 static bool pending_list_uses_discovered_field() { | |
305 return _pending_list_uses_discovered_field; | |
306 } | |
307 | |
300 // whether discovery is done by multiple threads same-old-timeously | 308 // whether discovery is done by multiple threads same-old-timeously |
301 bool discovery_is_mt() const { return _discovery_is_mt; } | 309 bool discovery_is_mt() const { return _discovery_is_mt; } |
302 void set_mt_discovery(bool mt) { _discovery_is_mt = mt; } | 310 void set_mt_discovery(bool mt) { _discovery_is_mt = mt; } |
303 | 311 |
304 // Whether we are in a phase when _processing_ is MT. | 312 // Whether we are in a phase when _processing_ is MT. |