< prev index next >

src/hotspot/share/gc/x/xObjArrayAllocator.cpp

Print this page
@@ -71,12 +71,16 @@
    // Segmented clearing
  
    // The array is going to be exposed before it has been completely
    // cleared, therefore we can't expose the header at the end of this
    // function. Instead explicitly initialize it according to our needs.
-   arrayOopDesc::set_mark(mem, markWord::prototype());
-   arrayOopDesc::release_set_klass(mem, _klass);
+   if (UseCompactObjectHeaders) {
+     arrayOopDesc::release_set_mark(mem, _klass->prototype_header());
+   } else {
+     arrayOopDesc::set_mark(mem, markWord::prototype());
+     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 itarator
< prev index next >