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

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 // A G1RemSet provides ways of iterating over pointers into a selected
  26 // collection set.
  27 
  28 class G1CollectedHeap;
  29 class CardTableModRefBarrierSet;
  30 class ConcurrentG1Refine;
  31 
  32 // A G1RemSet in which each heap region has a rem set that records the
  33 // external heap references into it.  Uses a mod ref bs to track updates,
  34 // so that they can be used to update the individual region remsets.
  35 
  36 class G1RemSet: public CHeapObj {
  37 protected:
  38   G1CollectedHeap* _g1;
  39   unsigned _conc_refine_cards;
  40   size_t n_workers();
  41 
  42 protected:
  43   enum SomePrivateConstants {
  44     UpdateRStoMergeSync  = 0,


 198   virtual void do_oop(narrowOop* p) { do_oop_work(p); }
 199   virtual void do_oop(oop* p)       { do_oop_work(p); }
 200 
 201   // Override: this closure is idempotent.
 202   //  bool idempotent() { return true; }
 203   bool apply_to_weak_ref_discovered_field() { return true; }
 204 };
 205 
 206 class UpdateRSetImmediate: public OopsInHeapRegionClosure {
 207 private:
 208   G1RemSet* _g1_rem_set;
 209 
 210   template <class T> void do_oop_work(T* p);
 211 public:
 212   UpdateRSetImmediate(G1RemSet* rs) :
 213     _g1_rem_set(rs) {}
 214 
 215   virtual void do_oop(narrowOop* p) { do_oop_work(p); }
 216   virtual void do_oop(      oop* p) { do_oop_work(p); }
 217 };




   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_G1REMSET_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1REMSET_HPP
  27 
  28 // A G1RemSet provides ways of iterating over pointers into a selected
  29 // collection set.
  30 
  31 class G1CollectedHeap;
  32 class CardTableModRefBarrierSet;
  33 class ConcurrentG1Refine;
  34 
  35 // A G1RemSet in which each heap region has a rem set that records the
  36 // external heap references into it.  Uses a mod ref bs to track updates,
  37 // so that they can be used to update the individual region remsets.
  38 
  39 class G1RemSet: public CHeapObj {
  40 protected:
  41   G1CollectedHeap* _g1;
  42   unsigned _conc_refine_cards;
  43   size_t n_workers();
  44 
  45 protected:
  46   enum SomePrivateConstants {
  47     UpdateRStoMergeSync  = 0,


 201   virtual void do_oop(narrowOop* p) { do_oop_work(p); }
 202   virtual void do_oop(oop* p)       { do_oop_work(p); }
 203 
 204   // Override: this closure is idempotent.
 205   //  bool idempotent() { return true; }
 206   bool apply_to_weak_ref_discovered_field() { return true; }
 207 };
 208 
 209 class UpdateRSetImmediate: public OopsInHeapRegionClosure {
 210 private:
 211   G1RemSet* _g1_rem_set;
 212 
 213   template <class T> void do_oop_work(T* p);
 214 public:
 215   UpdateRSetImmediate(G1RemSet* rs) :
 216     _g1_rem_set(rs) {}
 217 
 218   virtual void do_oop(narrowOop* p) { do_oop_work(p); }
 219   virtual void do_oop(      oop* p) { do_oop_work(p); }
 220 };
 221 
 222 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1REMSET_HPP