< prev index next >
src/hotspot/share/gc/shared/taskqueue.hpp
Print this page
rev 53307 : Backport Shenadoah GC
*** 356,365 ****
--- 356,366 ----
protected:
static int randomParkAndMiller(int* seed0);
public:
// Returns "true" if some TaskQueue in the set contains a task.
virtual bool peek() = 0;
+ virtual size_t tasks() = 0;
};
template <MEMFLAGS F> class TaskQueueSetSuperImpl: public CHeapObj<F>, public TaskQueueSetSuper {
};
*** 387,396 ****
--- 388,398 ----
// succeeds, returns "true" and sets "t" to the stolen task, otherwise returns
// false.
bool steal(uint queue_num, int* seed, E& t);
bool peek();
+ size_t tasks();
uint size() const { return _n; }
};
template<class T, MEMFLAGS F> void
*** 412,421 ****
--- 414,433 ----
return true;
}
return false;
}
+ template<class T, MEMFLAGS F>
+ size_t GenericTaskQueueSet<T, F>::tasks() {
+ size_t n = 0;
+ for (uint j = 0; j < _n; j++) {
+ n += _queues[j]->size();
+ }
+ return n;
+ }
+
+
// When to terminate from the termination protocol.
class TerminatorTerminator: public CHeapObj<mtInternal> {
public:
virtual bool should_exit_termination() = 0;
};
*** 424,434 ****
// TaskQueueSet's for work stealing.
#undef TRACESPINNING
class ParallelTaskTerminator: public StackObj {
! private:
uint _n_threads;
TaskQueueSetSuper* _queue_set;
DEFINE_PAD_MINUS_SIZE(0, DEFAULT_CACHE_LINE_SIZE, 0);
volatile uint _offered_termination;
--- 436,446 ----
// TaskQueueSet's for work stealing.
#undef TRACESPINNING
class ParallelTaskTerminator: public StackObj {
! protected:
uint _n_threads;
TaskQueueSetSuper* _queue_set;
DEFINE_PAD_MINUS_SIZE(0, DEFAULT_CACHE_LINE_SIZE, 0);
volatile uint _offered_termination;
*** 460,470 ****
}
// As above, but it also terminates if the should_exit_termination()
// method of the terminator parameter returns true. If terminator is
// NULL, then it is ignored.
! bool offer_termination(TerminatorTerminator* terminator);
// Reset the terminator, so that it may be reused again.
// The caller is responsible for ensuring that this is done
// in an MT-safe manner, once the previous round of use of
// the terminator is finished.
--- 472,482 ----
}
// As above, but it also terminates if the should_exit_termination()
// method of the terminator parameter returns true. If terminator is
// NULL, then it is ignored.
! virtual bool offer_termination(TerminatorTerminator* terminator);
// Reset the terminator, so that it may be reused again.
// The caller is responsible for ensuring that this is done
// in an MT-safe manner, once the previous round of use of
// the terminator is finished.
< prev index next >