< prev index next >

src/hotspot/share/gc/shared/referenceProcessor.hpp

Print this page




 229 
 230   DiscoveredList* discovered_refs()        { return _discovered_refs; }
 231 
 232   ReferencePolicy* setup_policy(bool always_clear) {
 233     _current_soft_ref_policy = always_clear ?
 234       _always_clear_soft_ref_policy : _default_soft_ref_policy;
 235     _current_soft_ref_policy->setup();   // snapshot the policy threshold
 236     return _current_soft_ref_policy;
 237   }
 238 
 239   // Process references with a certain reachability level.
 240   void process_discovered_reflist(DiscoveredList                refs_lists[],
 241                                   ReferencePolicy*              policy,
 242                                   bool                          clear_referent,
 243                                   BoolObjectClosure*            is_alive,
 244                                   OopClosure*                   keep_alive,
 245                                   VoidClosure*                  complete_gc,
 246                                   AbstractRefProcTaskExecutor*  task_executor,
 247                                   ReferenceProcessorPhaseTimes* phase_times);
 248 
 249   void process_phaseJNI(BoolObjectClosure* is_alive,
 250                         OopClosure*        keep_alive,
 251                         VoidClosure*       complete_gc);
 252 
 253   // Work methods used by the method process_discovered_reflist
 254   // Phase1: keep alive all those referents that are otherwise
 255   // dead but which must be kept alive by policy (and their closure).
 256   void process_phase1(DiscoveredList&     refs_list,
 257                       ReferencePolicy*    policy,
 258                       BoolObjectClosure*  is_alive,
 259                       OopClosure*         keep_alive,
 260                       VoidClosure*        complete_gc);
 261   // Phase2: remove all those references whose referents are
 262   // reachable.
 263   inline void process_phase2(DiscoveredList&    refs_list,
 264                              BoolObjectClosure* is_alive,
 265                              OopClosure*        keep_alive,
 266                              VoidClosure*       complete_gc) {
 267     if (discovery_is_atomic()) {
 268       // complete_gc is ignored in this case for this phase
 269       pp2_work(refs_list, is_alive, keep_alive);
 270     } else {
 271       assert(complete_gc != NULL, "Error");
 272       pp2_work_concurrent_discovery(refs_list, is_alive,


 323                                    BoolObjectClosure* is_alive,
 324                                    OopClosure*        keep_alive,
 325                                    VoidClosure*       complete_gc,
 326                                    YieldClosure*      yield);
 327 
 328   // round-robin mod _num_q (not: _not_ mode _max_num_q)
 329   uint next_id() {
 330     uint id = _next_id;
 331     assert(!_discovery_is_mt, "Round robin should only be used in serial discovery");
 332     if (++_next_id == _num_q) {
 333       _next_id = 0;
 334     }
 335     assert(_next_id < _num_q, "_next_id %u _num_q %u _max_num_q %u", _next_id, _num_q, _max_num_q);
 336     return id;
 337   }
 338   DiscoveredList* get_discovered_list(ReferenceType rt);
 339   inline void add_to_discovered_list_mt(DiscoveredList& refs_list, oop obj,
 340                                         HeapWord* discovered_addr);
 341 
 342   void clear_discovered_references(DiscoveredList& refs_list);
 343 
 344   // Calculate the number of jni handles.
 345   size_t count_jni_refs();
 346 
 347   void log_reflist_counts(DiscoveredList ref_lists[], uint active_length, size_t total_count) PRODUCT_RETURN;
 348 
 349   // Balances reference queues.
 350   void balance_queues(DiscoveredList ref_lists[]);
 351 
 352   // Update (advance) the soft ref master clock field.
 353   void update_soft_ref_master_clock();
 354 
 355  public:
 356   // Default parameters give you a vanilla reference processor.
 357   ReferenceProcessor(MemRegion span,
 358                      bool mt_processing = false, uint mt_processing_degree = 1,
 359                      bool mt_discovery  = false, uint mt_discovery_degree  = 1,
 360                      bool atomic_discovery = true,
 361                      BoolObjectClosure* is_alive_non_header = NULL);
 362 
 363   // RefDiscoveryPolicy values
 364   enum DiscoveryPolicy {
 365     ReferenceBasedDiscovery = 0,




 229 
 230   DiscoveredList* discovered_refs()        { return _discovered_refs; }
 231 
 232   ReferencePolicy* setup_policy(bool always_clear) {
 233     _current_soft_ref_policy = always_clear ?
 234       _always_clear_soft_ref_policy : _default_soft_ref_policy;
 235     _current_soft_ref_policy->setup();   // snapshot the policy threshold
 236     return _current_soft_ref_policy;
 237   }
 238 
 239   // Process references with a certain reachability level.
 240   void process_discovered_reflist(DiscoveredList                refs_lists[],
 241                                   ReferencePolicy*              policy,
 242                                   bool                          clear_referent,
 243                                   BoolObjectClosure*            is_alive,
 244                                   OopClosure*                   keep_alive,
 245                                   VoidClosure*                  complete_gc,
 246                                   AbstractRefProcTaskExecutor*  task_executor,
 247                                   ReferenceProcessorPhaseTimes* phase_times);
 248 




 249   // Work methods used by the method process_discovered_reflist
 250   // Phase1: keep alive all those referents that are otherwise
 251   // dead but which must be kept alive by policy (and their closure).
 252   void process_phase1(DiscoveredList&     refs_list,
 253                       ReferencePolicy*    policy,
 254                       BoolObjectClosure*  is_alive,
 255                       OopClosure*         keep_alive,
 256                       VoidClosure*        complete_gc);
 257   // Phase2: remove all those references whose referents are
 258   // reachable.
 259   inline void process_phase2(DiscoveredList&    refs_list,
 260                              BoolObjectClosure* is_alive,
 261                              OopClosure*        keep_alive,
 262                              VoidClosure*       complete_gc) {
 263     if (discovery_is_atomic()) {
 264       // complete_gc is ignored in this case for this phase
 265       pp2_work(refs_list, is_alive, keep_alive);
 266     } else {
 267       assert(complete_gc != NULL, "Error");
 268       pp2_work_concurrent_discovery(refs_list, is_alive,


 319                                    BoolObjectClosure* is_alive,
 320                                    OopClosure*        keep_alive,
 321                                    VoidClosure*       complete_gc,
 322                                    YieldClosure*      yield);
 323 
 324   // round-robin mod _num_q (not: _not_ mode _max_num_q)
 325   uint next_id() {
 326     uint id = _next_id;
 327     assert(!_discovery_is_mt, "Round robin should only be used in serial discovery");
 328     if (++_next_id == _num_q) {
 329       _next_id = 0;
 330     }
 331     assert(_next_id < _num_q, "_next_id %u _num_q %u _max_num_q %u", _next_id, _num_q, _max_num_q);
 332     return id;
 333   }
 334   DiscoveredList* get_discovered_list(ReferenceType rt);
 335   inline void add_to_discovered_list_mt(DiscoveredList& refs_list, oop obj,
 336                                         HeapWord* discovered_addr);
 337 
 338   void clear_discovered_references(DiscoveredList& refs_list);



 339 
 340   void log_reflist_counts(DiscoveredList ref_lists[], uint active_length, size_t total_count) PRODUCT_RETURN;
 341 
 342   // Balances reference queues.
 343   void balance_queues(DiscoveredList ref_lists[]);
 344 
 345   // Update (advance) the soft ref master clock field.
 346   void update_soft_ref_master_clock();
 347 
 348  public:
 349   // Default parameters give you a vanilla reference processor.
 350   ReferenceProcessor(MemRegion span,
 351                      bool mt_processing = false, uint mt_processing_degree = 1,
 352                      bool mt_discovery  = false, uint mt_discovery_degree  = 1,
 353                      bool atomic_discovery = true,
 354                      BoolObjectClosure* is_alive_non_header = NULL);
 355 
 356   // RefDiscoveryPolicy values
 357   enum DiscoveryPolicy {
 358     ReferenceBasedDiscovery = 0,


< prev index next >