mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-12 19:35:24 +00:00
8078021: SATB apply_closure_to_completed_buffer should have closure argument
Apply closure directly, eliminating registration. Reviewed-by: stefank, tschatzl
This commit is contained in:
parent
ef932e7b22
commit
c9ebd949ea
@ -3720,12 +3720,11 @@ void CMTask::drain_satb_buffers() {
|
||||
|
||||
CMObjectClosure oc(this);
|
||||
SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set();
|
||||
satb_mq_set.set_closure(_worker_id, &oc);
|
||||
|
||||
// This keeps claiming and applying the closure to completed buffers
|
||||
// until we run out of buffers or we need to abort.
|
||||
while (!has_aborted() &&
|
||||
satb_mq_set.apply_closure_to_completed_buffer(_worker_id)) {
|
||||
satb_mq_set.apply_closure_to_completed_buffer(&oc)) {
|
||||
if (_cm->verbose_medium()) {
|
||||
gclog_or_tty->print_cr("[%u] processed an SATB buffer", _worker_id);
|
||||
}
|
||||
@ -3739,8 +3738,6 @@ void CMTask::drain_satb_buffers() {
|
||||
concurrent() ||
|
||||
satb_mq_set.completed_buffers_num() == 0, "invariant");
|
||||
|
||||
satb_mq_set.set_closure(_worker_id, NULL);
|
||||
|
||||
// again, this was a potentially expensive operation, decrease the
|
||||
// limits to get the regular clock call early
|
||||
decrease_limits();
|
||||
|
||||
@ -225,7 +225,7 @@ void ObjPtrQueue::print(const char* name,
|
||||
#endif // _MSC_VER
|
||||
|
||||
SATBMarkQueueSet::SATBMarkQueueSet() :
|
||||
PtrQueueSet(), _closures(NULL),
|
||||
PtrQueueSet(),
|
||||
_shared_satb_queue(this, true /*perm*/) { }
|
||||
|
||||
void SATBMarkQueueSet::initialize(Monitor* cbl_mon, Mutex* fl_lock,
|
||||
@ -233,7 +233,6 @@ void SATBMarkQueueSet::initialize(Monitor* cbl_mon, Mutex* fl_lock,
|
||||
Mutex* lock) {
|
||||
PtrQueueSet::initialize(cbl_mon, fl_lock, process_completed_threshold, -1);
|
||||
_shared_satb_queue.set_lock(lock);
|
||||
_closures = NEW_C_HEAP_ARRAY(ObjectClosure*, ParallelGCThreads, mtGC);
|
||||
}
|
||||
|
||||
void SATBMarkQueueSet::handle_zero_index_for_thread(JavaThread* t) {
|
||||
@ -296,13 +295,7 @@ void SATBMarkQueueSet::filter_thread_buffers() {
|
||||
shared_satb_queue()->filter();
|
||||
}
|
||||
|
||||
void SATBMarkQueueSet::set_closure(uint worker, ObjectClosure* closure) {
|
||||
assert(_closures != NULL, "Precondition");
|
||||
assert(worker < ParallelGCThreads, "Worker index must be in range [0...ParallelGCThreads)");
|
||||
_closures[worker] = closure;
|
||||
}
|
||||
|
||||
bool SATBMarkQueueSet::apply_closure_to_completed_buffer(uint worker) {
|
||||
bool SATBMarkQueueSet::apply_closure_to_completed_buffer(ObjectClosure* cl) {
|
||||
BufferNode* nd = NULL;
|
||||
{
|
||||
MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag);
|
||||
@ -314,7 +307,6 @@ bool SATBMarkQueueSet::apply_closure_to_completed_buffer(uint worker) {
|
||||
if (_n_completed_buffers == 0) _process_completed = false;
|
||||
}
|
||||
}
|
||||
ObjectClosure* cl = _closures[worker];
|
||||
if (nd != NULL) {
|
||||
void **buf = BufferNode::make_buffer_from_node(nd);
|
||||
ObjPtrQueue::apply_closure_to_buffer(cl, buf, 0, _sz);
|
||||
|
||||
@ -75,8 +75,6 @@ public:
|
||||
};
|
||||
|
||||
class SATBMarkQueueSet: public PtrQueueSet {
|
||||
ObjectClosure** _closures; // One per ParGCThread.
|
||||
|
||||
ObjPtrQueue _shared_satb_queue;
|
||||
|
||||
#ifdef ASSERT
|
||||
@ -102,16 +100,10 @@ public:
|
||||
// Filter all the currently-active SATB buffers.
|
||||
void filter_thread_buffers();
|
||||
|
||||
// Register closure for the given worker thread. The "apply_closure_to_completed_buffer"
|
||||
// method will apply this closure to a completed buffer, and "iterate_closure_all_threads"
|
||||
// applies it to partially-filled buffers (the latter should only be done
|
||||
// with the world stopped).
|
||||
void set_closure(uint worker, ObjectClosure* closure);
|
||||
|
||||
// If there exists some completed buffer, pop it, then apply the
|
||||
// registered closure to all its elements, and return true. If no
|
||||
// closure to all its elements, and return true. If no
|
||||
// completed buffers exist, return false.
|
||||
bool apply_closure_to_completed_buffer(uint worker);
|
||||
bool apply_closure_to_completed_buffer(ObjectClosure* closure);
|
||||
|
||||
// Apply the given closure on enqueued and currently-active buffers
|
||||
// respectively. Both methods are read-only, i.e., they do not
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user