< prev index next >

src/share/vm/gc/g1/g1CardCounts.cpp

Print this page
rev 10742 : Make fields used in lock-free algorithms volatile

*** 81,91 **** _reserved_max_card_num = mapper->reserved().byte_size(); mapper->set_mapping_changed_listener(&_listener); } } ! uint G1CardCounts::add_card_count(jbyte* card_ptr) { // Returns the number of times the card has been refined. // If we failed to reserve/commit the counts table, return 0. // If card_ptr is beyond the committed end of the counts table, // return 0. // Otherwise return the actual count. --- 81,91 ---- _reserved_max_card_num = mapper->reserved().byte_size(); mapper->set_mapping_changed_listener(&_listener); } } ! uint G1CardCounts::add_card_count(volatile jbyte* card_ptr) { // Returns the number of times the card has been refined. // If we failed to reserve/commit the counts table, return 0. // If card_ptr is beyond the committed end of the counts table, // return 0. // Otherwise return the actual count.
*** 116,130 **** clear_range(mr); } void G1CardCounts::clear_range(MemRegion mr) { if (has_count_table()) { ! const jbyte* from_card_ptr = _ct_bs->byte_for_const(mr.start()); // We use the last address in the range as the range could represent the // last region in the heap. In which case trying to find the card will be an // OOB access to the card table. ! const jbyte* last_card_ptr = _ct_bs->byte_for_const(mr.last()); #ifdef ASSERT HeapWord* start_addr = _ct_bs->addr_for(from_card_ptr); assert(start_addr == mr.start(), "MemRegion start must be aligned to a card."); HeapWord* last_addr = _ct_bs->addr_for(last_card_ptr); --- 116,130 ---- clear_range(mr); } void G1CardCounts::clear_range(MemRegion mr) { if (has_count_table()) { ! const volatile jbyte* from_card_ptr = _ct_bs->byte_for_const(mr.start()); // We use the last address in the range as the range could represent the // last region in the heap. In which case trying to find the card will be an // OOB access to the card table. ! const volatile jbyte* last_card_ptr = _ct_bs->byte_for_const(mr.last()); #ifdef ASSERT HeapWord* start_addr = _ct_bs->addr_for(from_card_ptr); assert(start_addr == mr.start(), "MemRegion start must be aligned to a card."); HeapWord* last_addr = _ct_bs->addr_for(last_card_ptr);
< prev index next >