hotspot/src/share/vm/gc/shared/cardTableRS.cpp
changeset 31358 693058672cc6
parent 30870 3050fdcdc60b
child 31964 d34ad1715d96
equal deleted inserted replaced
31357:0cef600ba9b7 31358:693058672cc6
   102 }
   102 }
   103 
   103 
   104 void CardTableRS::younger_refs_iterate(Generation* g,
   104 void CardTableRS::younger_refs_iterate(Generation* g,
   105                                        OopsInGenClosure* blk,
   105                                        OopsInGenClosure* blk,
   106                                        uint n_threads) {
   106                                        uint n_threads) {
   107   _last_cur_val_in_gen[g->level()+1] = cur_youngergen_card_val();
   107   // The indexing in this array is slightly odd. We want to access
       
   108   // the old generation record here, which is at index 2.
       
   109   _last_cur_val_in_gen[2] = cur_youngergen_card_val();
   108   g->younger_refs_iterate(blk, n_threads);
   110   g->younger_refs_iterate(blk, n_threads);
   109 }
   111 }
   110 
   112 
   111 inline bool ClearNoncleanCardWrapper::clear_card(jbyte* entry) {
   113 inline bool ClearNoncleanCardWrapper::clear_card(jbyte* entry) {
   112   if (_is_par) {
   114   if (_is_par) {
   298 #endif
   300 #endif
   299   _ct_bs->non_clean_card_iterate_possibly_parallel(sp, urasm, cl, this, n_threads);
   301   _ct_bs->non_clean_card_iterate_possibly_parallel(sp, urasm, cl, this, n_threads);
   300 }
   302 }
   301 
   303 
   302 void CardTableRS::clear_into_younger(Generation* old_gen) {
   304 void CardTableRS::clear_into_younger(Generation* old_gen) {
   303   assert(old_gen->level() == 1, "Should only be called for the old generation");
   305   assert(GenCollectedHeap::heap()->is_old_gen(old_gen),
       
   306          "Should only be called for the old generation");
   304   // The card tables for the youngest gen need never be cleared.
   307   // The card tables for the youngest gen need never be cleared.
   305   // There's a bit of subtlety in the clear() and invalidate()
   308   // There's a bit of subtlety in the clear() and invalidate()
   306   // methods that we exploit here and in invalidate_or_clear()
   309   // methods that we exploit here and in invalidate_or_clear()
   307   // below to avoid missing cards at the fringes. If clear() or
   310   // below to avoid missing cards at the fringes. If clear() or
   308   // invalidate() are changed in the future, this code should
   311   // invalidate() are changed in the future, this code should
   309   // be revisited. 20040107.ysr
   312   // be revisited. 20040107.ysr
   310   clear(old_gen->prev_used_region());
   313   clear(old_gen->prev_used_region());
   311 }
   314 }
   312 
   315 
   313 void CardTableRS::invalidate_or_clear(Generation* old_gen) {
   316 void CardTableRS::invalidate_or_clear(Generation* old_gen) {
   314   assert(old_gen->level() == 1, "Should only be called for the old generation");
   317   assert(GenCollectedHeap::heap()->is_old_gen(old_gen),
       
   318          "Should only be called for the old generation");
   315   // Invalidate the cards for the currently occupied part of
   319   // Invalidate the cards for the currently occupied part of
   316   // the old generation and clear the cards for the
   320   // the old generation and clear the cards for the
   317   // unoccupied part of the generation (if any, making use
   321   // unoccupied part of the generation (if any, making use
   318   // of that generation's prev_used_region to determine that
   322   // of that generation's prev_used_region to determine that
   319   // region). No need to do anything for the youngest
   323   // region). No need to do anything for the youngest
   375   CardTableRS* _ct;
   379   CardTableRS* _ct;
   376 public:
   380 public:
   377   VerifyCTGenClosure(CardTableRS* ct) : _ct(ct) {}
   381   VerifyCTGenClosure(CardTableRS* ct) : _ct(ct) {}
   378   void do_generation(Generation* gen) {
   382   void do_generation(Generation* gen) {
   379     // Skip the youngest generation.
   383     // Skip the youngest generation.
   380     if (gen->level() == 0) return;
   384     if (GenCollectedHeap::heap()->is_young_gen(gen)) {
       
   385       return;
       
   386     }
   381     // Normally, we're interested in pointers to younger generations.
   387     // Normally, we're interested in pointers to younger generations.
   382     VerifyCTSpaceClosure blk(_ct, gen->reserved().start());
   388     VerifyCTSpaceClosure blk(_ct, gen->reserved().start());
   383     gen->space_iterate(&blk, true);
   389     gen->space_iterate(&blk, true);
   384   }
   390   }
   385 };
   391 };