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 * 23 */ 24 25 // 26 // Safepoint synchronization 27 //// 28 // The VMThread or CMS_thread uses the SafepointSynchronize::begin/end 29 // methods to enter/exit a safepoint region. The begin method will roll 30 // all JavaThreads forward to a safepoint. 31 // 32 // JavaThreads must use the ThreadSafepointState abstraction (defined in 33 // thread.hpp) to indicate that that they are at a safepoint. 34 // 35 // The Mutex/Condition variable and ObjectLocker classes calls the enter/ 36 // exit safepoint methods, when a thread is blocked/restarted. Hence, all mutex exter/ 37 // exit points *must* be at a safepoint. 38 39 40 class ThreadSafepointState; 41 class SnippetCache; 42 class nmethod; 43 44 // 215 216 // debugging 217 void print_on(outputStream* st) const; 218 void print() const { print_on(tty); } 219 220 // Initialize 221 static void create(JavaThread *thread); 222 static void destroy(JavaThread *thread); 223 224 void safepoint_msg(const char* format, ...) { 225 if (ShowSafepointMsgs) { 226 va_list ap; 227 va_start(ap, format); 228 tty->vprint_cr(format, ap); 229 va_end(ap); 230 } 231 } 232 }; 233 234 | 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 * 23 */ 24 25 #ifndef SHARE_VM_RUNTIME_SAFEPOINT_HPP 26 #define SHARE_VM_RUNTIME_SAFEPOINT_HPP 27 28 #include "asm/assembler.hpp" 29 #include "code/nmethod.hpp" 30 #include "memory/allocation.hpp" 31 #include "runtime/extendedPC.hpp" 32 #include "runtime/os.hpp" 33 #include "utilities/ostream.hpp" 34 35 // 36 // Safepoint synchronization 37 //// 38 // The VMThread or CMS_thread uses the SafepointSynchronize::begin/end 39 // methods to enter/exit a safepoint region. The begin method will roll 40 // all JavaThreads forward to a safepoint. 41 // 42 // JavaThreads must use the ThreadSafepointState abstraction (defined in 43 // thread.hpp) to indicate that that they are at a safepoint. 44 // 45 // The Mutex/Condition variable and ObjectLocker classes calls the enter/ 46 // exit safepoint methods, when a thread is blocked/restarted. Hence, all mutex exter/ 47 // exit points *must* be at a safepoint. 48 49 50 class ThreadSafepointState; 51 class SnippetCache; 52 class nmethod; 53 54 // 225 226 // debugging 227 void print_on(outputStream* st) const; 228 void print() const { print_on(tty); } 229 230 // Initialize 231 static void create(JavaThread *thread); 232 static void destroy(JavaThread *thread); 233 234 void safepoint_msg(const char* format, ...) { 235 if (ShowSafepointMsgs) { 236 va_list ap; 237 va_start(ap, format); 238 tty->vprint_cr(format, ap); 239 va_end(ap); 240 } 241 } 242 }; 243 244 245 246 #endif // SHARE_VM_RUNTIME_SAFEPOINT_HPP |