1 /*
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
2052 static JavaThread* _thread_list;
2053 static int _number_of_threads;
2054 static int _number_of_non_daemon_threads;
2055 static int _return_code;
2056 static int _thread_claim_parity;
2057 #ifdef ASSERT
2058 static bool _vm_complete;
2059 #endif
2060
2061 static void initialize_java_lang_classes(JavaThread* main_thread, TRAPS);
2062 static void initialize_jsr292_core_classes(TRAPS);
2063 public:
2064 // Thread management
2065 // force_daemon is a concession to JNI, where we may need to add a
2066 // thread to the thread list before allocating its thread object
2067 static void add(JavaThread* p, bool force_daemon = false);
2068 static void remove(JavaThread* p);
2069 static bool includes(JavaThread* p);
2070 static JavaThread* first() { return _thread_list; }
2071 static void threads_do(ThreadClosure* tc);
2072
2073 // Initializes the vm and creates the vm thread
2074 static jint create_vm(JavaVMInitArgs* args, bool* canTryAgain);
2075 static void convert_vm_init_libraries_to_agents();
2076 static void create_vm_init_libraries();
2077 static void create_vm_init_agents();
2078 static void shutdown_vm_agents();
2079 static bool destroy_vm();
2080 // Supported VM versions via JNI
2081 // Includes JNI_VERSION_1_1
2082 static jboolean is_supported_jni_version_including_1_1(jint version);
2083 // Does not include JNI_VERSION_1_1
2084 static jboolean is_supported_jni_version(jint version);
2085
2086 // The "thread claim parity" provides a way for threads to be claimed
2087 // by parallel worker tasks.
2088 //
2089 // Each thread contains a a "parity" field. A task will claim the
2090 // thread only if its parity field is the same as the global parity,
2091 // which is updated by calling change_thread_claim_parity().
|
1 /*
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
2052 static JavaThread* _thread_list;
2053 static int _number_of_threads;
2054 static int _number_of_non_daemon_threads;
2055 static int _return_code;
2056 static int _thread_claim_parity;
2057 #ifdef ASSERT
2058 static bool _vm_complete;
2059 #endif
2060
2061 static void initialize_java_lang_classes(JavaThread* main_thread, TRAPS);
2062 static void initialize_jsr292_core_classes(TRAPS);
2063 public:
2064 // Thread management
2065 // force_daemon is a concession to JNI, where we may need to add a
2066 // thread to the thread list before allocating its thread object
2067 static void add(JavaThread* p, bool force_daemon = false);
2068 static void remove(JavaThread* p);
2069 static bool includes(JavaThread* p);
2070 static JavaThread* first() { return _thread_list; }
2071 static void threads_do(ThreadClosure* tc);
2072 static void parallel_java_threads_do(ThreadClosure* tc);
2073
2074 // Initializes the vm and creates the vm thread
2075 static jint create_vm(JavaVMInitArgs* args, bool* canTryAgain);
2076 static void convert_vm_init_libraries_to_agents();
2077 static void create_vm_init_libraries();
2078 static void create_vm_init_agents();
2079 static void shutdown_vm_agents();
2080 static bool destroy_vm();
2081 // Supported VM versions via JNI
2082 // Includes JNI_VERSION_1_1
2083 static jboolean is_supported_jni_version_including_1_1(jint version);
2084 // Does not include JNI_VERSION_1_1
2085 static jboolean is_supported_jni_version(jint version);
2086
2087 // The "thread claim parity" provides a way for threads to be claimed
2088 // by parallel worker tasks.
2089 //
2090 // Each thread contains a a "parity" field. A task will claim the
2091 // thread only if its parity field is the same as the global parity,
2092 // which is updated by calling change_thread_claim_parity().
|