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

Print this page
rev 7653 : 8068883: Remove disabling of warning "C4355: 'this' : used in base member initializer list"


  50   // The buffer.
  51   void** _buf;
  52   // The index at which an object was last enqueued.  Starts at "_sz"
  53   // (indicating an empty buffer) and goes towards zero.
  54   size_t _index;
  55 
  56   // The size of the buffer.
  57   size_t _sz;
  58 
  59   // If true, the queue is permanent, and doesn't need to deallocate
  60   // its buffer in the destructor (since that obtains a lock which may not
  61   // be legally locked by then.
  62   bool _perm;
  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;




  50   // The buffer.
  51   void** _buf;
  52   // The index at which an object was last enqueued.  Starts at "_sz"
  53   // (indicating an empty buffer) and goes towards zero.
  54   size_t _index;
  55 
  56   // The size of the buffer.
  57   size_t _sz;
  58 
  59   // If true, the queue is permanent, and doesn't need to deallocate
  60   // its buffer in the destructor (since that obtains a lock which may not
  61   // be legally locked by then.
  62   bool _perm;
  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   PtrQueue() { }
  71   // Initialize this queue to contain a null buffer, and be part of the
  72   // given PtrQueueSet.
  73   PtrQueue(PtrQueueSet* qset, bool perm = false, bool active = false);
  74   // Release any contained resources.
  75   virtual void flush();
  76   // Calls flush() when destroyed.
  77   ~PtrQueue() { flush(); }
  78 
  79   // Associate a lock with a ptr queue.
  80   void set_lock(Mutex* lock) { _lock = lock; }
  81 
  82   void reset() { if (_buf != NULL) _index = _sz; }
  83 
  84   void enqueue(volatile void* ptr) {
  85     enqueue((void*)(ptr));
  86   }
  87 
  88   // Enqueues the given "obj".
  89   void enqueue(void* ptr) {
  90     if (!_active) return;