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 HRInto_G1RemSet;
  29 class G1RemSet;
  30 class ConcurrentMark;
  31 class DirtyCardToOopClosure;
  32 class CMBitMap;
  33 class CMMarkStack;
  34 class G1ParScanThreadState;
  35 
  36 // A class that scans oops in a given heap region (much as OopsInGenClosure
  37 // scans oops in a generation.)
  38 class OopsInHeapRegionClosure: public OopsInGenClosure {
  39 protected:
  40   HeapRegion* _from;
  41 public:
  42   virtual void set_region(HeapRegion* from) { _from = from; }
  43 };
  44 


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


   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 HRInto_G1RemSet;
  32 class G1RemSet;
  33 class ConcurrentMark;
  34 class DirtyCardToOopClosure;
  35 class CMBitMap;
  36 class CMMarkStack;
  37 class G1ParScanThreadState;
  38 
  39 // A class that scans oops in a given heap region (much as OopsInGenClosure
  40 // scans oops in a generation.)
  41 class OopsInHeapRegionClosure: public OopsInGenClosure {
  42 protected:
  43   HeapRegion* _from;
  44 public:
  45   virtual void set_region(HeapRegion* from) { _from = from; }
  46 };
  47 


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