hotspot/src/share/vm/memory/cardTableRS.cpp
changeset 19286 48394008c803
parent 17376 4ee999c3c007
child 19289 213031f03f61
equal deleted inserted replaced
19265:df22e7139250 19286:48394008c803
   319   // There's a bit of subtlety in the clear() and invalidate()
   319   // There's a bit of subtlety in the clear() and invalidate()
   320   // methods that we exploit here and in invalidate_or_clear()
   320   // methods that we exploit here and in invalidate_or_clear()
   321   // below to avoid missing cards at the fringes. If clear() or
   321   // below to avoid missing cards at the fringes. If clear() or
   322   // invalidate() are changed in the future, this code should
   322   // invalidate() are changed in the future, this code should
   323   // be revisited. 20040107.ysr
   323   // be revisited. 20040107.ysr
   324   Generation* g = gen;
   324   Generation* old_gen = gen;
   325   for(Generation* prev_gen = gch->prev_gen(g);
   325   clear(old_gen->prev_used_region());
   326       prev_gen != NULL;
   326   Generation* young_gen = gch->prev_gen(old_gen);
   327       g = prev_gen, prev_gen = gch->prev_gen(g)) {
   327   clear(young_gen->prev_used_region());
   328     MemRegion to_be_cleared_mr = g->prev_used_region();
   328 }
   329     clear(to_be_cleared_mr);
   329 
   330   }
   330 void CardTableRS::invalidate_or_clear(Generation* gen) {
   331 }
   331   // For generation gen invalidate the cards for the currently
   332 
   332   // occupied part of that generation and clear the cards for the
   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
   333   // unoccupied part of the generation (if any, making use
   339   // of that generation's prev_used_region to determine that
   334   // of that generation's prev_used_region to determine that
   340   // region). No need to do anything for the youngest
   335   // region). No need to do anything for the youngest
   341   // generation. Also see note#20040107.ysr above.
   336   // generation. Also see note#20040107.ysr above.
   342   Generation* g = gen;
   337   MemRegion used_mr = gen->used_region();
   343   for(Generation* prev_gen = gch->prev_gen(g); prev_gen != NULL;
   338   MemRegion to_be_cleared_mr = gen->prev_used_region().minus(used_mr);
   344       g = prev_gen, prev_gen = gch->prev_gen(g))  {
   339   if (!to_be_cleared_mr.is_empty()) {
   345     MemRegion used_mr = g->used_region();
   340     clear(to_be_cleared_mr);
   346     MemRegion to_be_cleared_mr = g->prev_used_region().minus(used_mr);
   341   }
   347     if (!to_be_cleared_mr.is_empty()) {
   342   invalidate(used_mr);
   348       clear(to_be_cleared_mr);
       
   349     }
       
   350     invalidate(used_mr);
       
   351     if (!younger) break;
       
   352   }
       
   353 }
   343 }
   354 
   344 
   355 
   345 
   356 class VerifyCleanCardClosure: public OopClosure {
   346 class VerifyCleanCardClosure: public OopClosure {
   357 private:
   347 private: