< prev index next >

src/share/vm/gc/shared/cardTableRS.cpp

Print this page




 261       // Otherwise, retry, to see the new value.
 262       continue;
 263     } else {
 264       assert(entry_val == cur_youngergen_and_prev_nonclean_card
 265              || entry_val == cur_youngergen_card_val(),
 266              "should be only possibilities.");
 267       return;
 268     }
 269   } while (true);
 270 }
 271 
 272 void CardTableRS::younger_refs_in_space_iterate(Space* sp,
 273                                                 OopsInGenClosure* cl,
 274                                                 uint n_threads) {
 275   const MemRegion urasm = sp->used_region_at_save_marks();
 276 #ifdef ASSERT
 277   // Convert the assertion check to a warning if we are running
 278   // CMS+ParNew until related bug is fixed.
 279   MemRegion ur    = sp->used_region();
 280   assert(ur.contains(urasm) || (UseConcMarkSweepGC),
 281          err_msg("Did you forget to call save_marks()? "
 282                  "[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in "
 283                  "[" PTR_FORMAT ", " PTR_FORMAT ")",
 284                  p2i(urasm.start()), p2i(urasm.end()), p2i(ur.start()), p2i(ur.end())));
 285   // In the case of CMS+ParNew, issue a warning
 286   if (!ur.contains(urasm)) {
 287     assert(UseConcMarkSweepGC, "Tautology: see assert above");
 288     warning("CMS+ParNew: Did you forget to call save_marks()? "
 289             "[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in "
 290             "[" PTR_FORMAT ", " PTR_FORMAT ")",
 291              p2i(urasm.start()), p2i(urasm.end()), p2i(ur.start()), p2i(ur.end()));
 292     MemRegion ur2 = sp->used_region();
 293     MemRegion urasm2 = sp->used_region_at_save_marks();
 294     if (!ur.equals(ur2)) {
 295       warning("CMS+ParNew: Flickering used_region()!!");
 296     }
 297     if (!urasm.equals(urasm2)) {
 298       warning("CMS+ParNew: Flickering used_region_at_save_marks()!!");
 299     }
 300     ShouldNotReachHere();
 301   }
 302 #endif
 303   _ct_bs->non_clean_card_iterate_possibly_parallel(sp, urasm, cl, this, n_threads);
 304 }


 325   // region). No need to do anything for the youngest
 326   // generation. Also see note#20040107.ysr above.
 327   MemRegion used_mr = old_gen->used_region();
 328   MemRegion to_be_cleared_mr = old_gen->prev_used_region().minus(used_mr);
 329   if (!to_be_cleared_mr.is_empty()) {
 330     clear(to_be_cleared_mr);
 331   }
 332   invalidate(used_mr);
 333 }
 334 
 335 
 336 class VerifyCleanCardClosure: public OopClosure {
 337 private:
 338   HeapWord* _boundary;
 339   HeapWord* _begin;
 340   HeapWord* _end;
 341 protected:
 342   template <class T> void do_oop_work(T* p) {
 343     HeapWord* jp = (HeapWord*)p;
 344     assert(jp >= _begin && jp < _end,
 345            err_msg("Error: jp " PTR_FORMAT " should be within "
 346                    "[_begin, _end) = [" PTR_FORMAT "," PTR_FORMAT ")",
 347                    p2i(jp), p2i(_begin), p2i(_end)));
 348     oop obj = oopDesc::load_decode_heap_oop(p);
 349     guarantee(obj == NULL || (HeapWord*)obj >= _boundary,
 350               err_msg("pointer " PTR_FORMAT " at " PTR_FORMAT " on "
 351                       "clean card crosses boundary" PTR_FORMAT,
 352                       p2i((HeapWord*)obj), p2i(jp), p2i(_boundary)));
 353   }
 354 
 355 public:
 356   VerifyCleanCardClosure(HeapWord* b, HeapWord* begin, HeapWord* end) :
 357     _boundary(b), _begin(begin), _end(end) {
 358     assert(b <= begin,
 359            err_msg("Error: boundary " PTR_FORMAT " should be at or below begin " PTR_FORMAT,
 360                    p2i(b), p2i(begin)));
 361     assert(begin <= end,
 362            err_msg("Error: begin " PTR_FORMAT " should be strictly below end " PTR_FORMAT,
 363                    p2i(begin), p2i(end)));
 364   }
 365 
 366   virtual void do_oop(oop* p)       { VerifyCleanCardClosure::do_oop_work(p); }
 367   virtual void do_oop(narrowOop* p) { VerifyCleanCardClosure::do_oop_work(p); }
 368 };
 369 
 370 class VerifyCTSpaceClosure: public SpaceClosure {
 371 private:
 372   CardTableRS* _ct;
 373   HeapWord* _boundary;
 374 public:
 375   VerifyCTSpaceClosure(CardTableRS* ct, HeapWord* boundary) :
 376     _ct(ct), _boundary(boundary) {}
 377   virtual void do_space(Space* s) { _ct->verify_space(s, _boundary); }
 378 };
 379 
 380 class VerifyCTGenClosure: public GenCollectedHeap::GenClosure {
 381   CardTableRS* _ct;
 382 public:
 383   VerifyCTGenClosure(CardTableRS* ct) : _ct(ct) {}




 261       // Otherwise, retry, to see the new value.
 262       continue;
 263     } else {
 264       assert(entry_val == cur_youngergen_and_prev_nonclean_card
 265              || entry_val == cur_youngergen_card_val(),
 266              "should be only possibilities.");
 267       return;
 268     }
 269   } while (true);
 270 }
 271 
 272 void CardTableRS::younger_refs_in_space_iterate(Space* sp,
 273                                                 OopsInGenClosure* cl,
 274                                                 uint n_threads) {
 275   const MemRegion urasm = sp->used_region_at_save_marks();
 276 #ifdef ASSERT
 277   // Convert the assertion check to a warning if we are running
 278   // CMS+ParNew until related bug is fixed.
 279   MemRegion ur    = sp->used_region();
 280   assert(ur.contains(urasm) || (UseConcMarkSweepGC),
 281          "Did you forget to call save_marks()? "
 282          "[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in "
 283          "[" PTR_FORMAT ", " PTR_FORMAT ")",
 284          p2i(urasm.start()), p2i(urasm.end()), p2i(ur.start()), p2i(ur.end()));
 285   // In the case of CMS+ParNew, issue a warning
 286   if (!ur.contains(urasm)) {
 287     assert(UseConcMarkSweepGC, "Tautology: see assert above");
 288     warning("CMS+ParNew: Did you forget to call save_marks()? "
 289             "[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in "
 290             "[" PTR_FORMAT ", " PTR_FORMAT ")",
 291              p2i(urasm.start()), p2i(urasm.end()), p2i(ur.start()), p2i(ur.end()));
 292     MemRegion ur2 = sp->used_region();
 293     MemRegion urasm2 = sp->used_region_at_save_marks();
 294     if (!ur.equals(ur2)) {
 295       warning("CMS+ParNew: Flickering used_region()!!");
 296     }
 297     if (!urasm.equals(urasm2)) {
 298       warning("CMS+ParNew: Flickering used_region_at_save_marks()!!");
 299     }
 300     ShouldNotReachHere();
 301   }
 302 #endif
 303   _ct_bs->non_clean_card_iterate_possibly_parallel(sp, urasm, cl, this, n_threads);
 304 }


 325   // region). No need to do anything for the youngest
 326   // generation. Also see note#20040107.ysr above.
 327   MemRegion used_mr = old_gen->used_region();
 328   MemRegion to_be_cleared_mr = old_gen->prev_used_region().minus(used_mr);
 329   if (!to_be_cleared_mr.is_empty()) {
 330     clear(to_be_cleared_mr);
 331   }
 332   invalidate(used_mr);
 333 }
 334 
 335 
 336 class VerifyCleanCardClosure: public OopClosure {
 337 private:
 338   HeapWord* _boundary;
 339   HeapWord* _begin;
 340   HeapWord* _end;
 341 protected:
 342   template <class T> void do_oop_work(T* p) {
 343     HeapWord* jp = (HeapWord*)p;
 344     assert(jp >= _begin && jp < _end,
 345            "Error: jp " PTR_FORMAT " should be within "
 346            "[_begin, _end) = [" PTR_FORMAT "," PTR_FORMAT ")",
 347            p2i(jp), p2i(_begin), p2i(_end));
 348     oop obj = oopDesc::load_decode_heap_oop(p);
 349     guarantee(obj == NULL || (HeapWord*)obj >= _boundary,
 350               "pointer " PTR_FORMAT " at " PTR_FORMAT " on "
 351               "clean card crosses boundary" PTR_FORMAT,
 352               p2i((HeapWord*)obj), p2i(jp), p2i(_boundary));
 353   }
 354 
 355 public:
 356   VerifyCleanCardClosure(HeapWord* b, HeapWord* begin, HeapWord* end) :
 357     _boundary(b), _begin(begin), _end(end) {
 358     assert(b <= begin,
 359            "Error: boundary " PTR_FORMAT " should be at or below begin " PTR_FORMAT,
 360            p2i(b), p2i(begin));
 361     assert(begin <= end,
 362            "Error: begin " PTR_FORMAT " should be strictly below end " PTR_FORMAT,
 363            p2i(begin), p2i(end));
 364   }
 365 
 366   virtual void do_oop(oop* p)       { VerifyCleanCardClosure::do_oop_work(p); }
 367   virtual void do_oop(narrowOop* p) { VerifyCleanCardClosure::do_oop_work(p); }
 368 };
 369 
 370 class VerifyCTSpaceClosure: public SpaceClosure {
 371 private:
 372   CardTableRS* _ct;
 373   HeapWord* _boundary;
 374 public:
 375   VerifyCTSpaceClosure(CardTableRS* ct, HeapWord* boundary) :
 376     _ct(ct), _boundary(boundary) {}
 377   virtual void do_space(Space* s) { _ct->verify_space(s, _boundary); }
 378 };
 379 
 380 class VerifyCTGenClosure: public GenCollectedHeap::GenClosure {
 381   CardTableRS* _ct;
 382 public:
 383   VerifyCTGenClosure(CardTableRS* ct) : _ct(ct) {}


< prev index next >