--- old/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp Wed Nov 8 08:12:43 2017 +++ new/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp Wed Nov 8 08:12:42 2017 @@ -49,13 +49,9 @@ void ThreadLocalAllocBuffer::accumulate_statistics_before_gc() { global_stats()->initialize(); - { - ThreadsListHandle tlh; - JavaThreadIterator jti(tlh.list()); - for (JavaThread *thread = jti.first(); thread != NULL; thread = jti.next()) { - thread->tlab().accumulate_statistics(); - thread->tlab().initialize_statistics(); - } + for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next(); ) { + thread->tlab().accumulate_statistics(); + thread->tlab().initialize_statistics(); } // Publish new stats if some allocation occurred. @@ -135,9 +131,7 @@ void ThreadLocalAllocBuffer::resize_all_tlabs() { if (ResizeTLAB) { - ThreadsListHandle tlh; - JavaThreadIterator jti(tlh.list()); - for (JavaThread *thread = jti.first(); thread != NULL; thread = jti.next()) { + for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next(); ) { thread->tlab().resize(); } }