annotate src/share/vm/runtime/safepoint.hpp @ 3979:4dfb2df418f2

6484982: G1: process references during evacuation pauses Summary: G1 now uses two reference processors - one is used by concurrent marking and the other is used by STW GCs (both full and incremental evacuation pauses). In an evacuation pause, the reference processor is embedded into the closures used to scan objects. Doing so causes causes reference objects to be 'discovered' by the reference processor. At the end of the evacuation pause, these discovered reference objects are processed - preserving (and copying) referent objects (and their reachable graphs) as appropriate. Reviewed-by: ysr, jwilhelm, brutisso, stefank, tonyp
author johnc
date Thu, 22 Sep 2011 10:57:37 -0700
parents f95d63e2154a
children 1a2723f7ad8e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1727
diff changeset
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1291
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1291
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1291
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
25 #ifndef SHARE_VM_RUNTIME_SAFEPOINT_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
26 #define SHARE_VM_RUNTIME_SAFEPOINT_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
28 #include "asm/assembler.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
29 #include "code/nmethod.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
30 #include "memory/allocation.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
31 #include "runtime/extendedPC.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
32 #include "runtime/os.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
33 #include "utilities/ostream.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
34
0
a61af66fc99e Initial load
duke
parents:
diff changeset
35 //
a61af66fc99e Initial load
duke
parents:
diff changeset
36 // Safepoint synchronization
a61af66fc99e Initial load
duke
parents:
diff changeset
37 ////
a61af66fc99e Initial load
duke
parents:
diff changeset
38 // The VMThread or CMS_thread uses the SafepointSynchronize::begin/end
a61af66fc99e Initial load
duke
parents:
diff changeset
39 // methods to enter/exit a safepoint region. The begin method will roll
a61af66fc99e Initial load
duke
parents:
diff changeset
40 // all JavaThreads forward to a safepoint.
a61af66fc99e Initial load
duke
parents:
diff changeset
41 //
a61af66fc99e Initial load
duke
parents:
diff changeset
42 // JavaThreads must use the ThreadSafepointState abstraction (defined in
a61af66fc99e Initial load
duke
parents:
diff changeset
43 // thread.hpp) to indicate that that they are at a safepoint.
a61af66fc99e Initial load
duke
parents:
diff changeset
44 //
a61af66fc99e Initial load
duke
parents:
diff changeset
45 // The Mutex/Condition variable and ObjectLocker classes calls the enter/
a61af66fc99e Initial load
duke
parents:
diff changeset
46 // exit safepoint methods, when a thread is blocked/restarted. Hence, all mutex exter/
a61af66fc99e Initial load
duke
parents:
diff changeset
47 // exit points *must* be at a safepoint.
a61af66fc99e Initial load
duke
parents:
diff changeset
48
a61af66fc99e Initial load
duke
parents:
diff changeset
49
a61af66fc99e Initial load
duke
parents:
diff changeset
50 class ThreadSafepointState;
a61af66fc99e Initial load
duke
parents:
diff changeset
51 class SnippetCache;
a61af66fc99e Initial load
duke
parents:
diff changeset
52 class nmethod;
a61af66fc99e Initial load
duke
parents:
diff changeset
53
a61af66fc99e Initial load
duke
parents:
diff changeset
54 //
a61af66fc99e Initial load
duke
parents:
diff changeset
55 // Implements roll-forward to safepoint (safepoint synchronization)
a61af66fc99e Initial load
duke
parents:
diff changeset
56 //
a61af66fc99e Initial load
duke
parents:
diff changeset
57 class SafepointSynchronize : AllStatic {
a61af66fc99e Initial load
duke
parents:
diff changeset
58 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
59 enum SynchronizeState {
a61af66fc99e Initial load
duke
parents:
diff changeset
60 _not_synchronized = 0, // Threads not synchronized at a safepoint
a61af66fc99e Initial load
duke
parents:
diff changeset
61 // Keep this value 0. See the coment in do_call_back()
a61af66fc99e Initial load
duke
parents:
diff changeset
62 _synchronizing = 1, // Synchronizing in progress
a61af66fc99e Initial load
duke
parents:
diff changeset
63 _synchronized = 2 // All Java threads are stopped at a safepoint. Only VM thread is running
a61af66fc99e Initial load
duke
parents:
diff changeset
64 };
a61af66fc99e Initial load
duke
parents:
diff changeset
65
a61af66fc99e Initial load
duke
parents:
diff changeset
66 enum SafepointingThread {
a61af66fc99e Initial load
duke
parents:
diff changeset
67 _null_thread = 0,
a61af66fc99e Initial load
duke
parents:
diff changeset
68 _vm_thread = 1,
a61af66fc99e Initial load
duke
parents:
diff changeset
69 _other_thread = 2
a61af66fc99e Initial load
duke
parents:
diff changeset
70 };
a61af66fc99e Initial load
duke
parents:
diff changeset
71
a61af66fc99e Initial load
duke
parents:
diff changeset
72 enum SafepointTimeoutReason {
a61af66fc99e Initial load
duke
parents:
diff changeset
73 _spinning_timeout = 0,
a61af66fc99e Initial load
duke
parents:
diff changeset
74 _blocking_timeout = 1
a61af66fc99e Initial load
duke
parents:
diff changeset
75 };
a61af66fc99e Initial load
duke
parents:
diff changeset
76
a61af66fc99e Initial load
duke
parents:
diff changeset
77 typedef struct {
1291
4b0f2f4918ed 6933402: RFE: Improve PrintSafepointStatistics output to track cleanup time
xlu
parents: 0
diff changeset
78 float _time_stamp; // record when the current safepoint occurs in seconds
0
a61af66fc99e Initial load
duke
parents:
diff changeset
79 int _vmop_type; // type of VM operation triggers the safepoint
a61af66fc99e Initial load
duke
parents:
diff changeset
80 int _nof_total_threads; // total number of Java threads
a61af66fc99e Initial load
duke
parents:
diff changeset
81 int _nof_initial_running_threads; // total number of initially seen running threads
a61af66fc99e Initial load
duke
parents:
diff changeset
82 int _nof_threads_wait_to_block; // total number of threads waiting for to block
a61af66fc99e Initial load
duke
parents:
diff changeset
83 bool _page_armed; // true if polling page is armed, false otherwise
a61af66fc99e Initial load
duke
parents:
diff changeset
84 int _nof_threads_hit_page_trap; // total number of threads hitting the page trap
a61af66fc99e Initial load
duke
parents:
diff changeset
85 jlong _time_to_spin; // total time in millis spent in spinning
a61af66fc99e Initial load
duke
parents:
diff changeset
86 jlong _time_to_wait_to_block; // total time in millis spent in waiting for to block
1291
4b0f2f4918ed 6933402: RFE: Improve PrintSafepointStatistics output to track cleanup time
xlu
parents: 0
diff changeset
87 jlong _time_to_do_cleanups; // total time in millis spent in performing cleanups
0
a61af66fc99e Initial load
duke
parents:
diff changeset
88 jlong _time_to_sync; // total time in millis spent in getting to _synchronized
a61af66fc99e Initial load
duke
parents:
diff changeset
89 jlong _time_to_exec_vmop; // total time in millis spent in vm operation itself
a61af66fc99e Initial load
duke
parents:
diff changeset
90 } SafepointStats;
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
93 static volatile SynchronizeState _state; // Threads might read this flag directly, without acquireing the Threads_lock
1291
4b0f2f4918ed 6933402: RFE: Improve PrintSafepointStatistics output to track cleanup time
xlu
parents: 0
diff changeset
94 static volatile int _waiting_to_block; // number of threads we are waiting for to block
0
a61af66fc99e Initial load
duke
parents:
diff changeset
95
a61af66fc99e Initial load
duke
parents:
diff changeset
96 // This counter is used for fast versions of jni_Get<Primitive>Field.
a61af66fc99e Initial load
duke
parents:
diff changeset
97 // An even value means there is no ongoing safepoint operations.
a61af66fc99e Initial load
duke
parents:
diff changeset
98 // The counter is incremented ONLY at the beginning and end of each
a61af66fc99e Initial load
duke
parents:
diff changeset
99 // safepoint. The fact that Threads_lock is held throughout each pair of
a61af66fc99e Initial load
duke
parents:
diff changeset
100 // increments (at the beginning and end of each safepoint) guarantees
a61af66fc99e Initial load
duke
parents:
diff changeset
101 // race freedom.
a61af66fc99e Initial load
duke
parents:
diff changeset
102 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
103 static volatile int _safepoint_counter;
a61af66fc99e Initial load
duke
parents:
diff changeset
104 private:
1291
4b0f2f4918ed 6933402: RFE: Improve PrintSafepointStatistics output to track cleanup time
xlu
parents: 0
diff changeset
105 static long _end_of_last_safepoint; // Time of last safepoint in milliseconds
0
a61af66fc99e Initial load
duke
parents:
diff changeset
106
a61af66fc99e Initial load
duke
parents:
diff changeset
107 // statistics
1291
4b0f2f4918ed 6933402: RFE: Improve PrintSafepointStatistics output to track cleanup time
xlu
parents: 0
diff changeset
108 static jlong _safepoint_begin_time; // time when safepoint begins
4b0f2f4918ed 6933402: RFE: Improve PrintSafepointStatistics output to track cleanup time
xlu
parents: 0
diff changeset
109 static SafepointStats* _safepoint_stats; // array of SafepointStats struct
4b0f2f4918ed 6933402: RFE: Improve PrintSafepointStatistics output to track cleanup time
xlu
parents: 0
diff changeset
110 static int _cur_stat_index; // current index to the above array
4b0f2f4918ed 6933402: RFE: Improve PrintSafepointStatistics output to track cleanup time
xlu
parents: 0
diff changeset
111 static julong _safepoint_reasons[]; // safepoint count for each VM op
4b0f2f4918ed 6933402: RFE: Improve PrintSafepointStatistics output to track cleanup time
xlu
parents: 0
diff changeset
112 static julong _coalesced_vmop_count; // coalesced vmop count
4b0f2f4918ed 6933402: RFE: Improve PrintSafepointStatistics output to track cleanup time
xlu
parents: 0
diff changeset
113 static jlong _max_sync_time; // maximum sync time in nanos
4b0f2f4918ed 6933402: RFE: Improve PrintSafepointStatistics output to track cleanup time
xlu
parents: 0
diff changeset
114 static jlong _max_vmop_time; // maximum vm operation time in nanos
4b0f2f4918ed 6933402: RFE: Improve PrintSafepointStatistics output to track cleanup time
xlu
parents: 0
diff changeset
115 static float _ts_of_current_safepoint; // time stamp of current safepoint in seconds
0
a61af66fc99e Initial load
duke
parents:
diff changeset
116
a61af66fc99e Initial load
duke
parents:
diff changeset
117 static void begin_statistics(int nof_threads, int nof_running);
a61af66fc99e Initial load
duke
parents:
diff changeset
118 static void update_statistics_on_spin_end();
a61af66fc99e Initial load
duke
parents:
diff changeset
119 static void update_statistics_on_sync_end(jlong end_time);
1291
4b0f2f4918ed 6933402: RFE: Improve PrintSafepointStatistics output to track cleanup time
xlu
parents: 0
diff changeset
120 static void update_statistics_on_cleanup_end(jlong end_time);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
121 static void end_statistics(jlong end_time);
a61af66fc99e Initial load
duke
parents:
diff changeset
122 static void print_statistics();
a61af66fc99e Initial load
duke
parents:
diff changeset
123 inline static void inc_page_trap_count() {
a61af66fc99e Initial load
duke
parents:
diff changeset
124 Atomic::inc(&_safepoint_stats[_cur_stat_index]._nof_threads_hit_page_trap);
a61af66fc99e Initial load
duke
parents:
diff changeset
125 }
a61af66fc99e Initial load
duke
parents:
diff changeset
126
a61af66fc99e Initial load
duke
parents:
diff changeset
127 // For debug long safepoint
a61af66fc99e Initial load
duke
parents:
diff changeset
128 static void print_safepoint_timeout(SafepointTimeoutReason timeout_reason);
a61af66fc99e Initial load
duke
parents:
diff changeset
129
a61af66fc99e Initial load
duke
parents:
diff changeset
130 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
131
a61af66fc99e Initial load
duke
parents:
diff changeset
132 // Main entry points
a61af66fc99e Initial load
duke
parents:
diff changeset
133
a61af66fc99e Initial load
duke
parents:
diff changeset
134 // Roll all threads forward to safepoint. Must be called by the
a61af66fc99e Initial load
duke
parents:
diff changeset
135 // VMThread or CMS_thread.
a61af66fc99e Initial load
duke
parents:
diff changeset
136 static void begin();
a61af66fc99e Initial load
duke
parents:
diff changeset
137 static void end(); // Start all suspended threads again...
a61af66fc99e Initial load
duke
parents:
diff changeset
138
a61af66fc99e Initial load
duke
parents:
diff changeset
139 static bool safepoint_safe(JavaThread *thread, JavaThreadState state);
a61af66fc99e Initial load
duke
parents:
diff changeset
140
a61af66fc99e Initial load
duke
parents:
diff changeset
141 // Query
a61af66fc99e Initial load
duke
parents:
diff changeset
142 inline static bool is_at_safepoint() { return _state == _synchronized; }
a61af66fc99e Initial load
duke
parents:
diff changeset
143 inline static bool is_synchronizing() { return _state == _synchronizing; }
a61af66fc99e Initial load
duke
parents:
diff changeset
144
a61af66fc99e Initial load
duke
parents:
diff changeset
145 inline static bool do_call_back() {
a61af66fc99e Initial load
duke
parents:
diff changeset
146 return (_state != _not_synchronized);
a61af66fc99e Initial load
duke
parents:
diff changeset
147 }
a61af66fc99e Initial load
duke
parents:
diff changeset
148
a61af66fc99e Initial load
duke
parents:
diff changeset
149 // Called when a thread volantary blocks
a61af66fc99e Initial load
duke
parents:
diff changeset
150 static void block(JavaThread *thread);
a61af66fc99e Initial load
duke
parents:
diff changeset
151 static void signal_thread_at_safepoint() { _waiting_to_block--; }
a61af66fc99e Initial load
duke
parents:
diff changeset
152
a61af66fc99e Initial load
duke
parents:
diff changeset
153 // Exception handling for page polling
a61af66fc99e Initial load
duke
parents:
diff changeset
154 static void handle_polling_page_exception(JavaThread *thread);
a61af66fc99e Initial load
duke
parents:
diff changeset
155
a61af66fc99e Initial load
duke
parents:
diff changeset
156 // VM Thread interface for determining safepoint rate
1291
4b0f2f4918ed 6933402: RFE: Improve PrintSafepointStatistics output to track cleanup time
xlu
parents: 0
diff changeset
157 static long last_non_safepoint_interval() {
4b0f2f4918ed 6933402: RFE: Improve PrintSafepointStatistics output to track cleanup time
xlu
parents: 0
diff changeset
158 return os::javaTimeMillis() - _end_of_last_safepoint;
4b0f2f4918ed 6933402: RFE: Improve PrintSafepointStatistics output to track cleanup time
xlu
parents: 0
diff changeset
159 }
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1727
diff changeset
160 static long end_of_last_safepoint() {
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1727
diff changeset
161 return _end_of_last_safepoint;
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1727
diff changeset
162 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
163 static bool is_cleanup_needed();
a61af66fc99e Initial load
duke
parents:
diff changeset
164 static void do_cleanup_tasks();
a61af66fc99e Initial load
duke
parents:
diff changeset
165
a61af66fc99e Initial load
duke
parents:
diff changeset
166 // debugging
a61af66fc99e Initial load
duke
parents:
diff changeset
167 static void print_state() PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
168 static void safepoint_msg(const char* format, ...) PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
169
a61af66fc99e Initial load
duke
parents:
diff changeset
170 static void deferred_initialize_stat();
a61af66fc99e Initial load
duke
parents:
diff changeset
171 static void print_stat_on_exit();
a61af66fc99e Initial load
duke
parents:
diff changeset
172 inline static void inc_vmop_coalesced_count() { _coalesced_vmop_count++; }
a61af66fc99e Initial load
duke
parents:
diff changeset
173
a61af66fc99e Initial load
duke
parents:
diff changeset
174 static void set_is_at_safepoint() { _state = _synchronized; }
a61af66fc99e Initial load
duke
parents:
diff changeset
175 static void set_is_not_at_safepoint() { _state = _not_synchronized; }
a61af66fc99e Initial load
duke
parents:
diff changeset
176
a61af66fc99e Initial load
duke
parents:
diff changeset
177 // assembly support
a61af66fc99e Initial load
duke
parents:
diff changeset
178 static address address_of_state() { return (address)&_state; }
a61af66fc99e Initial load
duke
parents:
diff changeset
179
a61af66fc99e Initial load
duke
parents:
diff changeset
180 static address safepoint_counter_addr() { return (address)&_safepoint_counter; }
a61af66fc99e Initial load
duke
parents:
diff changeset
181 };
a61af66fc99e Initial load
duke
parents:
diff changeset
182
a61af66fc99e Initial load
duke
parents:
diff changeset
183 // State class for a thread suspended at a safepoint
a61af66fc99e Initial load
duke
parents:
diff changeset
184 class ThreadSafepointState: public CHeapObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
185 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
186 // These states are maintained by VM thread while threads are being brought
a61af66fc99e Initial load
duke
parents:
diff changeset
187 // to a safepoint. After SafepointSynchronize::end(), they are reset to
a61af66fc99e Initial load
duke
parents:
diff changeset
188 // _running.
a61af66fc99e Initial load
duke
parents:
diff changeset
189 enum suspend_type {
a61af66fc99e Initial load
duke
parents:
diff changeset
190 _running = 0, // Thread state not yet determined (i.e., not at a safepoint yet)
a61af66fc99e Initial load
duke
parents:
diff changeset
191 _at_safepoint = 1, // Thread at a safepoint (f.ex., when blocked on a lock)
a61af66fc99e Initial load
duke
parents:
diff changeset
192 _call_back = 2 // Keep executing and wait for callback (if thread is in interpreted or vm)
a61af66fc99e Initial load
duke
parents:
diff changeset
193 };
a61af66fc99e Initial load
duke
parents:
diff changeset
194 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
195 volatile bool _at_poll_safepoint; // At polling page safepoint (NOT a poll return safepoint)
a61af66fc99e Initial load
duke
parents:
diff changeset
196 // Thread has called back the safepoint code (for debugging)
a61af66fc99e Initial load
duke
parents:
diff changeset
197 bool _has_called_back;
a61af66fc99e Initial load
duke
parents:
diff changeset
198
a61af66fc99e Initial load
duke
parents:
diff changeset
199 JavaThread * _thread;
a61af66fc99e Initial load
duke
parents:
diff changeset
200 volatile suspend_type _type;
1727
da877bdc9000 6975006: assert(check.is_deoptimized_frame()) failed: missed deopt
never
parents: 1552
diff changeset
201 JavaThreadState _orig_thread_state;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
202
a61af66fc99e Initial load
duke
parents:
diff changeset
203
a61af66fc99e Initial load
duke
parents:
diff changeset
204 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
205 ThreadSafepointState(JavaThread *thread);
a61af66fc99e Initial load
duke
parents:
diff changeset
206
a61af66fc99e Initial load
duke
parents:
diff changeset
207 // examine/roll-forward/restart
a61af66fc99e Initial load
duke
parents:
diff changeset
208 void examine_state_of_thread();
a61af66fc99e Initial load
duke
parents:
diff changeset
209 void roll_forward(suspend_type type);
a61af66fc99e Initial load
duke
parents:
diff changeset
210 void restart();
a61af66fc99e Initial load
duke
parents:
diff changeset
211
a61af66fc99e Initial load
duke
parents:
diff changeset
212 // Query
a61af66fc99e Initial load
duke
parents:
diff changeset
213 JavaThread* thread() const { return _thread; }
a61af66fc99e Initial load
duke
parents:
diff changeset
214 suspend_type type() const { return _type; }
a61af66fc99e Initial load
duke
parents:
diff changeset
215 bool is_running() const { return (_type==_running); }
1727
da877bdc9000 6975006: assert(check.is_deoptimized_frame()) failed: missed deopt
never
parents: 1552
diff changeset
216 JavaThreadState orig_thread_state() const { return _orig_thread_state; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
217
a61af66fc99e Initial load
duke
parents:
diff changeset
218 // Support for safepoint timeout (debugging)
a61af66fc99e Initial load
duke
parents:
diff changeset
219 bool has_called_back() const { return _has_called_back; }
a61af66fc99e Initial load
duke
parents:
diff changeset
220 void set_has_called_back(bool val) { _has_called_back = val; }
a61af66fc99e Initial load
duke
parents:
diff changeset
221 bool is_at_poll_safepoint() { return _at_poll_safepoint; }
a61af66fc99e Initial load
duke
parents:
diff changeset
222 void set_at_poll_safepoint(bool val) { _at_poll_safepoint = val; }
a61af66fc99e Initial load
duke
parents:
diff changeset
223
a61af66fc99e Initial load
duke
parents:
diff changeset
224 void handle_polling_page_exception();
a61af66fc99e Initial load
duke
parents:
diff changeset
225
a61af66fc99e Initial load
duke
parents:
diff changeset
226 // debugging
a61af66fc99e Initial load
duke
parents:
diff changeset
227 void print_on(outputStream* st) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
228 void print() const { print_on(tty); }
a61af66fc99e Initial load
duke
parents:
diff changeset
229
a61af66fc99e Initial load
duke
parents:
diff changeset
230 // Initialize
a61af66fc99e Initial load
duke
parents:
diff changeset
231 static void create(JavaThread *thread);
a61af66fc99e Initial load
duke
parents:
diff changeset
232 static void destroy(JavaThread *thread);
a61af66fc99e Initial load
duke
parents:
diff changeset
233
a61af66fc99e Initial load
duke
parents:
diff changeset
234 void safepoint_msg(const char* format, ...) {
a61af66fc99e Initial load
duke
parents:
diff changeset
235 if (ShowSafepointMsgs) {
a61af66fc99e Initial load
duke
parents:
diff changeset
236 va_list ap;
a61af66fc99e Initial load
duke
parents:
diff changeset
237 va_start(ap, format);
a61af66fc99e Initial load
duke
parents:
diff changeset
238 tty->vprint_cr(format, ap);
a61af66fc99e Initial load
duke
parents:
diff changeset
239 va_end(ap);
a61af66fc99e Initial load
duke
parents:
diff changeset
240 }
a61af66fc99e Initial load
duke
parents:
diff changeset
241 }
a61af66fc99e Initial load
duke
parents:
diff changeset
242 };
a61af66fc99e Initial load
duke
parents:
diff changeset
243
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1727
diff changeset
244
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
245
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
246 #endif // SHARE_VM_RUNTIME_SAFEPOINT_HPP