src/share/vm/memory/cardTableRS.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hs-gc-g1-mmap Sdiff src/share/vm/memory

src/share/vm/memory/cardTableRS.cpp

Print this page




 304     if (!urasm.equals(urasm2)) {
 305       warning("CMS+ParNew: Flickering used_region_at_save_marks()!!");
 306     }
 307     ShouldNotReachHere();
 308   }
 309 #endif
 310   _ct_bs->non_clean_card_iterate_possibly_parallel(sp, urasm, cl, this);
 311 }
 312 
 313 void CardTableRS::clear_into_younger(Generation* gen) {
 314   GenCollectedHeap* gch = GenCollectedHeap::heap();
 315   // Generations younger than gen have been evacuated. We can clear
 316   // card table entries for gen (we know that it has no pointers
 317   // to younger gens) and for those below. The card tables for
 318   // the youngest gen need never be cleared.
 319   // There's a bit of subtlety in the clear() and invalidate()
 320   // methods that we exploit here and in invalidate_or_clear()
 321   // below to avoid missing cards at the fringes. If clear() or
 322   // invalidate() are changed in the future, this code should
 323   // be revisited. 20040107.ysr
 324   Generation* g = gen;
 325   for(Generation* prev_gen = gch->prev_gen(g);
 326       prev_gen != NULL;
 327       g = prev_gen, prev_gen = gch->prev_gen(g)) {
 328     MemRegion to_be_cleared_mr = g->prev_used_region();
 329     clear(to_be_cleared_mr);
 330   }
 331 }
 332 
 333 void CardTableRS::invalidate_or_clear(Generation* gen, bool younger) {
 334   GenCollectedHeap* gch = GenCollectedHeap::heap();
 335   // For each generation gen (and younger)
 336   // invalidate the cards for the currently occupied part
 337   // of that generation and clear the cards for the
 338   // unoccupied part of the generation (if any, making use
 339   // of that generation's prev_used_region to determine that
 340   // region). No need to do anything for the youngest
 341   // generation. Also see note#20040107.ysr above.
 342   Generation* g = gen;
 343   for(Generation* prev_gen = gch->prev_gen(g); prev_gen != NULL;
 344       g = prev_gen, prev_gen = gch->prev_gen(g))  {
 345     MemRegion used_mr = g->used_region();
 346     MemRegion to_be_cleared_mr = g->prev_used_region().minus(used_mr);
 347     if (!to_be_cleared_mr.is_empty()) {
 348       clear(to_be_cleared_mr);
 349     }
 350     invalidate(used_mr);
 351     if (!younger) break;
 352   }
 353 }
 354 
 355 
 356 class VerifyCleanCardClosure: public OopClosure {
 357 private:
 358   HeapWord* _boundary;
 359   HeapWord* _begin;
 360   HeapWord* _end;
 361 protected:
 362   template <class T> void do_oop_work(T* p) {
 363     HeapWord* jp = (HeapWord*)p;
 364     assert(jp >= _begin && jp < _end,
 365            err_msg("Error: jp " PTR_FORMAT " should be within "
 366                    "[_begin, _end) = [" PTR_FORMAT "," PTR_FORMAT ")",
 367                    jp, _begin, _end));
 368     oop obj = oopDesc::load_decode_heap_oop(p);
 369     guarantee(obj == NULL || (HeapWord*)obj >= _boundary,
 370               err_msg("pointer " PTR_FORMAT " at " PTR_FORMAT " on "
 371                       "clean card crosses boundary" PTR_FORMAT,
 372                       (HeapWord*)obj, jp, _boundary));




 304     if (!urasm.equals(urasm2)) {
 305       warning("CMS+ParNew: Flickering used_region_at_save_marks()!!");
 306     }
 307     ShouldNotReachHere();
 308   }
 309 #endif
 310   _ct_bs->non_clean_card_iterate_possibly_parallel(sp, urasm, cl, this);
 311 }
 312 
 313 void CardTableRS::clear_into_younger(Generation* gen) {
 314   GenCollectedHeap* gch = GenCollectedHeap::heap();
 315   // Generations younger than gen have been evacuated. We can clear
 316   // card table entries for gen (we know that it has no pointers
 317   // to younger gens) and for those below. The card tables for
 318   // the youngest gen need never be cleared.
 319   // There's a bit of subtlety in the clear() and invalidate()
 320   // methods that we exploit here and in invalidate_or_clear()
 321   // below to avoid missing cards at the fringes. If clear() or
 322   // invalidate() are changed in the future, this code should
 323   // be revisited. 20040107.ysr
 324   Generation* old_gen = gen;
 325   clear(old_gen->prev_used_region());
 326   Generation* young_gen = gch->prev_gen(old_gen);
 327   clear(young_gen->prev_used_region());



 328 }
 329 
 330 void CardTableRS::invalidate_or_clear(Generation* gen) {
 331   // For generation gen invalidate the cards for the currently
 332   // occupied part of that generation and clear the cards for the


 333   // unoccupied part of the generation (if any, making use
 334   // of that generation's prev_used_region to determine that
 335   // region). No need to do anything for the youngest
 336   // generation. Also see note#20040107.ysr above.
 337   MemRegion used_mr = gen->used_region();
 338   MemRegion to_be_cleared_mr = gen->prev_used_region().minus(used_mr);



 339   if (!to_be_cleared_mr.is_empty()) {
 340     clear(to_be_cleared_mr);
 341   }
 342   invalidate(used_mr);


 343 }
 344 
 345 
 346 class VerifyCleanCardClosure: public OopClosure {
 347 private:
 348   HeapWord* _boundary;
 349   HeapWord* _begin;
 350   HeapWord* _end;
 351 protected:
 352   template <class T> void do_oop_work(T* p) {
 353     HeapWord* jp = (HeapWord*)p;
 354     assert(jp >= _begin && jp < _end,
 355            err_msg("Error: jp " PTR_FORMAT " should be within "
 356                    "[_begin, _end) = [" PTR_FORMAT "," PTR_FORMAT ")",
 357                    jp, _begin, _end));
 358     oop obj = oopDesc::load_decode_heap_oop(p);
 359     guarantee(obj == NULL || (HeapWord*)obj >= _boundary,
 360               err_msg("pointer " PTR_FORMAT " at " PTR_FORMAT " on "
 361                       "clean card crosses boundary" PTR_FORMAT,
 362                       (HeapWord*)obj, jp, _boundary));


src/share/vm/memory/cardTableRS.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File