< prev index next >

src/share/vm/gc/g1/g1SATBCardTableModRefBS.hpp

Print this page




  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_G1_G1SATBCARDTABLEMODREFBS_HPP
  26 #define SHARE_VM_GC_G1_G1SATBCARDTABLEMODREFBS_HPP
  27 
  28 #include "gc/g1/g1RegionToSpaceMapper.hpp"
  29 #include "gc/shared/cardTableModRefBS.hpp"
  30 #include "memory/memRegion.hpp"
  31 #include "oops/oop.hpp"
  32 #include "utilities/macros.hpp"
  33 
  34 class DirtyCardQueueSet;
  35 class G1SATBCardTableLoggingModRefBS;
  36 
  37 // This barrier is specialized to use a logging barrier to support
  38 // snapshot-at-the-beginning marking.
  39 
  40 class G1SATBCardTableModRefBS: public CardTableModRefBS {

  41 protected:
  42   enum G1CardValues {
  43     g1_young_gen = CT_MR_BS_last_reserved << 1
  44   };
  45 
  46   G1SATBCardTableModRefBS(MemRegion whole_heap, const BarrierSet::FakeRtti& fake_rtti);
  47   ~G1SATBCardTableModRefBS() { }
  48 
  49 public:
  50   static int g1_young_card_val()   { return g1_young_gen; }
  51 
  52   // Add "pre_val" to a set of objects that may have been disconnected from the
  53   // pre-marking object graph.
  54   static void enqueue(oop pre_val);
  55 
  56   virtual bool has_write_ref_pre_barrier() { return true; }
  57 
  58   // This notes that we don't need to access any BarrierSet data
  59   // structures, so this can be called from a static context.
  60   template <class T> static void write_ref_field_pre_static(T* field, oop newVal) {


 105 
 106   void set_card_claimed(size_t card_index) {
 107       jbyte val = _byte_map[card_index];
 108       if (val == clean_card_val()) {
 109         val = (jbyte)claimed_card_val();
 110       } else {
 111         val |= (jbyte)claimed_card_val();
 112       }
 113       _byte_map[card_index] = val;
 114   }
 115 
 116   void verify_g1_young_region(MemRegion mr) PRODUCT_RETURN;
 117   void g1_mark_as_young(const MemRegion& mr);
 118 
 119   bool mark_card_deferred(size_t card_index);
 120 
 121   bool is_card_deferred(size_t card_index) {
 122     jbyte val = _byte_map[card_index];
 123     return (val & (clean_card_mask_val() | deferred_card_val())) == deferred_card_val();
 124   }



 125 };
 126 
 127 template<>
 128 struct BarrierSet::GetName<G1SATBCardTableModRefBS> {
 129   static const BarrierSet::Name value = BarrierSet::G1SATBCT;
 130 };
 131 
 132 class G1SATBCardTableLoggingModRefBSChangedListener : public G1MappingChangedListener {
 133  private:
 134   G1SATBCardTableLoggingModRefBS* _card_table;
 135  public:
 136   G1SATBCardTableLoggingModRefBSChangedListener() : _card_table(NULL) { }
 137 
 138   void set_card_table(G1SATBCardTableLoggingModRefBS* card_table) { _card_table = card_table; }
 139 
 140   virtual void on_commit(uint start_idx, size_t num_regions, bool zero_filled);
 141 };
 142 
 143 // Adds card-table logging to the post-barrier.
 144 // Usual invariant: all dirty cards are logged in the DirtyCardQueueSet.




  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_G1_G1SATBCARDTABLEMODREFBS_HPP
  26 #define SHARE_VM_GC_G1_G1SATBCARDTABLEMODREFBS_HPP
  27 
  28 #include "gc/g1/g1RegionToSpaceMapper.hpp"
  29 #include "gc/shared/cardTableModRefBS.hpp"
  30 #include "memory/memRegion.hpp"
  31 #include "oops/oop.hpp"
  32 #include "utilities/macros.hpp"
  33 
  34 class DirtyCardQueueSet;
  35 class G1SATBCardTableLoggingModRefBS;
  36 
  37 // This barrier is specialized to use a logging barrier to support
  38 // snapshot-at-the-beginning marking.
  39 
  40 class G1SATBCardTableModRefBS: public CardTableModRefBS {
  41   friend class VMStructs;
  42 protected:
  43   enum G1CardValues {
  44     g1_young_gen = CT_MR_BS_last_reserved << 1
  45   };
  46 
  47   G1SATBCardTableModRefBS(MemRegion whole_heap, const BarrierSet::FakeRtti& fake_rtti);
  48   ~G1SATBCardTableModRefBS() { }
  49 
  50 public:
  51   static int g1_young_card_val()   { return g1_young_gen; }
  52 
  53   // Add "pre_val" to a set of objects that may have been disconnected from the
  54   // pre-marking object graph.
  55   static void enqueue(oop pre_val);
  56 
  57   virtual bool has_write_ref_pre_barrier() { return true; }
  58 
  59   // This notes that we don't need to access any BarrierSet data
  60   // structures, so this can be called from a static context.
  61   template <class T> static void write_ref_field_pre_static(T* field, oop newVal) {


 106 
 107   void set_card_claimed(size_t card_index) {
 108       jbyte val = _byte_map[card_index];
 109       if (val == clean_card_val()) {
 110         val = (jbyte)claimed_card_val();
 111       } else {
 112         val |= (jbyte)claimed_card_val();
 113       }
 114       _byte_map[card_index] = val;
 115   }
 116 
 117   void verify_g1_young_region(MemRegion mr) PRODUCT_RETURN;
 118   void g1_mark_as_young(const MemRegion& mr);
 119 
 120   bool mark_card_deferred(size_t card_index);
 121 
 122   bool is_card_deferred(size_t card_index) {
 123     jbyte val = _byte_map[card_index];
 124     return (val & (clean_card_mask_val() | deferred_card_val())) == deferred_card_val();
 125   }
 126   virtual void write_ref_nmethod_pre(oop* dst, nmethod* nm);
 127   virtual void write_ref_nmethod_post(oop* dst, nmethod* nm);
 128 
 129 };
 130 
 131 template<>
 132 struct BarrierSet::GetName<G1SATBCardTableModRefBS> {
 133   static const BarrierSet::Name value = BarrierSet::G1SATBCT;
 134 };
 135 
 136 class G1SATBCardTableLoggingModRefBSChangedListener : public G1MappingChangedListener {
 137  private:
 138   G1SATBCardTableLoggingModRefBS* _card_table;
 139  public:
 140   G1SATBCardTableLoggingModRefBSChangedListener() : _card_table(NULL) { }
 141 
 142   void set_card_table(G1SATBCardTableLoggingModRefBS* card_table) { _card_table = card_table; }
 143 
 144   virtual void on_commit(uint start_idx, size_t num_regions, bool zero_filled);
 145 };
 146 
 147 // Adds card-table logging to the post-barrier.
 148 // Usual invariant: all dirty cards are logged in the DirtyCardQueueSet.


< prev index next >