< prev index next >

src/share/vm/gc/shared/collectedHeap.cpp

Print this page




 302   if (obj == NULL) {
 303     return NULL;
 304   }
 305 
 306   AllocTracer::send_allocation_in_new_tlab_event(klass, new_tlab_size * HeapWordSize, size * HeapWordSize);
 307 
 308   if (ZeroTLAB) {
 309     // ..and clear it.
 310     Copy::zero_to_words(obj, new_tlab_size);
 311   } else {
 312     // ...and zap just allocated object.
 313 #ifdef ASSERT
 314     // Skip mangling the space corresponding to the object header to
 315     // ensure that the returned space is not considered parsable by
 316     // any concurrent GC thread.
 317     size_t hdr_size = oopDesc::header_size();
 318     Copy::fill_to_words(obj + hdr_size, new_tlab_size - hdr_size, badHeapWordVal);
 319 #endif // ASSERT
 320   }
 321   thread->tlab().fill(obj, obj + size, new_tlab_size);
 322   return obj;
 323 }
 324 
 325 void CollectedHeap::flush_deferred_store_barrier(JavaThread* thread) {
 326   MemRegion deferred = thread->deferred_card_mark();
 327   if (!deferred.is_empty()) {
 328     assert(_defer_initial_card_mark, "Otherwise should be empty");
 329     {
 330       // Verify that the storage points to a parsable object in heap
 331       DEBUG_ONLY(oop old_obj = oop(deferred.start());)
 332       assert(is_in(old_obj), "Not in allocated heap");
 333       assert(!can_elide_initializing_store_barrier(old_obj),
 334              "Else should have been filtered in new_store_pre_barrier()");
 335       assert(old_obj->is_oop(true), "Not an oop");
 336       assert(deferred.word_size() == (size_t)(old_obj->size()),
 337              "Mismatch: multiple objects?");
 338     }
 339     BarrierSet* bs = barrier_set();
 340     assert(bs->has_write_region_opt(), "No write_region() on BarrierSet");
 341     bs->write_region(deferred);
 342     // "Clear" the deferred_card_mark field


 612   CollectedHeap* heap = Universe::heap();
 613 
 614   uintptr_t epsilon    = (uintptr_t) MinObjAlignment;
 615   uintptr_t heap_start = (uintptr_t) heap->_reserved.start();
 616   uintptr_t heap_end   = (uintptr_t) heap->_reserved.end();
 617 
 618   // Test that NULL is not in the heap.
 619   assert(!heap->is_in(NULL), "NULL is unexpectedly in the heap");
 620 
 621   // Test that a pointer to before the heap start is reported as outside the heap.
 622   assert(heap_start >= ((uintptr_t)NULL + epsilon), "sanity");
 623   void* before_heap = (void*)(heap_start - epsilon);
 624   assert(!heap->is_in(before_heap),
 625       err_msg("before_heap: " PTR_FORMAT " is unexpectedly in the heap", p2i(before_heap)));
 626 
 627   // Test that a pointer to after the heap end is reported as outside the heap.
 628   assert(heap_end <= ((uintptr_t)-1 - epsilon), "sanity");
 629   void* after_heap = (void*)(heap_end + epsilon);
 630   assert(!heap->is_in(after_heap),
 631       err_msg("after_heap: " PTR_FORMAT " is unexpectedly in the heap", p2i(after_heap)));























 632 }
 633 #endif


 302   if (obj == NULL) {
 303     return NULL;
 304   }
 305 
 306   AllocTracer::send_allocation_in_new_tlab_event(klass, new_tlab_size * HeapWordSize, size * HeapWordSize);
 307 
 308   if (ZeroTLAB) {
 309     // ..and clear it.
 310     Copy::zero_to_words(obj, new_tlab_size);
 311   } else {
 312     // ...and zap just allocated object.
 313 #ifdef ASSERT
 314     // Skip mangling the space corresponding to the object header to
 315     // ensure that the returned space is not considered parsable by
 316     // any concurrent GC thread.
 317     size_t hdr_size = oopDesc::header_size();
 318     Copy::fill_to_words(obj + hdr_size, new_tlab_size - hdr_size, badHeapWordVal);
 319 #endif // ASSERT
 320   }
 321   thread->tlab().fill(obj, obj + size, new_tlab_size);
 322   return Universe::heap()->tlab_post_allocation_setup(obj);
 323 }
 324 
 325 void CollectedHeap::flush_deferred_store_barrier(JavaThread* thread) {
 326   MemRegion deferred = thread->deferred_card_mark();
 327   if (!deferred.is_empty()) {
 328     assert(_defer_initial_card_mark, "Otherwise should be empty");
 329     {
 330       // Verify that the storage points to a parsable object in heap
 331       DEBUG_ONLY(oop old_obj = oop(deferred.start());)
 332       assert(is_in(old_obj), "Not in allocated heap");
 333       assert(!can_elide_initializing_store_barrier(old_obj),
 334              "Else should have been filtered in new_store_pre_barrier()");
 335       assert(old_obj->is_oop(true), "Not an oop");
 336       assert(deferred.word_size() == (size_t)(old_obj->size()),
 337              "Mismatch: multiple objects?");
 338     }
 339     BarrierSet* bs = barrier_set();
 340     assert(bs->has_write_region_opt(), "No write_region() on BarrierSet");
 341     bs->write_region(deferred);
 342     // "Clear" the deferred_card_mark field


 612   CollectedHeap* heap = Universe::heap();
 613 
 614   uintptr_t epsilon    = (uintptr_t) MinObjAlignment;
 615   uintptr_t heap_start = (uintptr_t) heap->_reserved.start();
 616   uintptr_t heap_end   = (uintptr_t) heap->_reserved.end();
 617 
 618   // Test that NULL is not in the heap.
 619   assert(!heap->is_in(NULL), "NULL is unexpectedly in the heap");
 620 
 621   // Test that a pointer to before the heap start is reported as outside the heap.
 622   assert(heap_start >= ((uintptr_t)NULL + epsilon), "sanity");
 623   void* before_heap = (void*)(heap_start - epsilon);
 624   assert(!heap->is_in(before_heap),
 625       err_msg("before_heap: " PTR_FORMAT " is unexpectedly in the heap", p2i(before_heap)));
 626 
 627   // Test that a pointer to after the heap end is reported as outside the heap.
 628   assert(heap_end <= ((uintptr_t)-1 - epsilon), "sanity");
 629   void* after_heap = (void*)(heap_end + epsilon);
 630   assert(!heap->is_in(after_heap),
 631       err_msg("after_heap: " PTR_FORMAT " is unexpectedly in the heap", p2i(after_heap)));
 632 }
 633 #endif
 634 
 635 HeapWord* CollectedHeap::tlab_post_allocation_setup(HeapWord* obj) {
 636   return obj;
 637 }
 638 
 639 uint CollectedHeap::oop_extra_words() {
 640   // Default implementation doesn't need extra space for oops.
 641   return 0;
 642 }
 643 
 644 void CollectedHeap::shutdown() {
 645   // Default implementation does nothing.
 646 }
 647 
 648 void CollectedHeap::accumulate_statistics_all_gclabs() {
 649   // Default implementation does nothing.
 650 }
 651 
 652 #ifndef CC_INTERP
 653 void CollectedHeap::compile_prepare_oop(MacroAssembler* masm, Register obj) {
 654   // Default implementation does nothing.
 655 }
 656 #endif
< prev index next >