equal
deleted
inserted
replaced
469 // notify jvmti and dtrace |
469 // notify jvmti and dtrace |
470 post_allocation_notify(klass, (oop)obj); |
470 post_allocation_notify(klass, (oop)obj); |
471 |
471 |
472 return mirror; |
472 return mirror; |
473 } |
473 } |
|
474 |
|
475 /////////////// Unit tests /////////////// |
|
476 |
|
477 #ifndef PRODUCT |
|
478 void CollectedHeap::test_is_in() { |
|
479 CollectedHeap* heap = Universe::heap(); |
|
480 |
|
481 // Test that NULL is not in the heap. |
|
482 assert(!heap->is_in(NULL), "NULL is unexpectedly in the heap"); |
|
483 |
|
484 // Test that a pointer to before the heap start is reported as outside the heap. |
|
485 assert(heap->_reserved.start() >= (void*)MinObjAlignment, "sanity"); |
|
486 void* before_heap = (void*)((intptr_t)heap->_reserved.start() - MinObjAlignment); |
|
487 assert(!heap->is_in(before_heap), |
|
488 err_msg("before_heap: " PTR_FORMAT " is unexpectedly in the heap", before_heap)); |
|
489 |
|
490 // Test that a pointer to after the heap end is reported as outside the heap. |
|
491 assert(heap->_reserved.end() <= (void*)(uintptr_t(-1) - (uint)MinObjAlignment), "sanity"); |
|
492 void* after_heap = (void*)((intptr_t)heap->_reserved.end() + MinObjAlignment); |
|
493 assert(!heap->is_in(after_heap), |
|
494 err_msg("after_heap: " PTR_FORMAT " is unexpectedly in the heap", after_heap)); |
|
495 } |
|
496 #endif |