1 /* 2 * Copyright (c) 2001, 2009, 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 * 23 */ 24 25 // CopyrightVersion 1.2 26 27 # include "incls/_precompiled.incl" 28 # include "incls/_concurrentGCThread.cpp.incl" 29 30 int ConcurrentGCThread::_CGC_flag = CGC_nil; 31 32 SuspendibleThreadSet ConcurrentGCThread::_sts; 33 34 ConcurrentGCThread::ConcurrentGCThread() : 35 _should_terminate(false), _has_terminated(false) { 36 _sts.initialize(); 37 }; 38 39 void ConcurrentGCThread::stopWorldAndDo(VoidClosure* op) { 40 MutexLockerEx x(Heap_lock, 41 Mutex::_no_safepoint_check_flag); 42 // warning("CGC: about to try stopping world"); 43 SafepointSynchronize::begin(); 44 // warning("CGC: successfully stopped world"); 45 op->do_void(); 46 SafepointSynchronize::end(); 47 // warning("CGC: successfully restarted world"); 48 } | 1 /* 2 * Copyright (c) 2001, 2010, 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 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "classfile/systemDictionary.hpp" 27 #include "gc_implementation/shared/concurrentGCThread.hpp" 28 #include "oops/instanceRefKlass.hpp" 29 #include "oops/oop.inline.hpp" 30 #include "runtime/init.hpp" 31 #include "runtime/interfaceSupport.hpp" 32 #include "runtime/java.hpp" 33 #include "runtime/javaCalls.hpp" 34 35 // CopyrightVersion 1.2 36 37 int ConcurrentGCThread::_CGC_flag = CGC_nil; 38 39 SuspendibleThreadSet ConcurrentGCThread::_sts; 40 41 ConcurrentGCThread::ConcurrentGCThread() : 42 _should_terminate(false), _has_terminated(false) { 43 _sts.initialize(); 44 }; 45 46 void ConcurrentGCThread::stopWorldAndDo(VoidClosure* op) { 47 MutexLockerEx x(Heap_lock, 48 Mutex::_no_safepoint_check_flag); 49 // warning("CGC: about to try stopping world"); 50 SafepointSynchronize::begin(); 51 // warning("CGC: successfully stopped world"); 52 op->do_void(); 53 SafepointSynchronize::end(); 54 // warning("CGC: successfully restarted world"); 55 } |