< prev index next >
src/hotspot/share/gc/shared/taskqueue.hpp
Print this page
rev 59131 : imported patch assert_empty
*** 226,239 ****
NONCOPYABLE(TaskQueueSuper);
public:
TaskQueueSuper() : _bottom(0), _age() {}
! // Return true if the TaskQueue contains any tasks.
// Unreliable if there are concurrent pushes or pops.
! bool peek() const {
! return bottom_relaxed() != age_top_relaxed();
}
bool is_empty() const {
return size() == 0;
}
--- 226,239 ----
NONCOPYABLE(TaskQueueSuper);
public:
TaskQueueSuper() : _bottom(0), _age() {}
! // Assert the queue is empty.
// Unreliable if there are concurrent pushes or pops.
! void assert_empty() const {
! assert(bottom_relaxed() == age_top_relaxed(), "not empty");
}
bool is_empty() const {
return size() == 0;
}
*** 424,435 ****
overflow_t _overflow_stack;
};
class TaskQueueSetSuper {
public:
! // Returns "true" if some TaskQueue in the set contains a task.
! virtual bool peek() = 0;
// Tasks in queue
virtual uint tasks() const = 0;
};
template <MEMFLAGS F> class TaskQueueSetSuperImpl: public CHeapObj<F>, public TaskQueueSetSuper {
--- 424,437 ----
overflow_t _overflow_stack;
};
class TaskQueueSetSuper {
public:
! // Assert all queues in the set are empty.
! NOT_DEBUG(void assert_empty() const {})
! DEBUG_ONLY(virtual void assert_empty() const = 0;)
!
// Tasks in queue
virtual uint tasks() const = 0;
};
template <MEMFLAGS F> class TaskQueueSetSuperImpl: public CHeapObj<F>, public TaskQueueSetSuper {
*** 456,467 ****
// Try to steal a task from some other queue than queue_num. It may perform several attempts at doing so.
// Returns if stealing succeeds, and sets "t" to the stolen task.
bool steal(uint queue_num, E& t);
! bool peek();
! uint tasks() const;
uint size() const { return _n; }
};
template<class T, MEMFLAGS F> void
--- 458,470 ----
// Try to steal a task from some other queue than queue_num. It may perform several attempts at doing so.
// Returns if stealing succeeds, and sets "t" to the stolen task.
bool steal(uint queue_num, E& t);
! DEBUG_ONLY(virtual void assert_empty() const;)
!
! virtual uint tasks() const;
uint size() const { return _n; }
};
template<class T, MEMFLAGS F> void
*** 473,491 ****
template<class T, MEMFLAGS F> T*
GenericTaskQueueSet<T, F>::queue(uint i) {
return _queues[i];
}
template<class T, MEMFLAGS F>
! bool GenericTaskQueueSet<T, F>::peek() {
! // Try all the queues.
for (uint j = 0; j < _n; j++) {
! if (_queues[j]->peek())
! return true;
}
- return false;
}
template<class T, MEMFLAGS F>
uint GenericTaskQueueSet<T, F>::tasks() const {
uint n = 0;
for (uint j = 0; j < _n; j++) {
--- 476,493 ----
template<class T, MEMFLAGS F> T*
GenericTaskQueueSet<T, F>::queue(uint i) {
return _queues[i];
}
+ #ifdef ASSERT
template<class T, MEMFLAGS F>
! void GenericTaskQueueSet<T, F>::assert_empty() const {
for (uint j = 0; j < _n; j++) {
! _queues[j]->assert_empty();
}
}
+ #endif // ASSERT
template<class T, MEMFLAGS F>
uint GenericTaskQueueSet<T, F>::tasks() const {
uint n = 0;
for (uint j = 0; j < _n; j++) {
< prev index next >