--- old/src/share/vm/gc/g1/g1AllocRegion.cpp 2015-09-24 09:51:31.469178724 +0200 +++ new/src/share/vm/gc/g1/g1AllocRegion.cpp 2015-09-24 09:51:31.369178229 +0200 @@ -91,7 +91,7 @@ } size_t G1AllocRegion::retire(bool fill_up) { - assert(_alloc_region != NULL, G1_ALLOC_REGION_MSG("not initialized properly")); + G1_ALLOC_REGION_ASSERT(_alloc_region != NULL, "not initialized properly"); size_t result = 0; @@ -101,15 +101,14 @@ // 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")); + G1_ALLOC_REGION_ASSERT(!alloc_region->is_empty(), + "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")); + G1_ALLOC_REGION_ASSERT(alloc_region->used() >= _used_bytes_before, "invariant"); size_t allocated_bytes = alloc_region->used() - _used_bytes_before; retire_region(alloc_region, allocated_bytes); _used_bytes_before = 0; @@ -122,8 +121,8 @@ 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")); + G1_ALLOC_REGION_ASSERT(_alloc_region == _dummy_region, "pre-condition"); + G1_ALLOC_REGION_ASSERT(_used_bytes_before == 0, "pre-condition"); trace("attempting region allocation"); HeapRegion* new_alloc_region = allocate_new_region(word_size, force); @@ -132,7 +131,7 @@ // 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")); + G1_ALLOC_REGION_ASSERT(result != NULL, "the allocation should succeeded"); OrderAccess::storestore(); // Note that we first perform the allocation and then we store the @@ -150,9 +149,8 @@ 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")); + G1_ALLOC_REGION_ASSERT(_alloc_region == NULL && _used_bytes_before == 0, "pre-condition"); + G1_ALLOC_REGION_ASSERT(_dummy_region != NULL, "should have been set"); _alloc_region = _dummy_region; _count = 0; trace("initialized"); @@ -162,11 +160,10 @@ 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")); + G1_ALLOC_REGION_ASSERT(alloc_region != NULL && !alloc_region->is_empty(), "pre-condition"); + G1_ALLOC_REGION_ASSERT(_alloc_region == _dummy_region && + _used_bytes_before == 0 && _count == 0, + "pre-condition"); _used_bytes_before = alloc_region->used(); _alloc_region = alloc_region; @@ -178,8 +175,7 @@ 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")); + G1_ALLOC_REGION_ASSERT(alloc_region != NULL && !alloc_region->is_empty(), "pre-condition"); _alloc_region = alloc_region; _alloc_region->set_allocation_context(allocation_context()); @@ -191,8 +187,7 @@ trace("releasing"); HeapRegion* alloc_region = _alloc_region; retire(false /* fill_up */); - assert(_alloc_region == _dummy_region, - G1_ALLOC_REGION_MSG("post-condition of retire()")); + G1_ALLOC_REGION_ASSERT(_alloc_region == _dummy_region, "post-condition of retire()"); _alloc_region = NULL; trace("released"); return (alloc_region == _dummy_region) ? NULL : alloc_region;