Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @ 283:9199f248b0ee
6722112: CMS: Incorrect encoding of overflown object arrays during concurrent precleaning
Summary: When an object array overflows during precleaning, we should have been marking the entire array dirty, not just its first card.
Reviewed-by: jmasa, poonam, tonyp
author | ysr |
---|---|
date | Thu, 14 Aug 2008 17:58:35 -0700 |
parents | 818a18cd69a8 |
children | ebeb6490b814 1ee8caae33af |
comparison
equal
deleted
inserted
replaced
277:79276d1b7e50 | 283:9199f248b0ee |
---|---|
6865 // We re-dirty the cards on which this object lies and increase | 6865 // We re-dirty the cards on which this object lies and increase |
6866 // the _threshold so that we'll come back to scan this object | 6866 // the _threshold so that we'll come back to scan this object |
6867 // during the preclean or remark phase. (CMSCleanOnEnter) | 6867 // during the preclean or remark phase. (CMSCleanOnEnter) |
6868 if (CMSCleanOnEnter) { | 6868 if (CMSCleanOnEnter) { |
6869 size_t sz = _collector->block_size_using_printezis_bits(addr); | 6869 size_t sz = _collector->block_size_using_printezis_bits(addr); |
6870 HeapWord* start_card_addr = (HeapWord*)round_down( | |
6871 (intptr_t)addr, CardTableModRefBS::card_size); | |
6872 HeapWord* end_card_addr = (HeapWord*)round_to( | 6870 HeapWord* end_card_addr = (HeapWord*)round_to( |
6873 (intptr_t)(addr+sz), CardTableModRefBS::card_size); | 6871 (intptr_t)(addr+sz), CardTableModRefBS::card_size); |
6874 MemRegion redirty_range = MemRegion(start_card_addr, end_card_addr); | 6872 MemRegion redirty_range = MemRegion(addr, end_card_addr); |
6875 assert(!redirty_range.is_empty(), "Arithmetical tautology"); | 6873 assert(!redirty_range.is_empty(), "Arithmetical tautology"); |
6876 // Bump _threshold to end_card_addr; note that | 6874 // Bump _threshold to end_card_addr; note that |
6877 // _threshold cannot possibly exceed end_card_addr, anyhow. | 6875 // _threshold cannot possibly exceed end_card_addr, anyhow. |
6878 // This prevents future clearing of the card as the scan proceeds | 6876 // This prevents future clearing of the card as the scan proceeds |
6879 // to the right. | 6877 // to the right. |
7458 simulate_overflow = true; | 7456 simulate_overflow = true; |
7459 } | 7457 } |
7460 ) | 7458 ) |
7461 if (simulate_overflow || !_mark_stack->push(obj)) { | 7459 if (simulate_overflow || !_mark_stack->push(obj)) { |
7462 if (_concurrent_precleaning) { | 7460 if (_concurrent_precleaning) { |
7463 // During precleaning we can just dirty the appropriate card | 7461 // During precleaning we can just dirty the appropriate card(s) |
7464 // in the mod union table, thus ensuring that the object remains | 7462 // in the mod union table, thus ensuring that the object remains |
7465 // in the grey set and continue. Note that no one can be intefering | 7463 // in the grey set and continue. In the case of object arrays |
7466 // with us in this action of dirtying the mod union table, so | 7464 // we need to dirty all of the cards that the object spans, |
7467 // no locking is required. | 7465 // since the rescan of object arrays will be limited to the |
7468 _mod_union_table->mark(addr); | 7466 // dirty cards. |
7467 // Note that no one can be intefering with us in this action | |
7468 // of dirtying the mod union table, so no locking or atomics | |
7469 // are required. | |
7470 if (obj->is_objArray()) { | |
7471 size_t sz = obj->size(); | |
7472 HeapWord* end_card_addr = (HeapWord*)round_to( | |
7473 (intptr_t)(addr+sz), CardTableModRefBS::card_size); | |
7474 MemRegion redirty_range = MemRegion(addr, end_card_addr); | |
7475 assert(!redirty_range.is_empty(), "Arithmetical tautology"); | |
7476 _mod_union_table->mark_range(redirty_range); | |
7477 } else { | |
7478 _mod_union_table->mark(addr); | |
7479 } | |
7469 _collector->_ser_pmc_preclean_ovflw++; | 7480 _collector->_ser_pmc_preclean_ovflw++; |
7470 } else { | 7481 } else { |
7471 // During the remark phase, we need to remember this oop | 7482 // During the remark phase, we need to remember this oop |
7472 // in the overflow list. | 7483 // in the overflow list. |
7473 _collector->push_on_overflow_list(obj); | 7484 _collector->push_on_overflow_list(obj); |