--- old/src/hotspot/os/linux/os_linux.cpp Tue Nov 21 15:09:25 2017 +++ new/src/hotspot/os/linux/os_linux.cpp Tue Nov 21 15:09:25 2017 @@ -59,6 +59,7 @@ #include "runtime/stubRoutines.hpp" #include "runtime/thread.inline.hpp" #include "runtime/threadCritical.hpp" +#include "runtime/threadSMR.hpp" #include "runtime/timer.hpp" #include "semaphore_posix.hpp" #include "services/attachListener.hpp" @@ -1642,7 +1643,10 @@ // // Dynamic loader will make all stacks executable after // this function returns, and will not do that again. - assert(Threads::first() == NULL, "no Java threads should exist yet."); +#ifdef ASSERT + ThreadsListHandle tlh; + assert(tlh.length() == 0, "no Java threads should exist yet."); +#endif } else { warning("You have loaded library %s which might have disabled stack guard. " "The VM will try to fix the stack guard now.\n" @@ -1870,9 +1874,7 @@ // may have been queued at the same time. if (!_stack_is_executable) { - JavaThread *jt = Threads::first(); - - while (jt) { + for (JavaThreadIteratorWithHandle jtiwh; JavaThread *jt = jtiwh.next(); ) { if (!jt->stack_guard_zone_unused() && // Stack not yet fully initialized jt->stack_guards_enabled()) { // No pending stack overflow exceptions if (!os::guard_memory((char *)jt->stack_end(), jt->stack_guard_zone_size())) { @@ -1879,7 +1881,6 @@ warning("Attempt to reguard stack yellow zone failed."); } } - jt = jt->next(); } }