Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File

465 466 instanceMirrorKlass* mk = instanceMirrorKlass::cast(mirror->klass()); 467 assert(size == mk->instance_size(real_klass), "should have been set"); 468 469 // notify jvmti and dtrace 470 post_allocation_notify(klass, (oop)obj); 471 472 return mirror; 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 | 465 466 instanceMirrorKlass* mk = instanceMirrorKlass::cast(mirror->klass()); 467 assert(size == mk->instance_size(real_klass), "should have been set"); 468 469 // notify jvmti and dtrace 470 post_allocation_notify(klass, (oop)obj); 471 472 return mirror; 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*)(uintptr_t)MinObjAlignment, "sanity"); 486 void* before_heap = (void*)((uintptr_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) - MinObjAlignment), "sanity"); 492 void* after_heap = (void*)((uintptr_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 |

Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File