< prev index next >
src/share/vm/utilities/taskqueue.hpp
Print this page
*** 335,362 ****
f->do_oop(p);
}
// tty->print_cr("END OopTaskQueue::oops_do");
}
- template<class E, MEMFLAGS F, unsigned int N>
- bool GenericTaskQueue<E, F, N>::push_slow(E t, uint dirty_n_elems) {
- if (dirty_n_elems == N - 1) {
- // Actually means 0, so do the push.
- uint localBot = _bottom;
- // g++ complains if the volatile result of the assignment is
- // unused, so we cast the volatile away. We cannot cast directly
- // to void, because gcc treats that as not using the result of the
- // assignment. However, casting to E& means that we trigger an
- // unused-value warning. So, we cast the E& to void.
- (void)const_cast<E&>(_elems[localBot] = t);
- OrderAccess::release_store(&_bottom, increment_index(localBot));
- TASKQUEUE_STATS_ONLY(stats.record_push());
- return true;
- }
- return false;
- }
-
// pop_local_slow() is done by the owning thread and is trying to
// get the last task in the queue. It will compete with pop_global()
// that will be used by other threads. The tag age is incremented
// whenever the queue goes empty which it will do here if this thread
// gets the last task or in pop_global() if the queue wraps (top == 0
--- 335,344 ----
*** 467,486 ****
private:
overflow_t _overflow_stack;
};
template <class E, MEMFLAGS F, unsigned int N>
- bool OverflowTaskQueue<E, F, N>::push(E t)
- {
- if (!taskqueue_t::push(t)) {
- overflow_stack()->push(t);
- TASKQUEUE_STATS_ONLY(stats.record_overflow(overflow_stack()->size()));
- }
- return true;
- }
-
- template <class E, MEMFLAGS F, unsigned int N>
bool OverflowTaskQueue<E, F, N>::pop_overflow(E& t)
{
if (overflow_empty()) return false;
t = overflow_stack()->pop();
return true;
--- 449,458 ----
*** 648,679 ****
static void print_termination_counts();
#endif
};
template<class E, MEMFLAGS F, unsigned int N> inline bool
- GenericTaskQueue<E, F, N>::push(E t) {
- uint localBot = _bottom;
- assert(localBot < N, "_bottom out of range.");
- idx_t top = _age.top();
- uint dirty_n_elems = dirty_size(localBot, top);
- assert(dirty_n_elems < N, "n_elems out of range.");
- if (dirty_n_elems < max_elems()) {
- // g++ complains if the volatile result of the assignment is
- // unused, so we cast the volatile away. We cannot cast directly
- // to void, because gcc treats that as not using the result of the
- // assignment. However, casting to E& means that we trigger an
- // unused-value warning. So, we cast the E& to void.
- (void) const_cast<E&>(_elems[localBot] = t);
- OrderAccess::release_store(&_bottom, increment_index(localBot));
- TASKQUEUE_STATS_ONLY(stats.record_push());
- return true;
- } else {
- return push_slow(t, dirty_n_elems);
- }
- }
-
- template<class E, MEMFLAGS F, unsigned int N> inline bool
GenericTaskQueue<E, F, N>::pop_local(volatile E& t) {
uint localBot = _bottom;
// This value cannot be N-1. That can only occur as a result of
// the assignment to bottom in this method. If it does, this method
// resets the size to 0 before the next call (which is sequential,
--- 620,629 ----
< prev index next >