< prev index next >

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

Print this page
rev 55404 : 8226197: Reducing G1?s CPU cost with simplified write post-barrier and disabling concurrent refinement
Summary: A prototype to add a mode for G1 to use a simplified write post-barrier. Guarded by new flag G1FastWriteBarrier.


 306 
 307   // If true, notify_all on _cbl_mon when the threshold is reached.
 308   bool _notify_when_complete;
 309 
 310   void assert_completed_buffers_list_len_correct_locked() NOT_DEBUG_RETURN;
 311 
 312 protected:
 313   bool _all_active;
 314 
 315   // Create an empty ptr queue set.
 316   PtrQueueSet(bool notify_when_complete = false);
 317   ~PtrQueueSet();
 318 
 319   // Because of init-order concerns, we can't pass these as constructor
 320   // arguments.
 321   void initialize(Monitor* cbl_mon, BufferNode::Allocator* allocator);
 322 
 323   // For (unlocked!) iteration over the completed buffers.
 324   BufferNode* completed_buffers_head() const { return _completed_buffers_head; }
 325 
 326   // Deallocate all of the completed buffers.
 327   void abandon_completed_buffers();
 328 
 329 public:
 330 
 331   // Return the buffer for a BufferNode of size buffer_size().
 332   void** allocate_buffer();
 333 
 334   // Return an empty buffer to the free list.  The node is required
 335   // to have been allocated with a size of buffer_size().
 336   void deallocate_buffer(BufferNode* node);
 337 
 338   // A completed buffer is a buffer the mutator is finished with, and
 339   // is ready to be processed by the collector.  It need not be full.
 340 
 341   // Adds node to the completed buffer list.
 342   void enqueue_completed_buffer(BufferNode* node);
 343 
 344   // If the number of completed buffers is > stop_at, then remove and
 345   // return a completed buffer from the list.  Otherwise, return NULL.
 346   BufferNode* get_completed_buffer(size_t stop_at = 0);
 347 
 348   bool process_completed_buffers() { return _process_completed_buffers; }
 349   void set_process_completed_buffers(bool x) { _process_completed_buffers = x; }
 350 
 351   bool is_active() { return _all_active; }
 352 
 353   size_t buffer_size() const {
 354     return _allocator->buffer_size();
 355   }
 356 
 357   // Get/Set the number of completed buffers that triggers log processing.
 358   // Log processing should be done when the number of buffers exceeds the
 359   // threshold.
 360   void set_process_completed_buffers_threshold(size_t sz) {
 361     _process_completed_buffers_threshold = sz;
 362   }
 363   size_t process_completed_buffers_threshold() const {
 364     return _process_completed_buffers_threshold;
 365   }
 366   static const size_t ProcessCompletedBuffersThresholdNever = ~size_t(0);
 367 
 368   size_t completed_buffers_num() const { return _n_completed_buffers; }



 369 
 370   void merge_bufferlists(PtrQueueSet* src);
 371 
 372   // Notify the consumer if the number of buffers crossed the threshold
 373   void notify_if_necessary();
 374 };
 375 
 376 #endif // SHARE_GC_SHARED_PTRQUEUE_HPP


 306 
 307   // If true, notify_all on _cbl_mon when the threshold is reached.
 308   bool _notify_when_complete;
 309 
 310   void assert_completed_buffers_list_len_correct_locked() NOT_DEBUG_RETURN;
 311 
 312 protected:
 313   bool _all_active;
 314 
 315   // Create an empty ptr queue set.
 316   PtrQueueSet(bool notify_when_complete = false);
 317   ~PtrQueueSet();
 318 
 319   // Because of init-order concerns, we can't pass these as constructor
 320   // arguments.
 321   void initialize(Monitor* cbl_mon, BufferNode::Allocator* allocator);
 322 
 323   // For (unlocked!) iteration over the completed buffers.
 324   BufferNode* completed_buffers_head() const { return _completed_buffers_head; }
 325 



 326 public:
 327 
 328   // Return the buffer for a BufferNode of size buffer_size().
 329   void** allocate_buffer();
 330 
 331   // Return an empty buffer to the free list.  The node is required
 332   // to have been allocated with a size of buffer_size().
 333   void deallocate_buffer(BufferNode* node);
 334 
 335   // A completed buffer is a buffer the mutator is finished with, and
 336   // is ready to be processed by the collector.  It need not be full.
 337 
 338   // Adds node to the completed buffer list.
 339   void enqueue_completed_buffer(BufferNode* node);
 340 
 341   // If the number of completed buffers is > stop_at, then remove and
 342   // return a completed buffer from the list.  Otherwise, return NULL.
 343   BufferNode* get_completed_buffer(size_t stop_at = 0);
 344 
 345   bool process_completed_buffers() { return _process_completed_buffers; }
 346   void set_process_completed_buffers(bool x) { _process_completed_buffers = x; }
 347 
 348   bool is_active() { return _all_active; }
 349 
 350   size_t buffer_size() const {
 351     return _allocator->buffer_size();
 352   }
 353 
 354   // Get/Set the number of completed buffers that triggers log processing.
 355   // Log processing should be done when the number of buffers exceeds the
 356   // threshold.
 357   void set_process_completed_buffers_threshold(size_t sz) {
 358     _process_completed_buffers_threshold = sz;
 359   }
 360   size_t process_completed_buffers_threshold() const {
 361     return _process_completed_buffers_threshold;
 362   }
 363   static const size_t ProcessCompletedBuffersThresholdNever = ~size_t(0);
 364 
 365   size_t completed_buffers_num() const { return _n_completed_buffers; }
 366 
 367   // Deallocate all of the completed buffers.
 368   void abandon_completed_buffers();
 369 
 370   void merge_bufferlists(PtrQueueSet* src);
 371 
 372   // Notify the consumer if the number of buffers crossed the threshold
 373   void notify_if_necessary();
 374 };
 375 
 376 #endif // SHARE_GC_SHARED_PTRQUEUE_HPP
< prev index next >