src/share/vm/gc_implementation/g1/ptrQueue.hpp

Print this page
rev 5363 : imported patch filtering.diff


  63 
  64   // If there is a lock associated with this buffer, this is that lock.
  65   Mutex* _lock;
  66 
  67   PtrQueueSet* qset() { return _qset; }
  68 
  69 public:
  70   // Initialize this queue to contain a null buffer, and be part of the
  71   // given PtrQueueSet.
  72   PtrQueue(PtrQueueSet* qset, bool perm = false, bool active = false);
  73   // Release any contained resources.
  74   virtual void flush();
  75   // Calls flush() when destroyed.
  76   ~PtrQueue() { flush(); }
  77 
  78   // Associate a lock with a ptr queue.
  79   void set_lock(Mutex* lock) { _lock = lock; }
  80 
  81   void reset() { if (_buf != NULL) _index = _sz; }
  82 




  83   // Enqueues the given "obj".
  84   void enqueue(void* ptr) {
  85     if (!_active) return;
  86     else enqueue_known_active(ptr);
  87   }
  88 
  89   // This method is called when we're doing the zero index handling
  90   // and gives a chance to the queues to do any pre-enqueueing
  91   // processing they might want to do on the buffer. It should return
  92   // true if the buffer should be enqueued, or false if enough
  93   // entries were cleared from it so that it can be re-used. It should
  94   // not return false if the buffer is still full (otherwise we can
  95   // get into an infinite loop).
  96   virtual bool should_enqueue_buffer() { return true; }
  97   void handle_zero_index();
  98   void locking_enqueue_completed_buffer(void** buf);
  99 
 100   void enqueue_known_active(void* ptr);
 101 
 102   size_t size() {




  63 
  64   // If there is a lock associated with this buffer, this is that lock.
  65   Mutex* _lock;
  66 
  67   PtrQueueSet* qset() { return _qset; }
  68 
  69 public:
  70   // Initialize this queue to contain a null buffer, and be part of the
  71   // given PtrQueueSet.
  72   PtrQueue(PtrQueueSet* qset, bool perm = false, bool active = false);
  73   // Release any contained resources.
  74   virtual void flush();
  75   // Calls flush() when destroyed.
  76   ~PtrQueue() { flush(); }
  77 
  78   // Associate a lock with a ptr queue.
  79   void set_lock(Mutex* lock) { _lock = lock; }
  80 
  81   void reset() { if (_buf != NULL) _index = _sz; }
  82 
  83   void enqueue(volatile void* ptr) {
  84     enqueue((void*)(ptr));
  85   }
  86 
  87   // Enqueues the given "obj".
  88   void enqueue(void* ptr) {
  89     if (!_active) return;
  90     else enqueue_known_active(ptr);
  91   }
  92 
  93   // This method is called when we're doing the zero index handling
  94   // and gives a chance to the queues to do any pre-enqueueing
  95   // processing they might want to do on the buffer. It should return
  96   // true if the buffer should be enqueued, or false if enough
  97   // entries were cleared from it so that it can be re-used. It should
  98   // not return false if the buffer is still full (otherwise we can
  99   // get into an infinite loop).
 100   virtual bool should_enqueue_buffer() { return true; }
 101   void handle_zero_index();
 102   void locking_enqueue_completed_buffer(void** buf);
 103 
 104   void enqueue_known_active(void* ptr);
 105 
 106   size_t size() {