1 /*
2 * Copyright (c) 1997, 2014, 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 *
128
129 // For debug long safepoint
130 static void print_safepoint_timeout(SafepointTimeoutReason timeout_reason);
131
132 public:
133
134 // Main entry points
135
136 // Roll all threads forward to safepoint. Must be called by the
137 // VMThread or CMS_thread.
138 static void begin();
139 static void end(); // Start all suspended threads again...
140
141 static bool safepoint_safe(JavaThread *thread, JavaThreadState state);
142
143 static void check_for_lazy_critical_native(JavaThread *thread, JavaThreadState state);
144
145 // Query
146 inline static bool is_at_safepoint() { return _state == _synchronized; }
147 inline static bool is_synchronizing() { return _state == _synchronizing; }
148
149 inline static bool do_call_back() {
150 return (_state != _not_synchronized);
151 }
152
153 inline static void increment_jni_active_count() {
154 assert_locked_or_safepoint(Safepoint_lock);
155 _current_jni_active_count++;
156 }
157
158 // Called when a thread volantary blocks
159 static void block(JavaThread *thread);
160 static void signal_thread_at_safepoint() { _waiting_to_block--; }
161
162 // Exception handling for page polling
163 static void handle_polling_page_exception(JavaThread *thread);
164
165 // VM Thread interface for determining safepoint rate
166 static long last_non_safepoint_interval() {
167 return os::javaTimeMillis() - _end_of_last_safepoint;
|
1 /*
2 * Copyright (c) 1997, 2019, 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 *
128
129 // For debug long safepoint
130 static void print_safepoint_timeout(SafepointTimeoutReason timeout_reason);
131
132 public:
133
134 // Main entry points
135
136 // Roll all threads forward to safepoint. Must be called by the
137 // VMThread or CMS_thread.
138 static void begin();
139 static void end(); // Start all suspended threads again...
140
141 static bool safepoint_safe(JavaThread *thread, JavaThreadState state);
142
143 static void check_for_lazy_critical_native(JavaThread *thread, JavaThreadState state);
144
145 // Query
146 inline static bool is_at_safepoint() { return _state == _synchronized; }
147 inline static bool is_synchronizing() { return _state == _synchronizing; }
148 inline static int safepoint_counter() { return _safepoint_counter; }
149
150 inline static bool do_call_back() {
151 return (_state != _not_synchronized);
152 }
153
154 inline static void increment_jni_active_count() {
155 assert_locked_or_safepoint(Safepoint_lock);
156 _current_jni_active_count++;
157 }
158
159 // Called when a thread volantary blocks
160 static void block(JavaThread *thread);
161 static void signal_thread_at_safepoint() { _waiting_to_block--; }
162
163 // Exception handling for page polling
164 static void handle_polling_page_exception(JavaThread *thread);
165
166 // VM Thread interface for determining safepoint rate
167 static long last_non_safepoint_interval() {
168 return os::javaTimeMillis() - _end_of_last_safepoint;
|