< prev index next >
src/share/vm/gc/g1/g1CardLiveData.cpp
Print this page
rev 12906 : [mq]: gc_interface
*** 65,78 ****
void G1CardLiveData::initialize(size_t max_capacity, uint num_max_regions) {
assert(max_capacity % num_max_regions == 0,
"Given capacity must be evenly divisible by region size.");
size_t region_size = max_capacity / num_max_regions;
! assert(region_size % (G1SATBCardTableModRefBS::card_size * BitsPerWord) == 0,
"Region size must be evenly divisible by area covered by a single word.");
_max_capacity = max_capacity;
! _cards_per_region = region_size / G1SATBCardTableModRefBS::card_size;
_live_regions_size_in_bits = live_region_bitmap_size_in_bits();
_live_regions = allocate_large_bitmap(_live_regions_size_in_bits);
_live_cards_size_in_bits = live_card_bitmap_size_in_bits();
_live_cards = allocate_large_bitmap(_live_cards_size_in_bits);
--- 65,78 ----
void G1CardLiveData::initialize(size_t max_capacity, uint num_max_regions) {
assert(max_capacity % num_max_regions == 0,
"Given capacity must be evenly divisible by region size.");
size_t region_size = max_capacity / num_max_regions;
! assert(region_size % (G1CardTable::card_size * BitsPerWord) == 0,
"Region size must be evenly divisible by area covered by a single word.");
_max_capacity = max_capacity;
! _cards_per_region = region_size / G1CardTable::card_size;
_live_regions_size_in_bits = live_region_bitmap_size_in_bits();
_live_regions = allocate_large_bitmap(_live_regions_size_in_bits);
_live_cards_size_in_bits = live_card_bitmap_size_in_bits();
_live_cards = allocate_large_bitmap(_live_cards_size_in_bits);
*** 82,96 ****
live_cards_bm().pretouch();
live_regions_bm().pretouch();
}
size_t G1CardLiveData::live_region_bitmap_size_in_bits() const {
! return _max_capacity / (_cards_per_region << G1SATBCardTableModRefBS::card_shift);
}
size_t G1CardLiveData::live_card_bitmap_size_in_bits() const {
! return _max_capacity >> G1SATBCardTableModRefBS::card_shift;
}
// Helper class that provides functionality to generate the Live Data Count
// information.
class G1CardLiveDataHelper VALUE_OBJ_CLASS_SPEC {
--- 82,96 ----
live_cards_bm().pretouch();
live_regions_bm().pretouch();
}
size_t G1CardLiveData::live_region_bitmap_size_in_bits() const {
! return _max_capacity / (_cards_per_region << G1CardTable::card_shift);
}
size_t G1CardLiveData::live_card_bitmap_size_in_bits() const {
! return _max_capacity >> G1CardTable::card_shift;
}
// Helper class that provides functionality to generate the Live Data Count
// information.
class G1CardLiveDataHelper VALUE_OBJ_CLASS_SPEC {
*** 129,147 ****
// lots of work most of the time.
BitMap::idx_t _last_marked_bit_idx;
void clear_card_bitmap_range(HeapWord* start, HeapWord* end) {
BitMap::idx_t start_idx = card_live_bitmap_index_for(start);
! BitMap::idx_t end_idx = card_live_bitmap_index_for((HeapWord*)align_ptr_up(end, CardTableModRefBS::card_size));
_card_bm.clear_range(start_idx, end_idx);
}
// Mark the card liveness bitmap for the object spanning from start to end.
void mark_card_bitmap_range(HeapWord* start, HeapWord* end) {
BitMap::idx_t start_idx = card_live_bitmap_index_for(start);
! BitMap::idx_t end_idx = card_live_bitmap_index_for((HeapWord*)align_ptr_up(end, CardTableModRefBS::card_size));
assert((end_idx - start_idx) > 0, "Trying to mark zero sized range.");
if (start_idx == _last_marked_bit_idx) {
start_idx++;
--- 129,147 ----
// lots of work most of the time.
BitMap::idx_t _last_marked_bit_idx;
void clear_card_bitmap_range(HeapWord* start, HeapWord* end) {
BitMap::idx_t start_idx = card_live_bitmap_index_for(start);
! BitMap::idx_t end_idx = card_live_bitmap_index_for((HeapWord*)align_ptr_up(end, G1CardTable::card_size));
_card_bm.clear_range(start_idx, end_idx);
}
// Mark the card liveness bitmap for the object spanning from start to end.
void mark_card_bitmap_range(HeapWord* start, HeapWord* end) {
BitMap::idx_t start_idx = card_live_bitmap_index_for(start);
! BitMap::idx_t end_idx = card_live_bitmap_index_for((HeapWord*)align_ptr_up(end, G1CardTable::card_size));
assert((end_idx - start_idx) > 0, "Trying to mark zero sized range.");
if (start_idx == _last_marked_bit_idx) {
start_idx++;
*** 165,175 ****
inline BitMap::idx_t card_live_bitmap_index_for(HeapWord* addr) {
// Below, the term "card num" means the result of shifting an address
// by the card shift -- address 0 corresponds to card number 0. One
// must subtract the card num of the bottom of the heap to obtain a
// card table index.
! BitMap::idx_t card_num = uintptr_t(addr) >> CardTableModRefBS::card_shift;
return card_num - _heap_card_bias;
}
// Takes a region that's not empty (i.e., it has at least one
// live object in it and sets its corresponding bit on the region
--- 165,175 ----
inline BitMap::idx_t card_live_bitmap_index_for(HeapWord* addr) {
// Below, the term "card num" means the result of shifting an address
// by the card shift -- address 0 corresponds to card number 0. One
// must subtract the card num of the bottom of the heap to obtain a
// card table index.
! BitMap::idx_t card_num = uintptr_t(addr) >> G1CardTable::card_shift;
return card_num - _heap_card_bias;
}
// Takes a region that's not empty (i.e., it has at least one
// live object in it and sets its corresponding bit on the region
*** 259,269 ****
_region_bm(live_data->live_regions_bm()),
_card_bm(live_data->live_cards_bm()) {
// Calculate the card number for the bottom of the heap. Used
// in biasing indexes into the accounting card bitmaps.
_heap_card_bias =
! uintptr_t(base_address) >> CardTableModRefBS::card_shift;
}
};
class G1CreateCardLiveDataTask: public AbstractGangTask {
// Aggregate the counting data that was constructed concurrently
--- 259,269 ----
_region_bm(live_data->live_regions_bm()),
_card_bm(live_data->live_cards_bm()) {
// Calculate the card number for the bottom of the heap. Used
// in biasing indexes into the accounting card bitmaps.
_heap_card_bias =
! uintptr_t(base_address) >> G1CardTable::card_shift;
}
};
class G1CreateCardLiveDataTask: public AbstractGangTask {
// Aggregate the counting data that was constructed concurrently
< prev index next >