/* * Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * 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. *
*/
if (thread_oop == NULL) { // Then thread should not be NULL (see assert above).
thread_oop = thread->jvmti_vthread() != NULL ? thread->jvmti_vthread() : thread->threadObj();
}
// In a case of unmounted virtual thread the thread can be NULL.
JvmtiThreadState *state = thread == NULL ? NULL : thread->jvmti_thread_state();
if (state == NULL && thread != NULL && thread->is_exiting()) { // Don't add a JvmtiThreadState to a thread that is exiting. return NULL;
} if (state == NULL || state->get_thread_oop() != thread_oop) { // Check if java_lang_Thread already has a link to the JvmtiThreadState. if (thread_oop != NULL) { // thread_oop can be NULL during early VMStart.
state = java_lang_Thread::jvmti_thread_state(thread_oop);
} if (state == NULL) { // Need to create state.
state = new JvmtiThreadState(thread, thread_oop);
}
} return state;
}
inline JvmtiThreadState* JvmtiThreadState::state_for(JavaThread *thread, Handle thread_handle) { // In a case of unmounted virtual thread the thread can be NULL.
JvmtiThreadState* state = thread_handle == NULL ? thread->jvmti_thread_state() :
java_lang_Thread::jvmti_thread_state(thread_handle()); if (state == NULL) {
MutexLocker mu(JvmtiThreadState_lock); // check again with the lock held
state = state_for_while_locked(thread, thread_handle());
} else { // Check possible safepoint even if state is non-null. // (Note: the thread argument isn't the current thread)
DEBUG_ONLY(JavaThread::current()->check_possible_safepoint());
} return state;
}
inline JavaThread* JvmtiThreadState::get_thread_or_saved() { // Use _thread_saved if cthread is detached from JavaThread (_thread == NULL). return (_thread == NULL && !is_virtual()) ? _thread_saved : _thread;
}
inlinevoid JvmtiThreadState::unbind_from(JvmtiThreadState* state, JavaThread* thread) { if (state == NULL) { return;
} // Save thread's interp_only_mode.
state->_saved_interp_only_mode = thread->get_interp_only_mode();
state->set_thread(NULL); // Make sure stale _thread value is never used.
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.