< prev index next >

src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp

Print this page
@@ -79,11 +79,11 @@
      tstw(hdr, JVM_ACC_IS_VALUE_BASED_CLASS);
      br(Assembler::NE, slow_case);
    }
  
    if (LockingMode == LM_LIGHTWEIGHT) {
-     lightweight_lock(obj, hdr, temp, rscratch2, slow_case);
+     lightweight_lock(disp_hdr, obj, hdr, temp, rscratch2, slow_case);
    } else if (LockingMode == LM_LEGACY) {
      Label done;
      // Load object header
      ldr(hdr, Address(obj, hdr_offset));
      // and mark it as unlocked

@@ -173,30 +173,34 @@
    }
  }
  
  void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register len, Register t1, Register t2) {
    assert_different_registers(obj, klass, len);
-   // This assumes that all prototype bits fit in an int32_t
-   mov(t1, (int32_t)(intptr_t)markWord::prototype().value());
-   str(t1, Address(obj, oopDesc::mark_offset_in_bytes()));
  
-   if (UseCompressedClassPointers) { // Take care not to kill klass
-     encode_klass_not_null(t1, klass);
-     strw(t1, Address(obj, oopDesc::klass_offset_in_bytes()));
+   if (UseCompactObjectHeaders) {
+     ldr(t1, Address(klass, Klass::prototype_header_offset()));
+     str(t1, Address(obj, oopDesc::mark_offset_in_bytes()));
    } else {
-     str(klass, Address(obj, oopDesc::klass_offset_in_bytes()));
+     // This assumes that all prototype bits fit in an int32_t
+     mov(t1, (int32_t)(intptr_t)markWord::prototype().value());
+     str(t1, Address(obj, oopDesc::mark_offset_in_bytes()));
+     if (UseCompressedClassPointers) { // Take care not to kill klass
+       encode_klass_not_null(t1, klass);
+       strw(t1, Address(obj, oopDesc::klass_offset_in_bytes()));
+     } else {
+       str(klass, Address(obj, oopDesc::klass_offset_in_bytes()));
+     }
    }
- 
    if (len->is_valid()) {
      strw(len, Address(obj, arrayOopDesc::length_offset_in_bytes()));
      int base_offset = arrayOopDesc::length_offset_in_bytes() + BytesPerInt;
      if (!is_aligned(base_offset, BytesPerWord)) {
        assert(is_aligned(base_offset, BytesPerInt), "must be 4-byte aligned");
        // Clear gap/first 4 bytes following the length field.
        strw(zr, Address(obj, base_offset));
      }
-   } else if (UseCompressedClassPointers) {
+   } else if (UseCompressedClassPointers && !UseCompactObjectHeaders) {
      store_klass_gap(obj, zr);
    }
  }
  
  // preserves obj, destroys len_in_bytes
< prev index next >