< prev index next >

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

Print this page
rev 8978 : imported patch remove_err_msg
rev 8979 : [mq]: vmerr_static

*** 89,117 **** "post-condition"); return result; } size_t G1AllocRegion::retire(bool fill_up) { ! assert(_alloc_region != NULL, ar_ext_msg(this, "not initialized properly")); size_t result = 0; trace("retiring"); HeapRegion* alloc_region = _alloc_region; if (alloc_region != _dummy_region) { // We never have to check whether the active region is empty or not, // and potentially free it if it is, given that it's guaranteed that // it will never be empty. assert(!alloc_region->is_empty(), ! ar_ext_msg(this, "the alloc region should never be empty")); if (fill_up) { result = fill_up_remaining_space(alloc_region, _bot_updates); } assert(alloc_region->used() >= _used_bytes_before, ! ar_ext_msg(this, "invariant")); size_t allocated_bytes = alloc_region->used() - _used_bytes_before; retire_region(alloc_region, allocated_bytes); _used_bytes_before = 0; _alloc_region = _dummy_region; } --- 89,117 ---- "post-condition"); return result; } size_t G1AllocRegion::retire(bool fill_up) { ! assert(_alloc_region != NULL, G1_ALLOC_REGION_MSG("not initialized properly")); size_t result = 0; trace("retiring"); HeapRegion* alloc_region = _alloc_region; if (alloc_region != _dummy_region) { // We never have to check whether the active region is empty or not, // and potentially free it if it is, given that it's guaranteed that // it will never be empty. assert(!alloc_region->is_empty(), ! G1_ALLOC_REGION_MSG("the alloc region should never be empty")); if (fill_up) { result = fill_up_remaining_space(alloc_region, _bot_updates); } assert(alloc_region->used() >= _used_bytes_before, ! G1_ALLOC_REGION_MSG("invariant")); size_t allocated_bytes = alloc_region->used() - _used_bytes_before; retire_region(alloc_region, allocated_bytes); _used_bytes_before = 0; _alloc_region = _dummy_region; }
*** 120,140 **** return result; } HeapWord* G1AllocRegion::new_alloc_region_and_allocate(size_t word_size, bool force) { ! assert(_alloc_region == _dummy_region, ar_ext_msg(this, "pre-condition")); ! assert(_used_bytes_before == 0, ar_ext_msg(this, "pre-condition")); trace("attempting region allocation"); HeapRegion* new_alloc_region = allocate_new_region(word_size, force); if (new_alloc_region != NULL) { new_alloc_region->reset_pre_dummy_top(); // Need to do this before the allocation _used_bytes_before = new_alloc_region->used(); HeapWord* result = allocate(new_alloc_region, word_size, _bot_updates); ! assert(result != NULL, ar_ext_msg(this, "the allocation should succeeded")); OrderAccess::storestore(); // Note that we first perform the allocation and then we store the // region in _alloc_region. This is the reason why an active region // can never be empty. --- 120,140 ---- return result; } HeapWord* G1AllocRegion::new_alloc_region_and_allocate(size_t word_size, bool force) { ! assert(_alloc_region == _dummy_region, G1_ALLOC_REGION_MSG("pre-condition")); ! assert(_used_bytes_before == 0, G1_ALLOC_REGION_MSG("pre-condition")); trace("attempting region allocation"); HeapRegion* new_alloc_region = allocate_new_region(word_size, force); if (new_alloc_region != NULL) { new_alloc_region->reset_pre_dummy_top(); // Need to do this before the allocation _used_bytes_before = new_alloc_region->used(); HeapWord* result = allocate(new_alloc_region, word_size, _bot_updates); ! assert(result != NULL, G1_ALLOC_REGION_MSG("the allocation should succeeded")); OrderAccess::storestore(); // Note that we first perform the allocation and then we store the // region in _alloc_region. This is the reason why an active region // can never be empty.
*** 146,180 **** return NULL; } ShouldNotReachHere(); } - void G1AllocRegion::fill_in_ext_msg(ar_ext_msg* msg, const char* message) { - msg->append("[%s] %s c: %u b: %s r: " PTR_FORMAT " u: " SIZE_FORMAT, - _name, message, _count, BOOL_TO_STR(_bot_updates), - p2i(_alloc_region), _used_bytes_before); - } - void G1AllocRegion::init() { trace("initializing"); assert(_alloc_region == NULL && _used_bytes_before == 0, ! ar_ext_msg(this, "pre-condition")); ! assert(_dummy_region != NULL, ar_ext_msg(this, "should have been set")); _alloc_region = _dummy_region; _count = 0; trace("initialized"); } void G1AllocRegion::set(HeapRegion* alloc_region) { trace("setting"); // We explicitly check that the region is not empty to make sure we // maintain the "the alloc region cannot be empty" invariant. assert(alloc_region != NULL && !alloc_region->is_empty(), ! ar_ext_msg(this, "pre-condition")); assert(_alloc_region == _dummy_region && _used_bytes_before == 0 && _count == 0, ! ar_ext_msg(this, "pre-condition")); _used_bytes_before = alloc_region->used(); _alloc_region = alloc_region; _count += 1; trace("set"); --- 146,174 ---- return NULL; } ShouldNotReachHere(); } void G1AllocRegion::init() { trace("initializing"); assert(_alloc_region == NULL && _used_bytes_before == 0, ! G1_ALLOC_REGION_MSG("pre-condition")); ! assert(_dummy_region != NULL, G1_ALLOC_REGION_MSG("should have been set")); _alloc_region = _dummy_region; _count = 0; trace("initialized"); } void G1AllocRegion::set(HeapRegion* alloc_region) { trace("setting"); // We explicitly check that the region is not empty to make sure we // maintain the "the alloc region cannot be empty" invariant. assert(alloc_region != NULL && !alloc_region->is_empty(), ! G1_ALLOC_REGION_MSG("pre-condition")); assert(_alloc_region == _dummy_region && _used_bytes_before == 0 && _count == 0, ! G1_ALLOC_REGION_MSG("pre-condition")); _used_bytes_before = alloc_region->used(); _alloc_region = alloc_region; _count += 1; trace("set");
*** 183,193 **** void G1AllocRegion::update_alloc_region(HeapRegion* alloc_region) { trace("update"); // We explicitly check that the region is not empty to make sure we // maintain the "the alloc region cannot be empty" invariant. assert(alloc_region != NULL && !alloc_region->is_empty(), ! ar_ext_msg(this, "pre-condition")); _alloc_region = alloc_region; _alloc_region->set_allocation_context(allocation_context()); _count += 1; trace("updated"); --- 177,187 ---- void G1AllocRegion::update_alloc_region(HeapRegion* alloc_region) { trace("update"); // We explicitly check that the region is not empty to make sure we // maintain the "the alloc region cannot be empty" invariant. assert(alloc_region != NULL && !alloc_region->is_empty(), ! G1_ALLOC_REGION_MSG("pre-condition")); _alloc_region = alloc_region; _alloc_region->set_allocation_context(allocation_context()); _count += 1; trace("updated");
*** 196,206 **** HeapRegion* G1AllocRegion::release() { trace("releasing"); HeapRegion* alloc_region = _alloc_region; retire(false /* fill_up */); assert(_alloc_region == _dummy_region, ! ar_ext_msg(this, "post-condition of retire()")); _alloc_region = NULL; trace("released"); return (alloc_region == _dummy_region) ? NULL : alloc_region; } --- 190,200 ---- HeapRegion* G1AllocRegion::release() { trace("releasing"); HeapRegion* alloc_region = _alloc_region; retire(false /* fill_up */); assert(_alloc_region == _dummy_region, ! G1_ALLOC_REGION_MSG("post-condition of retire()")); _alloc_region = NULL; trace("released"); return (alloc_region == _dummy_region) ? NULL : alloc_region; }
< prev index next >