comparison src/share/vm/memory/cardTableRS.cpp @ 12033:bd902affe102

8023021: Unnecessary clearing of the card table introduced by the fix for JDK-8023013 Reviewed-by: stefank, ehelin
author brutisso
date Thu, 15 Aug 2013 10:05:50 +0200
parents 330dfb0476f4
children 63a4eb8bcd23 78bbf4d43a14
comparison
equal deleted inserted replaced
12032:5d9995d16b26 12033:bd902affe102
308 } 308 }
309 #endif 309 #endif
310 _ct_bs->non_clean_card_iterate_possibly_parallel(sp, urasm, cl, this); 310 _ct_bs->non_clean_card_iterate_possibly_parallel(sp, urasm, cl, this);
311 } 311 }
312 312
313 void CardTableRS::clear_into_younger(Generation* gen) { 313 void CardTableRS::clear_into_younger(Generation* old_gen) {
314 GenCollectedHeap* gch = GenCollectedHeap::heap(); 314 assert(old_gen->level() == 1, "Should only be called for the old generation");
315 // Generations younger than gen have been evacuated. We can clear 315 // The card tables for the youngest gen need never be cleared.
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() 316 // There's a bit of subtlety in the clear() and invalidate()
320 // methods that we exploit here and in invalidate_or_clear() 317 // methods that we exploit here and in invalidate_or_clear()
321 // below to avoid missing cards at the fringes. If clear() or 318 // below to avoid missing cards at the fringes. If clear() or
322 // invalidate() are changed in the future, this code should 319 // invalidate() are changed in the future, this code should
323 // be revisited. 20040107.ysr 320 // be revisited. 20040107.ysr
324 Generation* old_gen = gen;
325 clear(old_gen->prev_used_region()); 321 clear(old_gen->prev_used_region());
326 Generation* young_gen = gch->prev_gen(old_gen); 322 }
327 clear(young_gen->prev_used_region()); 323
328 } 324 void CardTableRS::invalidate_or_clear(Generation* old_gen) {
329 325 assert(old_gen->level() == 1, "Should only be called for the old generation");
330 void CardTableRS::invalidate_or_clear(Generation* gen) { 326 // Invalidate the cards for the currently occupied part of
331 // For generation gen invalidate the cards for the currently 327 // the old generation and clear the cards for the
332 // occupied part of that generation and clear the cards for the
333 // unoccupied part of the generation (if any, making use 328 // unoccupied part of the generation (if any, making use
334 // of that generation's prev_used_region to determine that 329 // of that generation's prev_used_region to determine that
335 // region). No need to do anything for the youngest 330 // region). No need to do anything for the youngest
336 // generation. Also see note#20040107.ysr above. 331 // generation. Also see note#20040107.ysr above.
337 MemRegion used_mr = gen->used_region(); 332 MemRegion used_mr = old_gen->used_region();
338 MemRegion to_be_cleared_mr = gen->prev_used_region().minus(used_mr); 333 MemRegion to_be_cleared_mr = old_gen->prev_used_region().minus(used_mr);
339 if (!to_be_cleared_mr.is_empty()) { 334 if (!to_be_cleared_mr.is_empty()) {
340 clear(to_be_cleared_mr); 335 clear(to_be_cleared_mr);
341 } 336 }
342 invalidate(used_mr); 337 invalidate(used_mr);
343 } 338 }