src/share/vm/memory/genMarkSweep.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/_genMarkSweep.cpp.incl"































  27 
  28 void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp,
  29   bool clear_all_softrefs) {
  30   assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint");
  31 
  32   GenCollectedHeap* gch = GenCollectedHeap::heap();
  33 #ifdef ASSERT
  34   if (gch->collector_policy()->should_clear_all_soft_refs()) {
  35     assert(clear_all_softrefs, "Policy should have been checked earlier");
  36   }
  37 #endif
  38 
  39   // hook up weak ref data so it can be used during Mark-Sweep
  40   assert(ref_processor() == NULL, "no stomping");
  41   assert(rp != NULL, "should be non-NULL");
  42   _ref_processor = rp;
  43   rp->setup_policy(clear_all_softrefs);
  44 
  45   TraceTime t1("Full GC", PrintGC && !PrintGCDetails, true, gclog_or_tty);
  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/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_interface/collectedHeap.inline.hpp"
  33 #include "memory/genCollectedHeap.hpp"
  34 #include "memory/genMarkSweep.hpp"
  35 #include "memory/genOopClosures.inline.hpp"
  36 #include "memory/generation.inline.hpp"
  37 #include "memory/modRefBarrierSet.hpp"
  38 #include "memory/referencePolicy.hpp"
  39 #include "memory/space.hpp"
  40 #include "oops/instanceRefKlass.hpp"
  41 #include "oops/oop.inline.hpp"
  42 #include "prims/jvmtiExport.hpp"
  43 #include "runtime/fprofiler.hpp"
  44 #include "runtime/handles.inline.hpp"
  45 #include "runtime/synchronizer.hpp"
  46 #include "runtime/vmThread.hpp"
  47 #include "utilities/copy.hpp"
  48 #include "utilities/events.hpp"
  49 #ifdef TARGET_OS_FAMILY_linux
  50 # include "thread_linux.inline.hpp"
  51 #endif
  52 #ifdef TARGET_OS_FAMILY_solaris
  53 # include "thread_solaris.inline.hpp"
  54 #endif
  55 #ifdef TARGET_OS_FAMILY_windows
  56 # include "thread_windows.inline.hpp"
  57 #endif
  58 
  59 void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp,
  60   bool clear_all_softrefs) {
  61   assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint");
  62 
  63   GenCollectedHeap* gch = GenCollectedHeap::heap();
  64 #ifdef ASSERT
  65   if (gch->collector_policy()->should_clear_all_soft_refs()) {
  66     assert(clear_all_softrefs, "Policy should have been checked earlier");
  67   }
  68 #endif
  69 
  70   // hook up weak ref data so it can be used during Mark-Sweep
  71   assert(ref_processor() == NULL, "no stomping");
  72   assert(rp != NULL, "should be non-NULL");
  73   _ref_processor = rp;
  74   rp->setup_policy(clear_all_softrefs);
  75 
  76   TraceTime t1("Full GC", PrintGC && !PrintGCDetails, true, gclog_or_tty);
  77