< prev index next >

src/hotspot/share/gc/shared/memAllocator.cpp

Print this page




 409 }
 410 
 411 MemRegion ObjArrayAllocator::obj_memory_range(oop obj) const {
 412   if (_do_zero) {
 413     return MemAllocator::obj_memory_range(obj);
 414   }
 415   ArrayKlass* array_klass = ArrayKlass::cast(_klass);
 416   const size_t hs = arrayOopDesc::header_size(array_klass->element_type());
 417   return MemRegion(((HeapWord*)obj) + hs, _word_size - hs);
 418 }
 419 
 420 oop ObjArrayAllocator::initialize(HeapWord* mem) const {
 421   // Set array length before setting the _klass field because a
 422   // non-NULL klass field indicates that the object is parsable by
 423   // concurrent GC.
 424   assert(_length >= 0, "length should be non-negative");
 425   if (_do_zero) {
 426     mem_clear(mem);
 427   }
 428   arrayOopDesc::set_length(mem, _length);


 429   return finish_with_properties(mem, ArrayKlass::cast(_klass)->storage_properties());
 430 }
 431 
 432 oop ClassAllocator::initialize(HeapWord* mem) const {
 433   // Set oop_size field before setting the _klass field because a
 434   // non-NULL _klass field indicates that the object is parsable by
 435   // concurrent GC.
 436   assert(_word_size > 0, "oop_size must be positive.");
 437   mem_clear(mem);
 438   java_lang_Class::set_oop_size(mem, (int)_word_size);
 439   return finish(mem);
 440 }


 409 }
 410 
 411 MemRegion ObjArrayAllocator::obj_memory_range(oop obj) const {
 412   if (_do_zero) {
 413     return MemAllocator::obj_memory_range(obj);
 414   }
 415   ArrayKlass* array_klass = ArrayKlass::cast(_klass);
 416   const size_t hs = arrayOopDesc::header_size(array_klass->element_type());
 417   return MemRegion(((HeapWord*)obj) + hs, _word_size - hs);
 418 }
 419 
 420 oop ObjArrayAllocator::initialize(HeapWord* mem) const {
 421   // Set array length before setting the _klass field because a
 422   // non-NULL klass field indicates that the object is parsable by
 423   // concurrent GC.
 424   assert(_length >= 0, "length should be non-negative");
 425   if (_do_zero) {
 426     mem_clear(mem);
 427   }
 428   arrayOopDesc::set_length(mem, _length);
 429   assert(ArrayKlass::cast(_klass)->storage_properties().is_empty() ||
 430       ArrayKlass::cast(_klass)->dimension() == 1, "Multidim should have no storage props");
 431   return finish_with_properties(mem, ArrayKlass::cast(_klass)->storage_properties());
 432 }
 433 
 434 oop ClassAllocator::initialize(HeapWord* mem) const {
 435   // Set oop_size field before setting the _klass field because a
 436   // non-NULL _klass field indicates that the object is parsable by
 437   // concurrent GC.
 438   assert(_word_size > 0, "oop_size must be positive.");
 439   mem_clear(mem);
 440   java_lang_Class::set_oop_size(mem, (int)_word_size);
 441   return finish(mem);
 442 }
< prev index next >