src/share/vm/gc_implementation/g1/g1OopClosures.hpp

Print this page


   1 /*
   2  * Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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 class HeapRegion;
  26 class G1CollectedHeap;
  27 class G1RemSet;
  28 class ConcurrentMark;
  29 class DirtyCardToOopClosure;
  30 class CMBitMap;
  31 class CMMarkStack;
  32 class G1ParScanThreadState;
  33 
  34 // A class that scans oops in a given heap region (much as OopsInGenClosure
  35 // scans oops in a generation.)
  36 class OopsInHeapRegionClosure: public OopsInGenClosure {
  37 protected:
  38   HeapRegion* _from;
  39 public:
  40   virtual void set_region(HeapRegion* from) { _from = from; }
  41 };
  42 
  43 class G1ParClosureSuper : public OopsInHeapRegionClosure {
  44 protected:


 193   bool do_header() { return false; }
 194   void set_region(HeapRegion* from) {
 195     _oc->set_region(from);
 196   }
 197 };
 198 
 199 class FilterOutOfRegionClosure: public OopClosure {
 200   HeapWord* _r_bottom;
 201   HeapWord* _r_end;
 202   OopClosure* _oc;
 203   int _out_of_region;
 204 public:
 205   FilterOutOfRegionClosure(HeapRegion* r, OopClosure* oc);
 206   template <class T> void do_oop_nv(T* p);
 207   virtual void do_oop(oop* p) { do_oop_nv(p); }
 208   virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
 209   bool apply_to_weak_ref_discovered_field() { return true; }
 210   bool do_header() { return false; }
 211   int out_of_region() { return _out_of_region; }
 212 };


   1 /*
   2  * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1OOPCLOSURES_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1OOPCLOSURES_HPP
  27 
  28 class HeapRegion;
  29 class G1CollectedHeap;
  30 class G1RemSet;
  31 class ConcurrentMark;
  32 class DirtyCardToOopClosure;
  33 class CMBitMap;
  34 class CMMarkStack;
  35 class G1ParScanThreadState;
  36 
  37 // A class that scans oops in a given heap region (much as OopsInGenClosure
  38 // scans oops in a generation.)
  39 class OopsInHeapRegionClosure: public OopsInGenClosure {
  40 protected:
  41   HeapRegion* _from;
  42 public:
  43   virtual void set_region(HeapRegion* from) { _from = from; }
  44 };
  45 
  46 class G1ParClosureSuper : public OopsInHeapRegionClosure {
  47 protected:


 196   bool do_header() { return false; }
 197   void set_region(HeapRegion* from) {
 198     _oc->set_region(from);
 199   }
 200 };
 201 
 202 class FilterOutOfRegionClosure: public OopClosure {
 203   HeapWord* _r_bottom;
 204   HeapWord* _r_end;
 205   OopClosure* _oc;
 206   int _out_of_region;
 207 public:
 208   FilterOutOfRegionClosure(HeapRegion* r, OopClosure* oc);
 209   template <class T> void do_oop_nv(T* p);
 210   virtual void do_oop(oop* p) { do_oop_nv(p); }
 211   virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
 212   bool apply_to_weak_ref_discovered_field() { return true; }
 213   bool do_header() { return false; }
 214   int out_of_region() { return _out_of_region; }
 215 };
 216 
 217 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1OOPCLOSURES_HPP