hotspot/src/share/vm/gc_implementation/g1/ptrQueue.hpp
changeset 2154 72a9b7284ccf
parent 2105 347008ce7984
parent 2142 032f4652700c
child 4481 de92ec484f5e
equal deleted inserted replaced
2106:ec595a5e793e 2154:72a9b7284ccf
   153   // This (and the interpretation of the first element as a "next"
   153   // This (and the interpretation of the first element as a "next"
   154   // pointer) are protected by the TLOQ_FL_lock.
   154   // pointer) are protected by the TLOQ_FL_lock.
   155   Mutex* _fl_lock;
   155   Mutex* _fl_lock;
   156   void** _buf_free_list;
   156   void** _buf_free_list;
   157   size_t _buf_free_list_sz;
   157   size_t _buf_free_list_sz;
       
   158   // Queue set can share a freelist. The _fl_owner variable
       
   159   // specifies the owner. It is set to "this" by default.
       
   160   PtrQueueSet* _fl_owner;
   158 
   161 
   159   // The size of all buffers in the set.
   162   // The size of all buffers in the set.
   160   size_t _sz;
   163   size_t _sz;
   161 
   164 
   162   bool _all_active;
   165   bool _all_active;
   186   PtrQueueSet(bool notify_when_complete = false);
   189   PtrQueueSet(bool notify_when_complete = false);
   187 
   190 
   188   // Because of init-order concerns, we can't pass these as constructor
   191   // Because of init-order concerns, we can't pass these as constructor
   189   // arguments.
   192   // arguments.
   190   void initialize(Monitor* cbl_mon, Mutex* fl_lock,
   193   void initialize(Monitor* cbl_mon, Mutex* fl_lock,
   191                   int max_completed_queue = 0) {
   194                   int max_completed_queue = 0,
       
   195                   PtrQueueSet *fl_owner = NULL) {
   192     _max_completed_queue = max_completed_queue;
   196     _max_completed_queue = max_completed_queue;
   193     assert(cbl_mon != NULL && fl_lock != NULL, "Init order issue?");
   197     assert(cbl_mon != NULL && fl_lock != NULL, "Init order issue?");
   194     _cbl_mon = cbl_mon; _fl_lock = fl_lock;
   198     _cbl_mon = cbl_mon;
       
   199     _fl_lock = fl_lock;
       
   200     _fl_owner = (fl_owner != NULL) ? fl_owner : this;
   195   }
   201   }
   196 
   202 
   197   // Return an empty oop array of size _sz (required to be non-zero).
   203   // Return an empty oop array of size _sz (required to be non-zero).
   198   void** allocate_buffer();
   204   void** allocate_buffer();
   199 
   205 
   226   // Must only be called at a safe point.  Indicates that the buffer free
   232   // Must only be called at a safe point.  Indicates that the buffer free
   227   // list size may be reduced, if that is deemed desirable.
   233   // list size may be reduced, if that is deemed desirable.
   228   void reduce_free_list();
   234   void reduce_free_list();
   229 
   235 
   230   size_t completed_buffers_num() { return _n_completed_buffers; }
   236   size_t completed_buffers_num() { return _n_completed_buffers; }
       
   237 
       
   238   void merge_bufferlists(PtrQueueSet* src);
       
   239   void merge_freelists(PtrQueueSet* src);
   231 };
   240 };