< prev index next >

src/hotspot/share/gc/z/zObjArrayAllocator.cpp

Print this page
@@ -61,12 +61,16 @@
    // cleared, therefore we can't expose the header at the end of this
    // function. Instead explicitly initialize it according to our needs.
  
    // Signal to the ZIterator that this is an invisible root, by setting
    // the mark word to "marked". Reset to prototype() after the clearing.
-   arrayOopDesc::set_mark(mem, markWord::prototype().set_marked());
-   arrayOopDesc::release_set_klass(mem, _klass);
+   if (UseCompactObjectHeaders) {
+     oopDesc::release_set_mark(mem, _klass->prototype_header().set_marked());
+   } else {
+     arrayOopDesc::set_mark(mem, markWord::prototype().set_marked());
+     arrayOopDesc::release_set_klass(mem, _klass);
+   }
    assert(_length >= 0, "length should be non-negative");
    arrayOopDesc::set_length(mem, _length);
  
    // Keep the array alive across safepoints through an invisible
    // root. Invisible roots are not visited by the heap iterator

@@ -148,9 +152,13 @@
    mem_zap_end_padding(mem);
  
    ZThreadLocalData::clear_invisible_root(_thread);
  
    // Signal to the ZIterator that this is no longer an invisible root
-   oopDesc::release_set_mark(mem, markWord::prototype());
+   if (UseCompactObjectHeaders) {
+     oopDesc::release_set_mark(mem, _klass->prototype_header());
+   } else {
+     oopDesc::release_set_mark(mem, markWord::prototype());
+   }
  
    return cast_to_oop(mem);
  }
< prev index next >