< prev index next >
src/hotspot/share/gc/shared/cardTable.cpp
Print this page
rev 58059 : imported patch 8238999-memregion-custom-operator
*** 49,82 ****
_page_size(os::vm_page_size()),
_byte_map_size(0),
_byte_map(NULL),
_byte_map_base(NULL),
_cur_covered_regions(0),
! _covered(NULL),
! _committed(NULL),
_guard_region()
{
assert((uintptr_t(_whole_heap.start()) & (card_size - 1)) == 0, "heap must start at card boundary");
assert((uintptr_t(_whole_heap.end()) & (card_size - 1)) == 0, "heap must end at card boundary");
assert(card_size <= 512, "card_size must be less than 512"); // why?
! _covered = new MemRegion[_max_covered_regions];
! if (_covered == NULL) {
! vm_exit_during_initialization("Could not allocate card table covered region set.");
}
}
CardTable::~CardTable() {
! if (_covered) {
! delete[] _covered;
! _covered = NULL;
! }
! if (_committed) {
! delete[] _committed;
! _committed = NULL;
! }
}
void CardTable::initialize() {
_guard_index = cards_required(_whole_heap.word_size()) - 1;
_last_valid_index = _guard_index - 1;
--- 49,76 ----
_page_size(os::vm_page_size()),
_byte_map_size(0),
_byte_map(NULL),
_byte_map_base(NULL),
_cur_covered_regions(0),
! _covered(NEW_C_HEAP_ARRAY(MemRegion, _max_covered_regions, mtGC)),
! _committed(NEW_C_HEAP_ARRAY(MemRegion, _max_covered_regions, mtGC)),
_guard_region()
{
assert((uintptr_t(_whole_heap.start()) & (card_size - 1)) == 0, "heap must start at card boundary");
assert((uintptr_t(_whole_heap.end()) & (card_size - 1)) == 0, "heap must end at card boundary");
assert(card_size <= 512, "card_size must be less than 512"); // why?
! for (int i = 0; i < _max_covered_regions; i++) {
! ::new (&_covered[i]) MemRegion();
! ::new (&_committed[i]) MemRegion();
}
}
CardTable::~CardTable() {
! FREE_C_HEAP_ARRAY(MemRegion, _covered);
! FREE_C_HEAP_ARRAY(MemRegion, _committed);
}
void CardTable::initialize() {
_guard_index = cards_required(_whole_heap.word_size()) - 1;
_last_valid_index = _guard_index - 1;
*** 85,98 ****
HeapWord* low_bound = _whole_heap.start();
HeapWord* high_bound = _whole_heap.end();
_cur_covered_regions = 0;
- _committed = new MemRegion[_max_covered_regions];
- if (_committed == NULL) {
- vm_exit_during_initialization("Could not allocate card table committed region set.");
- }
const size_t rs_align = _page_size == (size_t) os::vm_page_size() ? 0 :
MAX2(_page_size, (size_t) os::vm_allocation_granularity());
ReservedSpace heap_rs(_byte_map_size, rs_align, false);
--- 79,88 ----
< prev index next >