< prev index next >

src/hotspot/cpu/aarch64/templateTable_aarch64.cpp

Print this page
@@ -3566,30 +3566,44 @@
        __ b(initialize_header);
      }
  
      // The object is initialized before the header.  If the object size is
      // zero, go directly to the header initialization.
-     __ sub(r3, r3, sizeof(oopDesc));
+     if (UseCompactObjectHeaders) {
+       assert(is_aligned(oopDesc::base_offset_in_bytes(), BytesPerLong), "oop base offset must be 8-byte-aligned");
+       __ sub(r3, r3, oopDesc::base_offset_in_bytes());
+     } else {
+       __ sub(r3, r3, sizeof(oopDesc));
+     }
      __ cbz(r3, initialize_header);
  
      // Initialize object fields
      {
-       __ add(r2, r0, sizeof(oopDesc));
+       if (UseCompactObjectHeaders) {
+         assert(is_aligned(oopDesc::base_offset_in_bytes(), BytesPerLong), "oop base offset must be 8-byte-aligned");
+         __ add(r2, r0, oopDesc::base_offset_in_bytes());
+       } else {
+         __ add(r2, r0, sizeof(oopDesc));
+       }
        Label loop;
        __ bind(loop);
        __ str(zr, Address(__ post(r2, BytesPerLong)));
        __ sub(r3, r3, BytesPerLong);
        __ cbnz(r3, loop);
      }
  
      // initialize object header only.
      __ bind(initialize_header);
-     __ mov(rscratch1, (intptr_t)markWord::prototype().value());
-     __ str(rscratch1, Address(r0, oopDesc::mark_offset_in_bytes()));
-     __ store_klass_gap(r0, zr);  // zero klass gap for compressed oops
-     __ store_klass(r0, r4);      // store klass last
- 
+     if (UseCompactObjectHeaders) {
+       __ ldr(rscratch1, Address(r4, Klass::prototype_header_offset()));
+       __ str(rscratch1, Address(r0, oopDesc::mark_offset_in_bytes()));
+     } else {
+       __ mov(rscratch1, (intptr_t)markWord::prototype().value());
+       __ str(rscratch1, Address(r0, oopDesc::mark_offset_in_bytes()));
+       __ store_klass_gap(r0, zr);  // zero klass gap for compressed oops
+       __ store_klass(r0, r4);      // store klass last
+     }
      {
        SkipIfEqual skip(_masm, &DTraceAllocProbes, false);
        // Trigger dtrace event for fastpath
        __ push(atos); // save the return value
        __ call_VM_leaf(
< prev index next >