src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp

Print this page
rev 2755 : 7097516: G1: assert(0<= from_card && from_card<HeapRegion::CardsPerRegion) failed: Must be in range.
Summary: Introduced a version of is_in_reserved() that looks at _orig_end as opposed to _end.
Reviewed-by: duke


 126 #if PRT_COUNT_OCCUPIED
 127         _occupied++;
 128 #endif
 129       }
 130     }
 131   }
 132 
 133   void add_reference_work(OopOrNarrowOopStar from, bool par) {
 134     // Must make this robust in case "from" is not in "_hr", because of
 135     // concurrency.
 136 
 137 #if HRRS_VERBOSE
 138     gclog_or_tty->print_cr("    PRT::Add_reference_work(" PTR_FORMAT "->" PTR_FORMAT").",
 139                            from, *from);
 140 #endif
 141 
 142     HeapRegion* loc_hr = hr();
 143     // If the test below fails, then this table was reused concurrently
 144     // with this operation.  This is OK, since the old table was coarsened,
 145     // and adding a bit to the new table is never incorrect.
 146     if (loc_hr->is_in_reserved(from)) {
 147       size_t hw_offset = pointer_delta((HeapWord*)from, loc_hr->bottom());
 148       CardIdx_t from_card = (CardIdx_t)
 149           hw_offset >> (CardTableModRefBS::card_shift - LogHeapWordSize);
 150 
 151       assert(0 <= from_card && (size_t)from_card < HeapRegion::CardsPerRegion,
 152              "Must be in range.");
 153       add_card_work(from_card, par);
 154     }
 155   }
 156 
 157 public:
 158 
 159   HeapRegion* hr() const { return _hr; }
 160 
 161 #if PRT_COUNT_OCCUPIED
 162   jint occupied() const {
 163     // Overkill, but if we ever need it...
 164     // guarantee(_occupied == _bm.count_one_bits(), "Check");
 165     return _occupied;
 166   }




 126 #if PRT_COUNT_OCCUPIED
 127         _occupied++;
 128 #endif
 129       }
 130     }
 131   }
 132 
 133   void add_reference_work(OopOrNarrowOopStar from, bool par) {
 134     // Must make this robust in case "from" is not in "_hr", because of
 135     // concurrency.
 136 
 137 #if HRRS_VERBOSE
 138     gclog_or_tty->print_cr("    PRT::Add_reference_work(" PTR_FORMAT "->" PTR_FORMAT").",
 139                            from, *from);
 140 #endif
 141 
 142     HeapRegion* loc_hr = hr();
 143     // If the test below fails, then this table was reused concurrently
 144     // with this operation.  This is OK, since the old table was coarsened,
 145     // and adding a bit to the new table is never incorrect.
 146     if (loc_hr->is_in_reserved_raw(from)) {
 147       size_t hw_offset = pointer_delta((HeapWord*)from, loc_hr->bottom());
 148       CardIdx_t from_card = (CardIdx_t)
 149           hw_offset >> (CardTableModRefBS::card_shift - LogHeapWordSize);
 150 
 151       assert(0 <= from_card && (size_t)from_card < HeapRegion::CardsPerRegion,
 152              "Must be in range.");
 153       add_card_work(from_card, par);
 154     }
 155   }
 156 
 157 public:
 158 
 159   HeapRegion* hr() const { return _hr; }
 160 
 161 #if PRT_COUNT_OCCUPIED
 162   jint occupied() const {
 163     // Overkill, but if we ever need it...
 164     // guarantee(_occupied == _bm.count_one_bits(), "Check");
 165     return _occupied;
 166   }