< prev index next >

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Array.java

Print this page
*** 102,10 ***
--- 102,17 ---
      // We have to fetch the length of the array, shift (multiply) it
      // appropriately, up to wordSize, add the header, and align to
      // object size.
      long s = getLength() << klass.getLog2ElementSize();
      s += klass.getArrayHeaderInBytes();
+     if (VM.getVM().isCompactObjectHeadersEnabled()) {
+       Mark mark = getMark();
+       if (mark.isExpanded()) {
+         // Needs extra 4 bytes for identity hash-code.
+         s += 4;
+       }
+     }
      s = Oop.alignObjectSize(s);
      return s;
    }
  
    public static long baseOffsetInBytes(BasicType type) {
< prev index next >