src/share/vm/utilities/taskqueue.hpp

changeset 8860
43b19021a5a9
parent 8856
ac27a9c85bea
child 9138
b56ab8e56604
equal deleted inserted replaced
8859:f39c2b3891e2 8860:43b19021a5a9
137 Age(idx_t top, idx_t tag) { _fields._top = top; _fields._tag = tag; } 137 Age(idx_t top, idx_t tag) { _fields._top = top; _fields._tag = tag; }
138 138
139 #ifndef MIPS64 139 #ifndef MIPS64
140 Age get() const volatile { return _data; } 140 Age get() const volatile { return _data; }
141 void set(Age age) volatile { _data = age._data; } 141 void set(Age age) volatile { _data = age._data; }
142
142 idx_t top() const volatile { return _fields._top; } 143 idx_t top() const volatile { return _fields._top; }
143 idx_t tag() const volatile { return _fields._tag; } 144 idx_t tag() const volatile { return _fields._tag; }
144 #else 145 #else
145 Age get() const volatile { 146 Age get() const volatile {
146 size_t res = OrderAccess::load_ptr_acquire((volatile intptr_t*) &_data); 147 size_t res = OrderAccess::load_ptr_acquire((volatile intptr_t*) &_data);
147 return *(Age*)(&res); 148 return *(Age*)(&res);
148 } 149 }
149
150 void set(Age age) volatile { OrderAccess::release_store_ptr((volatile intptr_t*) &_data, *(size_t*)(&age._data)); } 150 void set(Age age) volatile { OrderAccess::release_store_ptr((volatile intptr_t*) &_data, *(size_t*)(&age._data)); }
151
151 idx_t top() const volatile { return OrderAccess::load_acquire((volatile idx_t*) &(_fields._top)); } 152 idx_t top() const volatile { return OrderAccess::load_acquire((volatile idx_t*) &(_fields._top)); }
152 idx_t tag() const volatile { return OrderAccess::load_acquire((volatile idx_t*) &(_fields._tag)); } 153 idx_t tag() const volatile { return OrderAccess::load_acquire((volatile idx_t*) &(_fields._tag)); }
153 #endif 154 #endif
154 155
155 // Increment top; if it wraps, increment tag also. 156 // Increment top; if it wraps, increment tag also.
215 216
216 public: 217 public:
217 TaskQueueSuper() : _bottom(0), _age() {} 218 TaskQueueSuper() : _bottom(0), _age() {}
218 219
219 // Return true if the TaskQueue contains/does not contain any tasks. 220 // Return true if the TaskQueue contains/does not contain any tasks.
220 bool peek() const { 221 bool peek() const {
221 #ifdef MIPS64 222 #ifdef MIPS64
222 return get_bottom() != _age.top(); 223 return get_bottom() != _age.top();
223 #else 224 #else
224 return _bottom != _age.top(); 225 return _bottom != _age.top();
225 #endif 226 #endif
226 } 227 }
227
228 bool is_empty() const { return size() == 0; } 228 bool is_empty() const { return size() == 0; }
229 229
230 // Return an estimate of the number of elements in the queue. 230 // Return an estimate of the number of elements in the queue.
231 // The "careful" version admits the possibility of pop_local/pop_global 231 // The "careful" version admits the possibility of pop_local/pop_global
232 // races. 232 // races.

mercurial