--- old/src/hotspot/os/linux/os_linux.cpp Sat Nov 18 16:54:39 2017 +++ new/src/hotspot/os/linux/os_linux.cpp Sat Nov 18 16:54:38 2017 @@ -58,6 +58,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" @@ -1602,7 +1603,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" @@ -1830,9 +1834,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())) { @@ -1839,7 +1841,6 @@ warning("Attempt to reguard stack yellow zone failed."); } } - jt = jt->next(); } }