17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #ifndef SHARE_RUNTIME_JAVATHREAD_HPP
27 #define SHARE_RUNTIME_JAVATHREAD_HPP
28
29 #include "jni.h"
30 #include "memory/allocation.hpp"
31 #include "oops/oop.hpp"
32 #include "oops/oopHandle.hpp"
33 #include "runtime/frame.hpp"
34 #include "runtime/globals.hpp"
35 #include "runtime/handshake.hpp"
36 #include "runtime/javaFrameAnchor.hpp"
37 #include "runtime/park.hpp"
38 #include "runtime/safepointMechanism.hpp"
39 #include "runtime/stackWatermarkSet.hpp"
40 #include "runtime/stackOverflow.hpp"
41 #include "runtime/thread.hpp"
42 #include "runtime/threadHeapSampler.hpp"
43 #include "runtime/threadStatisticalInfo.hpp"
44 #include "utilities/exceptions.hpp"
45 #include "utilities/globalDefinitions.hpp"
46 #include "utilities/macros.hpp"
47 #if INCLUDE_JFR
48 #include "jfr/support/jfrThreadExtension.hpp"
49 #endif
50
51 class AsyncExceptionHandshake;
52 class ContinuationEntry;
53 class DeoptResourceMark;
54 class JNIHandleBlock;
55 class JVMCIRuntime;
56
1123 inline void set_done_attaching_via_jni();
1124
1125 // Stack dump assistance:
1126 // Track the class we want to initialize but for which we have to wait
1127 // on its init_lock() because it is already being initialized.
1128 void set_class_to_be_initialized(InstanceKlass* k);
1129 InstanceKlass* class_to_be_initialized() const;
1130
1131 private:
1132 InstanceKlass* _class_to_be_initialized;
1133
1134 // java.lang.Thread.sleep support
1135 ParkEvent * _SleepEvent;
1136 public:
1137 bool sleep(jlong millis);
1138
1139 // java.lang.Thread interruption support
1140 void interrupt();
1141 bool is_interrupted(bool clear_interrupted);
1142
1143 static OopStorage* thread_oop_storage();
1144
1145 static void verify_cross_modify_fence_failure(JavaThread *thread) PRODUCT_RETURN;
1146
1147 // Helper function to create the java.lang.Thread object for a
1148 // VM-internal thread. The thread will have the given name, be
1149 // part of the System ThreadGroup and if is_visible is true will be
1150 // discoverable via the system ThreadGroup.
1151 static Handle create_system_thread_object(const char* name, bool is_visible, TRAPS);
1152
1153 // Helper function to start a VM-internal daemon thread.
1154 // E.g. ServiceThread, NotificationThread, CompilerThread etc.
1155 static void start_internal_daemon(JavaThread* current, JavaThread* target,
1156 Handle thread_oop, ThreadPriority prio);
1157
1158 // Helper function to do vm_exit_on_initialization for osthread
1159 // resource allocation failure.
1160 static void vm_exit_on_osthread_failure(JavaThread* thread);
1161
1162 // Deferred OopHandle release support
|
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #ifndef SHARE_RUNTIME_JAVATHREAD_HPP
27 #define SHARE_RUNTIME_JAVATHREAD_HPP
28
29 #include "jni.h"
30 #include "memory/allocation.hpp"
31 #include "oops/oop.hpp"
32 #include "oops/oopHandle.hpp"
33 #include "runtime/frame.hpp"
34 #include "runtime/globals.hpp"
35 #include "runtime/handshake.hpp"
36 #include "runtime/javaFrameAnchor.hpp"
37 #include "runtime/lockStack.hpp"
38 #include "runtime/park.hpp"
39 #include "runtime/safepointMechanism.hpp"
40 #include "runtime/stackWatermarkSet.hpp"
41 #include "runtime/stackOverflow.hpp"
42 #include "runtime/thread.hpp"
43 #include "runtime/threadHeapSampler.hpp"
44 #include "runtime/threadStatisticalInfo.hpp"
45 #include "utilities/exceptions.hpp"
46 #include "utilities/globalDefinitions.hpp"
47 #include "utilities/macros.hpp"
48 #if INCLUDE_JFR
49 #include "jfr/support/jfrThreadExtension.hpp"
50 #endif
51
52 class AsyncExceptionHandshake;
53 class ContinuationEntry;
54 class DeoptResourceMark;
55 class JNIHandleBlock;
56 class JVMCIRuntime;
57
1124 inline void set_done_attaching_via_jni();
1125
1126 // Stack dump assistance:
1127 // Track the class we want to initialize but for which we have to wait
1128 // on its init_lock() because it is already being initialized.
1129 void set_class_to_be_initialized(InstanceKlass* k);
1130 InstanceKlass* class_to_be_initialized() const;
1131
1132 private:
1133 InstanceKlass* _class_to_be_initialized;
1134
1135 // java.lang.Thread.sleep support
1136 ParkEvent * _SleepEvent;
1137 public:
1138 bool sleep(jlong millis);
1139
1140 // java.lang.Thread interruption support
1141 void interrupt();
1142 bool is_interrupted(bool clear_interrupted);
1143
1144 private:
1145 LockStack _lock_stack;
1146
1147 public:
1148 LockStack& lock_stack() { return _lock_stack; }
1149
1150 static ByteSize lock_stack_current_offset() { return byte_offset_of(JavaThread, _lock_stack) + LockStack::current_offset(); }
1151 static ByteSize lock_stack_limit_offset() { return byte_offset_of(JavaThread, _lock_stack) + LockStack::limit_offset(); }
1152
1153
1154 static OopStorage* thread_oop_storage();
1155
1156 static void verify_cross_modify_fence_failure(JavaThread *thread) PRODUCT_RETURN;
1157
1158 // Helper function to create the java.lang.Thread object for a
1159 // VM-internal thread. The thread will have the given name, be
1160 // part of the System ThreadGroup and if is_visible is true will be
1161 // discoverable via the system ThreadGroup.
1162 static Handle create_system_thread_object(const char* name, bool is_visible, TRAPS);
1163
1164 // Helper function to start a VM-internal daemon thread.
1165 // E.g. ServiceThread, NotificationThread, CompilerThread etc.
1166 static void start_internal_daemon(JavaThread* current, JavaThread* target,
1167 Handle thread_oop, ThreadPriority prio);
1168
1169 // Helper function to do vm_exit_on_initialization for osthread
1170 // resource allocation failure.
1171 static void vm_exit_on_osthread_failure(JavaThread* thread);
1172
1173 // Deferred OopHandle release support
|