/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "classfile/symbolTable.hpp"
#include "classfile/vmSymbols.hpp"
#include "compiler/compileBroker.hpp"
#include "compiler/compilerOracle.hpp"
#include "gc_implementation/shared/isGCActiveMark.hpp"
#include "memory/resourceArea.hpp"
#include "oops/symbol.hpp"
#include "runtime/arguments.hpp"
#include "runtime/deoptimization.hpp"
#include "runtime/interfaceSupport.hpp"
#include "runtime/sweeper.hpp"
#include "runtime/vm_operations.hpp"
#include "services/threadService.hpp"
#include "trace/tracing.hpp"
#ifdef TARGET_OS_FAMILY_linux
# include "thread_linux.inline.hpp"
#endif
#ifdef TARGET_OS_FAMILY_solaris
# include "thread_solaris.inline.hpp"
#endif
#ifdef TARGET_OS_FAMILY_windows
# include "thread_windows.inline.hpp"
#endif
#ifdef TARGET_OS_FAMILY_bsd
# include "thread_bsd.inline.hpp"
#endif
}
if (TraceVMOperation) {
NOT_PRODUCT(print();)
}
doit();
if (TraceVMOperation) {
}
}
switch(mode) {
case _safepoint : return "safepoint";
case _no_safepoint : return "no safepoint";
case _concurrent : return "concurrent";
case _async_safepoint: return "async safepoint";
default : return "unknown";
}
}
// Called by fatal error handler.
if (calling_thread()) {
}
}
// Note that this now allows multiple ThreadDeath exceptions to be
// thrown at a thread.
// the thread has run and is not already in the process of exiting
}
}
// We do not want any GCs to happen while we are in the middle of this VM operation
// Deoptimize all activations depending on marked nmethods
// Make the dependent methods zombies
}
}
}
#ifndef PRODUCT
// deoptimize all java threads in the system
if (DeoptimizeALot) {
if (thread->has_last_Java_frame()) {
thread->deoptimize();
}
}
} else if (DeoptimizeRandom) {
// Deoptimize some selected threads and frames
int tcount = 0;
if (thread->has_last_Java_frame()) {
tcount = 0;
int fcount = 0;
// Deoptimize some selected frames.
// Biased llocking wants a updated register map
fcount = 0;
}
}
}
}
}
}
}
}
thread->make_zombies();
}
#endif // !PRODUCT
SymbolTable::unlink();
}
}
}
// Make sure AbstractOwnableSynchronizer is loaded
if (JDK_Version::is_gte_jdk16x_version()) {
}
// Get Heap_lock if concurrent locks will be dumped
if (_print_concurrent_locks) {
}
return true;
}
}
if (_print_concurrent_locks) {
// Release Heap_lock
}
}
}
if (_deadlocks != NULL) {
DeadlockCycle* d = cycle;
delete d;
}
}
}
// Load AbstractOwnableSynchronizer class
}
return true;
}
int num_deadlocks = 0;
}
if (num_deadlocks == 1) {
} else if (num_deadlocks > 1) {
}
}
}
int max_depth,
bool with_locked_monitors,
bool with_locked_synchronizers) {
_num_threads = 0; // 0 indicates all threads
}
int num_threads,
int max_depth,
bool with_locked_monitors,
bool with_locked_synchronizers) {
}
// Load AbstractOwnableSynchronizer class before taking thread snapshots
if (JDK_Version::is_gte_jdk16x_version()) {
}
if (_with_locked_synchronizers) {
// Acquire Heap_lock to dump concurrent locks
}
return true;
}
if (_with_locked_synchronizers) {
// Release Heap_lock
}
}
if (_with_locked_synchronizers) {
}
if (_num_threads == 0) {
// Snapshot all live threads
if (jt->is_exiting() ||
// skip terminating threads and hidden threads
continue;
}
if (_with_locked_synchronizers) {
}
}
} else {
// Snapshot threads in the given _threads array
// A dummy snapshot is created if a thread doesn't exist
for (int i = 0; i < _num_threads; i++) {
// skip if the thread doesn't exist
// Add a dummy snapshot
continue;
}
// Dump thread stack only if the thread is alive and not exiting
// and not VM internal thread.
jt->is_exiting() ||
// add a NULL snapshot if skipped
continue;
}
if (_with_locked_synchronizers) {
}
}
}
}
ThreadSnapshot* VM_ThreadDump::snapshot_thread(JavaThread* java_thread, ThreadConcurrentLocks* tcl) {
return snapshot;
}
int num_active = 0;
_vm_exited = true; // global flag
++num_active;
}
return num_active;
}
// VM exits at safepoint. This function must be called at the final safepoint
// to wait for threads in _thread_in_native state to be quiescent.
// Compiler threads need longer wait because they can access VM data directly
// while in native. If they are active and some structures being used are
// deleted by the shutdown sequence, they will crash. On the other hand, user
// data, and they will be stopped during state transition. In theory, we
// don't have to wait for user threads to be quiescent, but it's always
// better to terminate VM when current thread is the only active thread, so
// wait for user threads too. Numbers are in 10 milliseconds.
int attempts = 0;
while (true) {
int num_active = 0;
int num_active_compiler_thread = 0;
num_active++;
if (thr->is_Compiler_thread()) {
}
}
}
if (num_active == 0) {
return 0;
return num_active;
return num_active;
}
attempts++;
}
}
// Wait for a short period for threads in native to block. Any thread
// still executing native code after the wait will be stopped at
// Among 16276 JCK tests, 94% of them come here without any threads still
// running in native; the other 6% are quiescent within 250ms (Ultra 80).
// cleanup globals resources before exiting. exit_globals() currently
// cleans up outputStream resources and PerfMemory resources.
exit_globals();
// Check for exit hook
// exit hook should exit.
// ... but if it didn't, we must do it here
} else {
}
}
if (_vm_exited &&
// _vm_exited is set at safepoint, and the Threads_lock is never released
// we will block here until the process dies
}
}