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

changeset 5811
d55c004e1d4d
parent 4542
db9981fd3124
child 5860
69944b868a32
     1.1 --- a/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp	Fri Sep 27 13:41:07 2013 +0200
     1.2 +++ b/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp	Tue Sep 24 14:46:29 2013 +0200
     1.3 @@ -89,6 +89,42 @@
     1.4        write_ref_array_pre_work(dst, count);
     1.5      }
     1.6    }
     1.7 +
     1.8 +/*
     1.9 +   Claimed and deferred bits are used together in G1 during the evacuation
    1.10 +   pause. These bits can have the following state transitions:
    1.11 +   1. The claimed bit can be put over any other card state. Except that
    1.12 +      the "dirty -> dirty and claimed" transition is checked for in
    1.13 +      G1 code and is not used.
    1.14 +   2. Deferred bit can be set only if the previous state of the card
    1.15 +      was either clean or claimed. mark_card_deferred() is wait-free.
    1.16 +      We do not care if the operation is be successful because if
    1.17 +      it does not it will only result in duplicate entry in the update
    1.18 +      buffer because of the "cache-miss". So it's not worth spinning.
    1.19 + */
    1.20 +
    1.21 +  bool is_card_claimed(size_t card_index) {
    1.22 +    jbyte val = _byte_map[card_index];
    1.23 +    return (val & (clean_card_mask_val() | claimed_card_val())) == claimed_card_val();
    1.24 +  }
    1.25 +
    1.26 +  void set_card_claimed(size_t card_index) {
    1.27 +      jbyte val = _byte_map[card_index];
    1.28 +      if (val == clean_card_val()) {
    1.29 +        val = (jbyte)claimed_card_val();
    1.30 +      } else {
    1.31 +        val |= (jbyte)claimed_card_val();
    1.32 +      }
    1.33 +      _byte_map[card_index] = val;
    1.34 +  }
    1.35 +
    1.36 +  bool mark_card_deferred(size_t card_index);
    1.37 +
    1.38 +  bool is_card_deferred(size_t card_index) {
    1.39 +    jbyte val = _byte_map[card_index];
    1.40 +    return (val & (clean_card_mask_val() | deferred_card_val())) == deferred_card_val();
    1.41 +  }
    1.42 +
    1.43  };
    1.44  
    1.45  // Adds card-table logging to the post-barrier.

mercurial