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
























  27 
  28 //
  29 // DefNewGeneration functions.
  30 
  31 // Methods of protected closure types.
  32 
  33 DefNewGeneration::IsAliveClosure::IsAliveClosure(Generation* g) : _g(g) {
  34   assert(g->level() == 0, "Optimized for youngest gen.");
  35 }
  36 void DefNewGeneration::IsAliveClosure::do_object(oop p) {
  37   assert(false, "Do not call.");
  38 }
  39 bool DefNewGeneration::IsAliveClosure::do_object_b(oop p) {
  40   return (HeapWord*)p >= _g->reserved().end() || p->is_forwarded();
  41 }
  42 
  43 DefNewGeneration::KeepAliveClosure::
  44 KeepAliveClosure(ScanWeakRefClosure* cl) : _cl(cl) {
  45   GenRemSet* rs = GenCollectedHeap::heap()->rem_set();
  46   assert(rs->rs_kind() == GenRemSet::CardTable, "Wrong rem set kind.");




   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 "gc_implementation/shared/collectorCounters.hpp"
  27 #include "gc_implementation/shared/gcPolicyCounters.hpp"
  28 #include "gc_implementation/shared/spaceDecorator.hpp"
  29 #include "memory/defNewGeneration.inline.hpp"
  30 #include "memory/gcLocker.inline.hpp"
  31 #include "memory/genCollectedHeap.hpp"
  32 #include "memory/genOopClosures.inline.hpp"
  33 #include "memory/generationSpec.hpp"
  34 #include "memory/iterator.hpp"
  35 #include "memory/referencePolicy.hpp"
  36 #include "memory/space.inline.hpp"
  37 #include "oops/instanceRefKlass.hpp"
  38 #include "oops/oop.inline.hpp"
  39 #include "runtime/java.hpp"
  40 #include "utilities/copy.hpp"
  41 #include "utilities/stack.inline.hpp"
  42 #ifdef TARGET_OS_FAMILY_linux
  43 # include "thread_linux.inline.hpp"
  44 #endif
  45 #ifdef TARGET_OS_FAMILY_solaris
  46 # include "thread_solaris.inline.hpp"
  47 #endif
  48 #ifdef TARGET_OS_FAMILY_windows
  49 # include "thread_windows.inline.hpp"
  50 #endif
  51 
  52 //
  53 // DefNewGeneration functions.
  54 
  55 // Methods of protected closure types.
  56 
  57 DefNewGeneration::IsAliveClosure::IsAliveClosure(Generation* g) : _g(g) {
  58   assert(g->level() == 0, "Optimized for youngest gen.");
  59 }
  60 void DefNewGeneration::IsAliveClosure::do_object(oop p) {
  61   assert(false, "Do not call.");
  62 }
  63 bool DefNewGeneration::IsAliveClosure::do_object_b(oop p) {
  64   return (HeapWord*)p >= _g->reserved().end() || p->is_forwarded();
  65 }
  66 
  67 DefNewGeneration::KeepAliveClosure::
  68 KeepAliveClosure(ScanWeakRefClosure* cl) : _cl(cl) {
  69   GenRemSet* rs = GenCollectedHeap::heap()->rem_set();
  70   assert(rs->rs_kind() == GenRemSet::CardTable, "Wrong rem set kind.");