< prev index next >
src/hotspot/share/gc/g1/satbMarkQueue.cpp
Print this page
rev 47287 : Port 09.17.Thread_SMR_logging_update from JDK9 to JDK10
rev 47289 : eosterlund, stefank CR - refactor code into threadSMR.cpp and threadSMR.hpp
rev 47292 : stefank, coleenp CR - refactor most JavaThreadIterator usage to use JavaThreadIteratorWithHandle.
@@ -213,17 +213,13 @@
#ifdef ASSERT
void SATBMarkQueueSet::dump_active_states(bool expected_active) {
log_error(gc, verify)("Expected SATB active state: %s", expected_active ? "ACTIVE" : "INACTIVE");
log_error(gc, verify)("Actual SATB active states:");
log_error(gc, verify)(" Queue set: %s", is_active() ? "ACTIVE" : "INACTIVE");
- {
- ThreadsListHandle tlh;
- JavaThreadIterator jti(tlh.list());
- for (JavaThread* t = jti.first(); t != NULL; t = jti.next()) {
+ for (JavaThreadIteratorWithHandle jtiwh; JavaThread *t = jtiwh.next(); ) {
log_error(gc, verify)(" Thread \"%s\" queue: %s", t->name(), t->satb_mark_queue().is_active() ? "ACTIVE" : "INACTIVE");
}
- }
log_error(gc, verify)(" Shared queue: %s", shared_satb_queue()->is_active() ? "ACTIVE" : "INACTIVE");
}
void SATBMarkQueueSet::verify_active_states(bool expected_active) {
// Verify queue set state
@@ -231,20 +227,16 @@
dump_active_states(expected_active);
guarantee(false, "SATB queue set has an unexpected active state");
}
// Verify thread queue states
- {
- ThreadsListHandle tlh;
- JavaThreadIterator jti(tlh.list());
- for (JavaThread* t = jti.first(); t != NULL; t = jti.next()) {
+ for (JavaThreadIteratorWithHandle jtiwh; JavaThread *t = jtiwh.next(); ) {
if (t->satb_mark_queue().is_active() != expected_active) {
dump_active_states(expected_active);
guarantee(false, "Thread SATB queue has an unexpected active state");
}
}
- }
// Verify shared queue state
if (shared_satb_queue()->is_active() != expected_active) {
dump_active_states(expected_active);
guarantee(false, "Shared SATB queue has an unexpected active state");
@@ -256,28 +248,20 @@
assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint.");
#ifdef ASSERT
verify_active_states(expected_active);
#endif // ASSERT
_all_active = active;
- {
- ThreadsListHandle tlh;
- JavaThreadIterator jti(tlh.list());
- for (JavaThread* t = jti.first(); t != NULL; t = jti.next()) {
+ for (JavaThreadIteratorWithHandle jtiwh; JavaThread *t = jtiwh.next(); ) {
t->satb_mark_queue().set_active(active);
}
- }
shared_satb_queue()->set_active(active);
}
void SATBMarkQueueSet::filter_thread_buffers() {
- {
- ThreadsListHandle tlh;
- JavaThreadIterator jti(tlh.list());
- for (JavaThread* t = jti.first(); t != NULL; t = jti.next()) {
+ for (JavaThreadIteratorWithHandle jtiwh; JavaThread *t = jtiwh.next(); ) {
t->satb_mark_queue().filter();
}
- }
shared_satb_queue()->filter();
}
bool SATBMarkQueueSet::apply_closure_to_completed_buffer(SATBBufferClosure* cl) {
BufferNode* nd = NULL;
@@ -324,18 +308,14 @@
print_satb_buffer(buffer, buf, nd->index(), buffer_size());
nd = nd->next();
i += 1;
}
- {
- ThreadsListHandle tlh;
- JavaThreadIterator jti(tlh.list());
- for (JavaThread* t = jti.first(); t != NULL; t = jti.next()) {
+ for (JavaThreadIteratorWithHandle jtiwh; JavaThread *t = jtiwh.next(); ) {
jio_snprintf(buffer, SATB_PRINTER_BUFFER_SIZE, "Thread: %s", t->name());
t->satb_mark_queue().print(buffer);
}
- }
shared_satb_queue()->print("Shared");
tty->cr();
}
@@ -360,14 +340,10 @@
buffers_to_delete = nd->next();
deallocate_buffer(nd);
}
assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint.");
// So we can safely manipulate these queues.
- {
- ThreadsListHandle tlh;
- JavaThreadIterator jti(tlh.list());
- for (JavaThread* t = jti.first(); t != NULL; t = jti.next()) {
+ for (JavaThreadIteratorWithHandle jtiwh; JavaThread *t = jtiwh.next(); ) {
t->satb_mark_queue().reset();
}
- }
shared_satb_queue()->reset();
}
< prev index next >