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




 293   if (!ur.contains(urasm)) {
 294     assert(UseConcMarkSweepGC && UseParNewGC, "Tautology: see assert above");
 295     warning("CMS+ParNew: Did you forget to call save_marks()? "
 296             "[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in "
 297             "[" PTR_FORMAT ", " PTR_FORMAT ")",
 298              urasm.start(), urasm.end(), ur.start(), ur.end());
 299     MemRegion ur2 = sp->used_region();
 300     MemRegion urasm2 = sp->used_region_at_save_marks();
 301     if (!ur.equals(ur2)) {
 302       warning("CMS+ParNew: Flickering used_region()!!");
 303     }
 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);




 293   if (!ur.contains(urasm)) {
 294     assert(UseConcMarkSweepGC && UseParNewGC, "Tautology: see assert above");
 295     warning("CMS+ParNew: Did you forget to call save_marks()? "
 296             "[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in "
 297             "[" PTR_FORMAT ", " PTR_FORMAT ")",
 298              urasm.start(), urasm.end(), ur.start(), ur.end());
 299     MemRegion ur2 = sp->used_region();
 300     MemRegion urasm2 = sp->used_region_at_save_marks();
 301     if (!ur.equals(ur2)) {
 302       warning("CMS+ParNew: Flickering used_region()!!");
 303     }
 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* old_gen) {
 314   assert(old_gen->level() == 1, "Should only be called for the old generation");
 315   GenCollectedHeap* gch = GenCollectedHeap::heap();
 316   // Generations younger than gen have been evacuated. We can clear
 317   // card table entries for gen (we know that it has no pointers
 318   // to younger gens) and for those below. The card tables for
 319   // the youngest gen need never be cleared.
 320   // There's a bit of subtlety in the clear() and invalidate()
 321   // methods that we exploit here and in invalidate_or_clear()
 322   // below to avoid missing cards at the fringes. If clear() or
 323   // invalidate() are changed in the future, this code should
 324   // be revisited. 20040107.ysr

 325   clear(old_gen->prev_used_region());


 326 }
 327 
 328 void CardTableRS::invalidate_or_clear(Generation* old_gen) {
 329   assert(old_gen->level() == 1, "Should only be called for the old generation");
 330   // For generation gen invalidate the cards for the currently
 331   // occupied part of that generation and clear the cards for the
 332   // unoccupied part of the generation (if any, making use
 333   // of that generation's prev_used_region to determine that
 334   // region). No need to do anything for the youngest
 335   // generation. Also see note#20040107.ysr above.
 336   MemRegion used_mr = old_gen->used_region();
 337   MemRegion to_be_cleared_mr = old_gen->prev_used_region().minus(used_mr);
 338   if (!to_be_cleared_mr.is_empty()) {
 339     clear(to_be_cleared_mr);
 340   }
 341   invalidate(used_mr);
 342 }
 343 
 344 
 345 class VerifyCleanCardClosure: public OopClosure {
 346 private:
 347   HeapWord* _boundary;
 348   HeapWord* _begin;
 349   HeapWord* _end;
 350 protected:
 351   template <class T> void do_oop_work(T* p) {
 352     HeapWord* jp = (HeapWord*)p;
 353     assert(jp >= _begin && jp < _end,
 354            err_msg("Error: jp " PTR_FORMAT " should be within "
 355                    "[_begin, _end) = [" PTR_FORMAT "," PTR_FORMAT ")",
 356                    jp, _begin, _end));
 357     oop obj = oopDesc::load_decode_heap_oop(p);


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