src/share/vm/memory/heap.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
8173151 Cdiff src/share/vm/memory/heap.cpp
src/share/vm/memory/heap.cpp
Print this page
*** 188,197 ****
--- 188,201 ----
NOT_PRODUCT(verify());
if (block != NULL) {
assert(block->length() >= number_of_segments && block->length() < number_of_segments + CodeCacheMinBlockLength, "sanity check");
assert(!block->free(), "must be marked free");
+ guarantee((char*) block >= _memory.low_boundary() && (char*) block < _memory.high(),
+ "The newly allocated block " INTPTR_FORMAT " is not within the heap "
+ "starting with " INTPTR_FORMAT " and ending with " INTPTR_FORMAT,
+ p2i(block), p2i(_memory.low_boundary()), p2i(_memory.high()));
DEBUG_ONLY(memset((void*)block->allocated_space(), badCodeHeapNewVal, instance_size));
_max_allocated_capacity = MAX2(_max_allocated_capacity, allocated_capacity());
_blob_count++;
return block->allocated_space();
}
*** 202,211 ****
--- 206,219 ----
if (_next_segment + number_of_segments <= _number_of_committed_segments) {
mark_segmap_as_used(_next_segment, _next_segment + number_of_segments);
HeapBlock* b = block_at(_next_segment);
b->initialize(number_of_segments);
_next_segment += number_of_segments;
+ guarantee((char*) b >= _memory.low_boundary() && (char*) block < _memory.high(),
+ "The newly allocated block " INTPTR_FORMAT " is not within the heap "
+ "starting with " INTPTR_FORMAT " and ending with " INTPTR_FORMAT,
+ p2i(b), p2i(_memory.low_boundary()), p2i(_memory.high()));
DEBUG_ONLY(memset((void *)b->allocated_space(), badCodeHeapNewVal, instance_size));
_max_allocated_capacity = MAX2(_max_allocated_capacity, allocated_capacity());
_blob_count++;
return b->allocated_space();
} else {
*** 217,226 ****
--- 225,238 ----
void CodeHeap::deallocate(void* p) {
assert(p == find_start(p), "illegal deallocation");
// Find start of HeapBlock
HeapBlock* b = (((HeapBlock *)p) - 1);
assert(b->allocated_space() == p, "sanity check");
+ guarantee((char*) b >= _memory.low_boundary() && (char*) b < _memory.high(),
+ "The block to be deallocated " INTPTR_FORMAT " is not within the heap "
+ "starting with " INTPTR_FORMAT " and ending with " INTPTR_FORMAT,
+ p2i(b), p2i(_memory.low_boundary()), p2i(_memory.high()));
DEBUG_ONLY(memset((void *)b->allocated_space(), badCodeHeapFreeVal,
segments_to_size(b->length()) - sizeof(HeapBlock)));
add_to_freelist(b);
NOT_PRODUCT(verify());
}
src/share/vm/memory/heap.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File