# HG changeset patch # User jmasa # Date 1325692573 28800 # Node ID 4753e3dda3c8199ebfd393a2e42ff22098044255 # Parent 5ee33ff9b1c444839ee097b7d16948b7754e9b7f# Parent b6a04c79ccbc3c3a3b30f942d5824f7b4c4407ab Merge diff -r 5ee33ff9b1c4 -r 4753e3dda3c8 src/share/vm/gc_interface/collectedHeap.cpp --- a/src/share/vm/gc_interface/collectedHeap.cpp Tue Jan 03 10:22:19 2012 -0800 +++ b/src/share/vm/gc_interface/collectedHeap.cpp Wed Jan 04 07:56:13 2012 -0800 @@ -478,18 +478,22 @@ void CollectedHeap::test_is_in() { CollectedHeap* heap = Universe::heap(); + uintptr_t epsilon = (uintptr_t) MinObjAlignment; + uintptr_t heap_start = (uintptr_t) heap->_reserved.start(); + uintptr_t heap_end = (uintptr_t) heap->_reserved.end(); + // Test that NULL is not in the heap. assert(!heap->is_in(NULL), "NULL is unexpectedly in the heap"); // Test that a pointer to before the heap start is reported as outside the heap. - assert(heap->_reserved.start() >= (void*)MinObjAlignment, "sanity"); - void* before_heap = (void*)((intptr_t)heap->_reserved.start() - MinObjAlignment); + assert(heap_start >= ((uintptr_t)NULL + epsilon), "sanity"); + void* before_heap = (void*)(heap_start - epsilon); assert(!heap->is_in(before_heap), err_msg("before_heap: " PTR_FORMAT " is unexpectedly in the heap", before_heap)); // Test that a pointer to after the heap end is reported as outside the heap. - assert(heap->_reserved.end() <= (void*)(uintptr_t(-1) - (uint)MinObjAlignment), "sanity"); - void* after_heap = (void*)((intptr_t)heap->_reserved.end() + MinObjAlignment); + assert(heap_end <= ((uintptr_t)-1 - epsilon), "sanity"); + void* after_heap = (void*)(heap_end + epsilon); assert(!heap->is_in(after_heap), err_msg("after_heap: " PTR_FORMAT " is unexpectedly in the heap", after_heap)); }