--- old/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp Mon Oct 9 11:13:11 2017 +++ new/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp Mon Oct 9 11:13:10 2017 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,7 @@ #include "memory/universe.inline.hpp" #include "oops/oop.inline.hpp" #include "runtime/thread.inline.hpp" +#include "runtime/threadSMR.hpp" #include "utilities/copy.hpp" // Thread-Local Edens support @@ -48,9 +49,13 @@ void ThreadLocalAllocBuffer::accumulate_statistics_before_gc() { global_stats()->initialize(); - for (JavaThread *thread = Threads::first(); thread != NULL; thread = thread->next()) { - thread->tlab().accumulate_statistics(); - thread->tlab().initialize_statistics(); + { + ThreadsListHandle tlh; + JavaThreadIterator jti(tlh.list()); + for (JavaThread *thread = jti.first(); thread != NULL; thread = jti.next()) { + thread->tlab().accumulate_statistics(); + thread->tlab().initialize_statistics(); + } } // Publish new stats if some allocation occurred. @@ -130,7 +135,9 @@ void ThreadLocalAllocBuffer::resize_all_tlabs() { if (ResizeTLAB) { - for (JavaThread *thread = Threads::first(); thread != NULL; thread = thread->next()) { + ThreadsListHandle tlh; + JavaThreadIterator jti(tlh.list()); + for (JavaThread *thread = jti.first(); thread != NULL; thread = jti.next()) { thread->tlab().resize(); } }