--- old/src/hotspot/share/runtime/os.cpp Wed Nov 8 08:13:16 2017 +++ new/src/hotspot/share/runtime/os.cpp Wed Nov 8 08:13:15 2017 @@ -1093,37 +1093,33 @@ } #endif - { - ThreadsListHandle tlh; - JavaThreadIterator jti(tlh.list()); - for (JavaThread *thread = jti.first(); thread != NULL; thread = jti.next()) { - // Check for privilege stack - if (thread->privileged_stack_top() != NULL && - thread->privileged_stack_top()->contains(addr)) { - st->print_cr(INTPTR_FORMAT " is pointing into the privilege stack " - "for thread: " INTPTR_FORMAT, p2i(addr), p2i(thread)); - if (verbose) thread->print_on(st); - return; + for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next(); ) { + // Check for privilege stack + if (thread->privileged_stack_top() != NULL && + thread->privileged_stack_top()->contains(addr)) { + st->print_cr(INTPTR_FORMAT " is pointing into the privilege stack " + "for thread: " INTPTR_FORMAT, p2i(addr), p2i(thread)); + if (verbose) thread->print_on(st); + return; + } + // If the addr is a java thread print information about that. + if (addr == (address)thread) { + if (verbose) { + thread->print_on(st); + } else { + st->print_cr(INTPTR_FORMAT " is a thread", p2i(addr)); } - // If the addr is a java thread print information about that. - if (addr == (address)thread) { - if (verbose) { - thread->print_on(st); - } else { - st->print_cr(INTPTR_FORMAT " is a thread", p2i(addr)); - } - return; - } - // If the addr is in the stack region for this thread then report that - // and print thread info - if (thread->on_local_stack(addr)) { - st->print_cr(INTPTR_FORMAT " is pointing into the stack for thread: " - INTPTR_FORMAT, p2i(addr), p2i(thread)); - if (verbose) thread->print_on(st); - return; - } + return; } - } // ThreadsListHandle destroyed here. + // If the addr is in the stack region for this thread then report that + // and print thread info + if (thread->on_local_stack(addr)) { + st->print_cr(INTPTR_FORMAT " is pointing into the stack for thread: " + INTPTR_FORMAT, p2i(addr), p2i(thread)); + if (verbose) thread->print_on(st); + return; + } + } // Check if in metaspace and print types that have vptrs (only method now) if (Metaspace::contains(addr)) {