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 "incls/_precompiled.incl" 26 #include "incls/_g1MarkSweep.cpp.incl" 27 28 class HeapRegion; 29 30 void G1MarkSweep::invoke_at_safepoint(ReferenceProcessor* rp, 31 bool clear_all_softrefs) { 32 assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint"); 33 34 SharedHeap* sh = SharedHeap::heap(); 35 #ifdef ASSERT 36 if (sh->collector_policy()->should_clear_all_soft_refs()) { 37 assert(clear_all_softrefs, "Policy should have been checked earler"); 38 } 39 #endif 40 // hook up weak ref data so it can be used during Mark-Sweep 41 assert(GenMarkSweep::ref_processor() == NULL, "no stomping"); 42 assert(rp != NULL, "should be non-NULL"); 43 GenMarkSweep::_ref_processor = rp; 44 rp->setup_policy(clear_all_softrefs); 45 46 // When collecting the permanent generation methodOops may be moving, | 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/javaClasses.hpp" 27 #include "classfile/symbolTable.hpp" 28 #include "classfile/systemDictionary.hpp" 29 #include "classfile/vmSymbols.hpp" 30 #include "code/codeCache.hpp" 31 #include "code/icBuffer.hpp" 32 #include "gc_implementation/g1/g1MarkSweep.hpp" 33 #include "memory/gcLocker.hpp" 34 #include "memory/genCollectedHeap.hpp" 35 #include "memory/modRefBarrierSet.hpp" 36 #include "memory/referencePolicy.hpp" 37 #include "memory/space.hpp" 38 #include "oops/instanceRefKlass.hpp" 39 #include "oops/oop.inline.hpp" 40 #include "prims/jvmtiExport.hpp" 41 #include "runtime/aprofiler.hpp" 42 #include "runtime/biasedLocking.hpp" 43 #include "runtime/fprofiler.hpp" 44 #include "runtime/synchronizer.hpp" 45 #include "runtime/thread.hpp" 46 #include "runtime/vmThread.hpp" 47 #include "utilities/copy.hpp" 48 #include "utilities/events.hpp" 49 50 class HeapRegion; 51 52 void G1MarkSweep::invoke_at_safepoint(ReferenceProcessor* rp, 53 bool clear_all_softrefs) { 54 assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint"); 55 56 SharedHeap* sh = SharedHeap::heap(); 57 #ifdef ASSERT 58 if (sh->collector_policy()->should_clear_all_soft_refs()) { 59 assert(clear_all_softrefs, "Policy should have been checked earler"); 60 } 61 #endif 62 // hook up weak ref data so it can be used during Mark-Sweep 63 assert(GenMarkSweep::ref_processor() == NULL, "no stomping"); 64 assert(rp != NULL, "should be non-NULL"); 65 GenMarkSweep::_ref_processor = rp; 66 rp->setup_policy(clear_all_softrefs); 67 68 // When collecting the permanent generation methodOops may be moving, |