comparison src/share/vm/memory/referenceProcessor.hpp @ 3915:c2bf0120ee5d

7085906: Replace the permgen allocated sentinelRef with a self-looped end Summary: Remove the sentinelRef and let the last Reference in a discovered chain point back to itself. Reviewed-by: ysr, jmasa
author stefank
date Thu, 01 Sep 2011 16:18:17 +0200
parents 92da084fefc9
children eca1193ca245
comparison
equal deleted inserted replaced
3913:27702f012017 3915:c2bf0120ee5d
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 // End of list marker
56 static oop _sentinelRef;
57 MemRegion _span; // (right-open) interval of heap 55 MemRegion _span; // (right-open) interval of heap
58 // subject to wkref discovery 56 // subject to wkref discovery
59 bool _discovering_refs; // true when discovery enabled 57 bool _discovering_refs; // true when discovery enabled
60 bool _discovery_is_atomic; // if discovery is atomic wrt 58 bool _discovery_is_atomic; // if discovery is atomic wrt
61 // other collectors in configuration 59 // other collectors in configuration
104 public: 102 public:
105 int num_q() { return _num_q; } 103 int num_q() { return _num_q; }
106 int max_num_q() { return _max_num_q; } 104 int max_num_q() { return _max_num_q; }
107 void set_active_mt_degree(int v) { _num_q = v; } 105 void set_active_mt_degree(int v) { _num_q = v; }
108 DiscoveredList* discovered_soft_refs() { return _discoveredSoftRefs; } 106 DiscoveredList* discovered_soft_refs() { return _discoveredSoftRefs; }
109 static oop sentinel_ref() { return _sentinelRef; }
110 static oop* adr_sentinel_ref() { return &_sentinelRef; }
111 ReferencePolicy* setup_policy(bool always_clear) { 107 ReferencePolicy* setup_policy(bool always_clear) {
112 _current_soft_ref_policy = always_clear ? 108 _current_soft_ref_policy = always_clear ?
113 _always_clear_soft_ref_policy : _default_soft_ref_policy; 109 _always_clear_soft_ref_policy : _default_soft_ref_policy;
114 _current_soft_ref_policy->setup(); // snapshot the policy threshold 110 _current_soft_ref_policy->setup(); // snapshot the policy threshold
115 return _current_soft_ref_policy; 111 return _current_soft_ref_policy;
228 DiscoveredList* get_discovered_list(ReferenceType rt); 224 DiscoveredList* get_discovered_list(ReferenceType rt);
229 inline void add_to_discovered_list_mt(DiscoveredList& refs_list, oop obj, 225 inline void add_to_discovered_list_mt(DiscoveredList& refs_list, oop obj,
230 HeapWord* discovered_addr); 226 HeapWord* discovered_addr);
231 void verify_ok_to_handle_reflists() PRODUCT_RETURN; 227 void verify_ok_to_handle_reflists() PRODUCT_RETURN;
232 228
229 void clear_discovered_references(DiscoveredList& refs_list);
233 void abandon_partial_discovered_list(DiscoveredList& refs_list); 230 void abandon_partial_discovered_list(DiscoveredList& refs_list);
234 231
235 // Calculate the number of jni handles. 232 // Calculate the number of jni handles.
236 unsigned int count_jni_refs(); 233 unsigned int count_jni_refs();
237 234
312 bool enqueuing_is_done() { return _enqueuing_is_done; } 309 bool enqueuing_is_done() { return _enqueuing_is_done; }
313 void set_enqueuing_is_done(bool v) { _enqueuing_is_done = v; } 310 void set_enqueuing_is_done(bool v) { _enqueuing_is_done = v; }
314 311
315 // iterate over oops 312 // iterate over oops
316 void weak_oops_do(OopClosure* f); // weak roots 313 void weak_oops_do(OopClosure* f); // weak roots
317 static void oops_do(OopClosure* f); // strong root(s)
318 314
319 // Balance each of the discovered lists. 315 // Balance each of the discovered lists.
320 void balance_all_queues(); 316 void balance_all_queues();
321 317
322 // Discover a Reference object, using appropriate discovery criteria 318 // Discover a Reference object, using appropriate discovery criteria
338 void abandon_partial_discovery(); 334 void abandon_partial_discovery();
339 335
340 // debugging 336 // debugging
341 void verify_no_references_recorded() PRODUCT_RETURN; 337 void verify_no_references_recorded() PRODUCT_RETURN;
342 void verify_referent(oop obj) PRODUCT_RETURN; 338 void verify_referent(oop obj) PRODUCT_RETURN;
343 static void verify();
344 339
345 // clear the discovered lists (unlinking each entry). 340 // clear the discovered lists (unlinking each entry).
346 void clear_discovered_references() PRODUCT_RETURN; 341 void clear_discovered_references() PRODUCT_RETURN;
347 }; 342 };
348 343
522 class AbstractRefProcTaskExecutor::EnqueueTask { 517 class AbstractRefProcTaskExecutor::EnqueueTask {
523 protected: 518 protected:
524 EnqueueTask(ReferenceProcessor& ref_processor, 519 EnqueueTask(ReferenceProcessor& ref_processor,
525 DiscoveredList refs_lists[], 520 DiscoveredList refs_lists[],
526 HeapWord* pending_list_addr, 521 HeapWord* pending_list_addr,
527 oop sentinel_ref,
528 int n_queues) 522 int n_queues)
529 : _ref_processor(ref_processor), 523 : _ref_processor(ref_processor),
530 _refs_lists(refs_lists), 524 _refs_lists(refs_lists),
531 _pending_list_addr(pending_list_addr), 525 _pending_list_addr(pending_list_addr),
532 _sentinel_ref(sentinel_ref),
533 _n_queues(n_queues) 526 _n_queues(n_queues)
534 { } 527 { }
535 528
536 public: 529 public:
537 virtual void work(unsigned int work_id) = 0; 530 virtual void work(unsigned int work_id) = 0;
538 531
539 protected: 532 protected:
540 ReferenceProcessor& _ref_processor; 533 ReferenceProcessor& _ref_processor;
541 DiscoveredList* _refs_lists; 534 DiscoveredList* _refs_lists;
542 HeapWord* _pending_list_addr; 535 HeapWord* _pending_list_addr;
543 oop _sentinel_ref;
544 int _n_queues; 536 int _n_queues;
545 }; 537 };
546 538
547 #endif // SHARE_VM_MEMORY_REFERENCEPROCESSOR_HPP 539 #endif // SHARE_VM_MEMORY_REFERENCEPROCESSOR_HPP