ysr@777: /* stefank@2314: * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. ysr@777: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ysr@777: * ysr@777: * This code is free software; you can redistribute it and/or modify it ysr@777: * under the terms of the GNU General Public License version 2 only, as ysr@777: * published by the Free Software Foundation. ysr@777: * ysr@777: * This code is distributed in the hope that it will be useful, but WITHOUT ysr@777: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ysr@777: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ysr@777: * version 2 for more details (a copy is included in the LICENSE file that ysr@777: * accompanied this code). ysr@777: * ysr@777: * You should have received a copy of the GNU General Public License version ysr@777: * 2 along with this work; if not, write to the Free Software Foundation, ysr@777: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ysr@777: * trims@1907: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA trims@1907: * or visit www.oracle.com if you need additional information or have any trims@1907: * questions. ysr@777: * ysr@777: */ ysr@777: stefank@2314: #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1MARKSWEEP_HPP stefank@2314: #define SHARE_VM_GC_IMPLEMENTATION_G1_G1MARKSWEEP_HPP stefank@2314: stefank@2314: #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" stefank@2314: #include "gc_implementation/g1/heapRegion.hpp" stefank@2314: #include "memory/genMarkSweep.hpp" stefank@2314: #include "memory/generation.hpp" stefank@2314: #include "memory/universe.hpp" stefank@2314: #include "oops/markOop.hpp" stefank@2314: #include "oops/oop.hpp" stefank@2314: #include "runtime/timer.hpp" stefank@2314: #include "utilities/growableArray.hpp" stefank@2314: ysr@777: class ReferenceProcessor; ysr@777: ysr@777: // G1MarkSweep takes care of global mark-compact garbage collection for a ysr@777: // G1CollectedHeap using a four-phase pointer forwarding algorithm. All ysr@777: // generations are assumed to support marking; those that can also support ysr@777: // compaction. ysr@777: // ysr@777: // Class unloading will only occur when a full gc is invoked. ysr@777: ysr@777: ysr@777: class G1MarkSweep : AllStatic { ysr@777: friend class VM_G1MarkSweep; ysr@777: friend class Scavenge; ysr@777: ysr@777: public: ysr@777: ysr@777: static void invoke_at_safepoint(ReferenceProcessor* rp, ysr@777: bool clear_all_softrefs); ysr@777: ysr@777: private: ysr@777: ysr@777: // Mark live objects ysr@777: static void mark_sweep_phase1(bool& marked_for_deopt, ysr@777: bool clear_all_softrefs); ysr@777: // Calculate new addresses ysr@777: static void mark_sweep_phase2(); ysr@777: // Update pointers ysr@777: static void mark_sweep_phase3(); ysr@777: // Move objects to new positions ysr@777: static void mark_sweep_phase4(); ysr@777: ysr@777: static void allocate_stacks(); ysr@777: }; stefank@2314: stefank@2314: #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1MARKSWEEP_HPP