src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp

Print this page




   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/_psMarkSweep.cpp.incl"


























  27 
  28 elapsedTimer        PSMarkSweep::_accumulated_time;
  29 unsigned int        PSMarkSweep::_total_invocations = 0;
  30 jlong               PSMarkSweep::_time_of_last_gc   = 0;
  31 CollectorCounters*  PSMarkSweep::_counters = NULL;
  32 
  33 void PSMarkSweep::initialize() {
  34   MemRegion mr = Universe::heap()->reserved_region();
  35   _ref_processor = new ReferenceProcessor(mr,
  36                                           true,    // atomic_discovery
  37                                           false);  // mt_discovery
  38   _counters = new CollectorCounters("PSMarkSweep", 1);
  39 }
  40 
  41 // This method contains all heap specific policy for invoking mark sweep.
  42 // PSMarkSweep::invoke_no_policy() will only attempt to mark-sweep-compact
  43 // the heap. It will do nothing further. If we need to bail out for policy
  44 // reasons, scavenge before full gc, or any other specialized behavior, it
  45 // needs to be added here.
  46 //




   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/symbolTable.hpp"
  27 #include "classfile/systemDictionary.hpp"
  28 #include "code/codeCache.hpp"
  29 #include "gc_implementation/parallelScavenge/generationSizer.hpp"
  30 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
  31 #include "gc_implementation/parallelScavenge/psAdaptiveSizePolicy.hpp"
  32 #include "gc_implementation/parallelScavenge/psMarkSweep.hpp"
  33 #include "gc_implementation/parallelScavenge/psMarkSweepDecorator.hpp"
  34 #include "gc_implementation/parallelScavenge/psOldGen.hpp"
  35 #include "gc_implementation/parallelScavenge/psPermGen.hpp"
  36 #include "gc_implementation/parallelScavenge/psScavenge.hpp"
  37 #include "gc_implementation/parallelScavenge/psYoungGen.hpp"
  38 #include "gc_implementation/shared/isGCActiveMark.hpp"
  39 #include "gc_implementation/shared/spaceDecorator.hpp"
  40 #include "gc_interface/gcCause.hpp"
  41 #include "memory/gcLocker.inline.hpp"
  42 #include "memory/referencePolicy.hpp"
  43 #include "memory/referenceProcessor.hpp"
  44 #include "oops/oop.inline.hpp"
  45 #include "runtime/biasedLocking.hpp"
  46 #include "runtime/fprofiler.hpp"
  47 #include "runtime/safepoint.hpp"
  48 #include "runtime/vmThread.hpp"
  49 #include "services/management.hpp"
  50 #include "services/memoryService.hpp"
  51 #include "utilities/events.hpp"
  52 #include "utilities/stack.inline.hpp"
  53 
  54 elapsedTimer        PSMarkSweep::_accumulated_time;
  55 unsigned int        PSMarkSweep::_total_invocations = 0;
  56 jlong               PSMarkSweep::_time_of_last_gc   = 0;
  57 CollectorCounters*  PSMarkSweep::_counters = NULL;
  58 
  59 void PSMarkSweep::initialize() {
  60   MemRegion mr = Universe::heap()->reserved_region();
  61   _ref_processor = new ReferenceProcessor(mr,
  62                                           true,    // atomic_discovery
  63                                           false);  // mt_discovery
  64   _counters = new CollectorCounters("PSMarkSweep", 1);
  65 }
  66 
  67 // This method contains all heap specific policy for invoking mark sweep.
  68 // PSMarkSweep::invoke_no_policy() will only attempt to mark-sweep-compact
  69 // the heap. It will do nothing further. If we need to bail out for policy
  70 // reasons, scavenge before full gc, or any other specialized behavior, it
  71 // needs to be added here.
  72 //