/* * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, Azul Systems, Inc. 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. *
*/
class JavaThread; class Metadata; class Thread; class ThreadClosure; class ThreadsList; class outputStream;
class CodeBlobClosure; class MetadataClosure; class OopClosure;
// The active thread queue. It also keeps track of the current used // thread priorities. class Threads: AllStatic { friendclass VMStructs; private: staticint _number_of_threads; staticint _number_of_non_daemon_threads; staticint _return_code; static uintx _thread_claim_token; #ifdef ASSERT staticbool _vm_complete; #endif
public: // Thread management // force_daemon is a concession to JNI, where we may need to add a // thread to the thread list before allocating its thread object staticvoid add(JavaThread* p, bool force_daemon = false); staticvoid remove(JavaThread* p, bool is_daemon); staticvoid non_java_threads_do(ThreadClosure* tc); staticvoid java_threads_do(ThreadClosure* tc); staticvoid threads_do(ThreadClosure* tc); staticvoid possibly_parallel_threads_do(bool is_par, ThreadClosure* tc);
// Initializes the vm and creates the vm thread static jint create_vm(JavaVMInitArgs* args, bool* canTryAgain); staticvoid convert_vm_init_libraries_to_agents(); staticvoid create_vm_init_libraries(); staticvoid create_vm_init_agents(); staticvoid shutdown_vm_agents(); staticvoid destroy_vm(); // Supported VM versions via JNI // Includes JNI_VERSION_1_1 static jboolean is_supported_jni_version_including_1_1(jint version); // Does not include JNI_VERSION_1_1 static jboolean is_supported_jni_version(jint version);
// The "thread claim token" provides a way for threads to be claimed // by parallel worker tasks. // // Each thread contains a "token" field. A task will claim the // thread only if its token is different from the global token, // which is updated by calling change_thread_claim_token(). When // a thread is claimed, it's token is set to the global token value // so other threads in the same iteration pass won't claim it. // // For this to work change_thread_claim_token() needs to be called // exactly once in sequential code before starting parallel tasks // that should claim threads. // // New threads get their token set to 0 and change_thread_claim_token() // never sets the global token to 0. static uintx thread_claim_token() { return _thread_claim_token; } staticvoid change_thread_claim_token(); staticvoid assert_all_threads_claimed() NOT_DEBUG_RETURN;
// Apply "f->do_oop" to all root oops in all threads. // This version may only be called by sequential code. staticvoid oops_do(OopClosure* f, CodeBlobClosure* cf); // This version may be called by sequential or parallel code. staticvoid possibly_parallel_oops_do(bool is_par, OopClosure* f, CodeBlobClosure* cf);
// RedefineClasses support staticvoid metadata_do(MetadataClosure* f); staticvoid metadata_handles_do(void f(Metadata*));
// Verification staticvoid verify(); staticvoid print_on(outputStream* st, bool print_stacks, bool internal_format, bool print_concurrent_locks, bool print_extended_info); staticvoid print(bool print_stacks, bool internal_format) { // this function is only used by debug.cpp
print_on(tty, print_stacks, internal_format, false/* no concurrent lock printed */, false /* simple format */);
} staticvoid print_on_error(outputStream* st, Thread* current, char* buf, int buflen); staticvoid print_on_error(Thread* this_thread, outputStream* st, Thread* current, char* buf, int buflen, bool* found_current); staticvoid print_threads_compiling(outputStream* st, char* buf, int buflen, bool short_form = false);
// Get Java threads that are waiting to enter a monitor. static GrowableArray<JavaThread*>* get_pending_threads(ThreadsList * t_list, int count, address monitor);
// Get owning Java thread from the monitor's owner field. static JavaThread *owning_thread_from_monitor_owner(ThreadsList * t_list,
address owner);
// Number of threads on the active threads list staticint number_of_threads() { return _number_of_threads; } // Number of non-daemon threads on the active threads list staticint number_of_non_daemon_threads() { return _number_of_non_daemon_threads; }
struct Test; // For private gtest access.
};
#endif// SHARE_RUNTIME_THREADS_HPP
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet)
¤
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.