< prev index next >

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

Print this page

        

@@ -373,16 +373,17 @@
     }
   }
   return obj;
 }
 
-void MemAllocator::mem_clear(HeapWord* mem) const {
+HeapWord* MemAllocator::mem_clear(HeapWord* mem) const {
   assert(mem != NULL, "cannot initialize NULL object");
   const size_t hs = oopDesc::header_size();
   assert(_word_size >= hs, "unexpected object size");
   oopDesc::set_klass_gap(mem, 0);
   Copy::fill_to_aligned_words(mem + hs, _word_size - hs);
+  return mem;
 }
 
 oop MemAllocator::finish(HeapWord* mem) const {
   assert(mem != NULL, "NULL object pointer");
   if (UseBiasedLocking) {

@@ -397,11 +398,11 @@
   oopDesc::release_set_klass(mem, _klass);
   return oop(mem);
 }
 
 oop ObjAllocator::initialize(HeapWord* mem) const {
-  mem_clear(mem);
+  mem = mem_clear(mem);
   return finish(mem);
 }
 
 MemRegion ObjArrayAllocator::obj_memory_range(oop obj) const {
   if (_do_zero) {

@@ -416,20 +417,20 @@
   // Set array length before setting the _klass field because a
   // non-NULL klass field indicates that the object is parsable by
   // concurrent GC.
   assert(_length >= 0, "length should be non-negative");
   if (_do_zero) {
-    mem_clear(mem);
+    mem = mem_clear(mem);
   }
   arrayOopDesc::set_length(mem, _length);
   return finish(mem);
 }
 
 oop ClassAllocator::initialize(HeapWord* mem) const {
   // Set oop_size field before setting the _klass field because a
   // non-NULL _klass field indicates that the object is parsable by
   // concurrent GC.
   assert(_word_size > 0, "oop_size must be positive.");
-  mem_clear(mem);
+  mem = mem_clear(mem);
   java_lang_Class::set_oop_size(mem, (int)_word_size);
   return finish(mem);
 }
< prev index next >