< prev index next >

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

Print this page
rev 9388 : [mq]: qfield_refs


 123   // Set the "active" property of the queue to "b".  An enqueue to an
 124   // inactive thread is a no-op.  Setting a queue to inactive resets its
 125   // log to the empty state.
 126   void set_active(bool b) {
 127     _active = b;
 128     if (!b && _buf != NULL) {
 129       _index = _sz;
 130     } else if (b && _buf != NULL) {
 131       assert(_index == _sz, "invariant: queues are empty when activated.");
 132     }
 133   }
 134 
 135   bool is_active() { return _active; }
 136 
 137   static size_t byte_index_to_index(size_t ind) {
 138     assert((ind % sizeof(void*)) == 0, "Invariant.");
 139     return ind / sizeof(void*);
 140   }
 141 
 142   // To support compiler.



 143   static ByteSize byte_offset_of_index() {
 144     return byte_offset_of(PtrQueue, _index);
 145   }

 146   static ByteSize byte_width_of_index() { return in_ByteSize(sizeof(size_t)); }
 147 

 148   static ByteSize byte_offset_of_buf() {
 149     return byte_offset_of(PtrQueue, _buf);
 150   }

 151   static ByteSize byte_width_of_buf() { return in_ByteSize(sizeof(void*)); }
 152 

 153   static ByteSize byte_offset_of_active() {
 154     return byte_offset_of(PtrQueue, _active);
 155   }

 156   static ByteSize byte_width_of_active() { return in_ByteSize(sizeof(bool)); }
 157 
 158 };
 159 
 160 class BufferNode {
 161   size_t _index;
 162   BufferNode* _next;
 163 public:
 164   BufferNode() : _index(0), _next(NULL) { }
 165   BufferNode* next() const     { return _next;  }
 166   void set_next(BufferNode* n) { _next = n;     }
 167   size_t index() const         { return _index; }
 168   void set_index(size_t i)     { _index = i;    }
 169 
 170   // Align the size of the structure to the size of the pointer
 171   static size_t aligned_size() {
 172     static const size_t alignment = round_to(sizeof(BufferNode), sizeof(void*));
 173     return alignment;
 174   }
 175 




 123   // Set the "active" property of the queue to "b".  An enqueue to an
 124   // inactive thread is a no-op.  Setting a queue to inactive resets its
 125   // log to the empty state.
 126   void set_active(bool b) {
 127     _active = b;
 128     if (!b && _buf != NULL) {
 129       _index = _sz;
 130     } else if (b && _buf != NULL) {
 131       assert(_index == _sz, "invariant: queues are empty when activated.");
 132     }
 133   }
 134 
 135   bool is_active() { return _active; }
 136 
 137   static size_t byte_index_to_index(size_t ind) {
 138     assert((ind % sizeof(void*)) == 0, "Invariant.");
 139     return ind / sizeof(void*);
 140   }
 141 
 142   // To support compiler.
 143 
 144 protected:
 145   template<typename Derived>
 146   static ByteSize byte_offset_of_index() {
 147     return byte_offset_of(Derived, _index);
 148   }
 149 
 150   static ByteSize byte_width_of_index() { return in_ByteSize(sizeof(size_t)); }
 151 
 152   template<typename Derived>
 153   static ByteSize byte_offset_of_buf() {
 154     return byte_offset_of(Derived, _buf);
 155   }
 156 
 157   static ByteSize byte_width_of_buf() { return in_ByteSize(sizeof(void*)); }
 158 
 159   template<typename Derived>
 160   static ByteSize byte_offset_of_active() {
 161     return byte_offset_of(Derived, _active);
 162   }
 163 
 164   static ByteSize byte_width_of_active() { return in_ByteSize(sizeof(bool)); }
 165 
 166 };
 167 
 168 class BufferNode {
 169   size_t _index;
 170   BufferNode* _next;
 171 public:
 172   BufferNode() : _index(0), _next(NULL) { }
 173   BufferNode* next() const     { return _next;  }
 174   void set_next(BufferNode* n) { _next = n;     }
 175   size_t index() const         { return _index; }
 176   void set_index(size_t i)     { _index = i;    }
 177 
 178   // Align the size of the structure to the size of the pointer
 179   static size_t aligned_size() {
 180     static const size_t alignment = round_to(sizeof(BufferNode), sizeof(void*));
 181     return alignment;
 182   }
 183 


< prev index next >