--- old/src/hotspot/share/runtime/os.cpp Wed Nov 8 09:06:23 2017 +++ new/src/hotspot/share/runtime/os.cpp Wed Nov 8 09:06:23 2017 @@ -54,6 +54,7 @@ #include "runtime/os.inline.hpp" #include "runtime/stubRoutines.hpp" #include "runtime/thread.inline.hpp" +#include "runtime/threadSMR.hpp" #include "runtime/vm_version.hpp" #include "services/attachListener.hpp" #include "services/mallocTracker.hpp" @@ -197,15 +198,7 @@ } OSReturn os::set_priority(Thread* thread, ThreadPriority p) { -#ifdef ASSERT - if (!(!thread->is_Java_thread() || - Thread::current() == thread || - Threads_lock->owned_by_self() - || thread->is_Compiler_thread() - )) { - assert(false, "possibility of dangling Thread pointer"); - } -#endif + debug_only(Thread::check_for_dangling_thread_pointer(thread);) if (p >= MinPriority && p <= MaxPriority) { int priority = java_to_os_priority[p]; @@ -1100,7 +1093,7 @@ } #endif - for(JavaThread *thread = Threads::first(); thread; thread = thread->next()) { + for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next(); ) { // Check for privilege stack if (thread->privileged_stack_top() != NULL && thread->privileged_stack_top()->contains(addr)) { @@ -1126,7 +1119,6 @@ if (verbose) thread->print_on(st); return; } - } // Check if in metaspace and print types that have vptrs (only method now) @@ -1665,7 +1657,6 @@ } void os::SuspendedThreadTask::run() { - assert(Threads_lock->owned_by_self() || (_thread == VMThread::vm_thread()), "must have threads lock to call this"); internal_do_task(); _done = true; }