< prev index next >

src/hotspot/cpu/x86/templateTable_x86.cpp

Print this page
@@ -4083,11 +4083,16 @@
        __ jmp(initialize_header);
      }
  
      // The object is initialized before the header.  If the object size is
      // zero, go directly to the header initialization.
-     __ decrement(rdx, sizeof(oopDesc));
+     if (UseCompactObjectHeaders) {
+       assert(is_aligned(oopDesc::base_offset_in_bytes(), BytesPerLong), "oop base offset must be 8-byte-aligned");
+       __ decrement(rdx, oopDesc::base_offset_in_bytes());
+     } else {
+       __ decrement(rdx, sizeof(oopDesc));
+     }
      __ jcc(Assembler::zero, initialize_header);
  
      // Initialize topmost object field, divide rdx by 8, check if odd and
      // test if zero.
      __ xorl(rcx, rcx);    // use zero reg to clear memory (shorter code)

@@ -4105,26 +4110,39 @@
  #endif
  
      // initialize remaining object fields: rdx was a multiple of 8
      { Label loop;
      __ bind(loop);
-     __ movptr(Address(rax, rdx, Address::times_8, sizeof(oopDesc) - 1*oopSize), rcx);
-     NOT_LP64(__ movptr(Address(rax, rdx, Address::times_8, sizeof(oopDesc) - 2*oopSize), rcx));
+     if (UseCompactObjectHeaders) {
+       assert(is_aligned(oopDesc::base_offset_in_bytes(), BytesPerLong), "oop base offset must be 8-byte-aligned");
+       int header_size = oopDesc::base_offset_in_bytes();
+       __ movptr(Address(rax, rdx, Address::times_8, header_size - 1*oopSize), rcx);
+       NOT_LP64(__ movptr(Address(rax, rdx, Address::times_8, header_size - 2*oopSize), rcx));
+     } else {
+       __ movptr(Address(rax, rdx, Address::times_8, sizeof(oopDesc) - 1*oopSize), rcx);
+       NOT_LP64(__ movptr(Address(rax, rdx, Address::times_8, sizeof(oopDesc) - 2*oopSize), rcx));
+     }
      __ decrement(rdx);
      __ jcc(Assembler::notZero, loop);
      }
  
      // initialize object header only.
      __ bind(initialize_header);
-     __ movptr(Address(rax, oopDesc::mark_offset_in_bytes()),
-               (intptr_t)markWord::prototype().value()); // header
-     __ pop(rcx);   // get saved klass back in the register.
+     if (UseCompactObjectHeaders) {
+       __ pop(rcx);   // get saved klass back in the register.
+       __ movptr(rbx, Address(rcx, Klass::prototype_header_offset()));
+       __ movptr(Address(rax, oopDesc::mark_offset_in_bytes ()), rbx);
+     } else {
+       __ movptr(Address(rax, oopDesc::mark_offset_in_bytes()),
+                 (intptr_t)markWord::prototype().value()); // header
+       __ pop(rcx);   // get saved klass back in the register.
  #ifdef _LP64
-     __ xorl(rsi, rsi); // use zero reg to clear memory (shorter code)
-     __ store_klass_gap(rax, rsi);  // zero klass gap for compressed oops
+       __ xorl(rsi, rsi); // use zero reg to clear memory (shorter code)
+       __ store_klass_gap(rax, rsi);  // zero klass gap for compressed oops
  #endif
-     __ store_klass(rax, rcx, rscratch1);  // klass
+       __ store_klass(rax, rcx, rscratch1);  // klass
+     }
  
      {
        SkipIfEqual skip_if(_masm, &DTraceAllocProbes, 0, rscratch1);
        // Trigger dtrace event for fastpath
        __ push(atos);
< prev index next >