< prev index next >

src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp

Print this page
*** 39,10 ***
--- 39,11 ---
  #include "runtime/os.hpp"
  #include "runtime/sharedRuntime.hpp"
  #include "runtime/stubRoutines.hpp"
  #include "utilities/checkedCast.hpp"
  #include "utilities/globalDefinitions.hpp"
+ #include "utilities/macros.hpp"
  
  int C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr, Register tmp, Label& slow_case) {
    const int aligned_mask = BytesPerWord -1;
    const int hdr_offset = oopDesc::mark_offset_in_bytes();
    assert(hdr == rax, "hdr must be rax, for the cmpxchg instruction");

*** 64,15 ***
    }
  
    if (LockingMode == LM_LIGHTWEIGHT) {
  #ifdef _LP64
      const Register thread = r15_thread;
  #else
!     const Register thread = disp_hdr;
!     get_thread(thread);
  #endif
-     lightweight_lock(obj, hdr, thread, tmp, slow_case);
    } else  if (LockingMode == LM_LEGACY) {
      Label done;
      // Load object header
      movptr(hdr, Address(obj, hdr_offset));
      // and mark it as unlocked
--- 65,17 ---
    }
  
    if (LockingMode == LM_LIGHTWEIGHT) {
  #ifdef _LP64
      const Register thread = r15_thread;
+     lightweight_lock(disp_hdr, obj, hdr, thread, tmp, slow_case);
  #else
!     // Implicit null check.
!     movptr(hdr, Address(obj, oopDesc::mark_offset_in_bytes()));
+     // Lacking registers and thread on x86_32. Always take slow path.
+     jmp(slow_case);
  #endif
    } else  if (LockingMode == LM_LEGACY) {
      Label done;
      // Load object header
      movptr(hdr, Address(obj, hdr_offset));
      // and mark it as unlocked

*** 169,20 ***
    }
  }
  
  
  void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register len, Register t1, Register t2) {
!   assert_different_registers(obj, klass, len);
-   movptr(Address(obj, oopDesc::mark_offset_in_bytes()), checked_cast<int32_t>(markWord::prototype().value()));
  #ifdef _LP64
!   if (UseCompressedClassPointers) { // Take care not to kill klass
      movptr(t1, klass);
      encode_klass_not_null(t1, rscratch1);
      movl(Address(obj, oopDesc::klass_offset_in_bytes()), t1);
    } else
  #endif
    {
      movptr(Address(obj, oopDesc::klass_offset_in_bytes()), klass);
    }
  
    if (len->is_valid()) {
      movl(Address(obj, arrayOopDesc::length_offset_in_bytes()), len);
--- 172,24 ---
    }
  }
  
  
  void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register len, Register t1, Register t2) {
!   assert_different_registers(obj, klass, len, t1, t2);
  #ifdef _LP64
!   if (UseCompactObjectHeaders) {
+     movptr(t1, Address(klass, Klass::prototype_header_offset()));
+     movptr(Address(obj, oopDesc::mark_offset_in_bytes()), t1);
+   } else if (UseCompressedClassPointers) { // Take care not to kill klass
+     movptr(Address(obj, oopDesc::mark_offset_in_bytes()), checked_cast<int32_t>(markWord::prototype().value()));
      movptr(t1, klass);
      encode_klass_not_null(t1, rscratch1);
      movl(Address(obj, oopDesc::klass_offset_in_bytes()), t1);
    } else
  #endif
    {
+     movptr(Address(obj, oopDesc::mark_offset_in_bytes()), checked_cast<int32_t>(markWord::prototype().value()));
      movptr(Address(obj, oopDesc::klass_offset_in_bytes()), klass);
    }
  
    if (len->is_valid()) {
      movl(Address(obj, arrayOopDesc::length_offset_in_bytes()), len);

*** 195,11 ***
        movl(Address(obj, base_offset), t1);
      }
  #endif
    }
  #ifdef _LP64
!   else if (UseCompressedClassPointers) {
      xorptr(t1, t1);
      store_klass_gap(obj, t1);
    }
  #endif
  }
--- 202,11 ---
        movl(Address(obj, base_offset), t1);
      }
  #endif
    }
  #ifdef _LP64
!   else if (UseCompressedClassPointers && !UseCompactObjectHeaders) {
      xorptr(t1, t1);
      store_klass_gap(obj, t1);
    }
  #endif
  }

*** 229,11 ***
  
  void C1_MacroAssembler::initialize_object(Register obj, Register klass, Register var_size_in_bytes, int con_size_in_bytes, Register t1, Register t2, bool is_tlab_allocated) {
    assert((con_size_in_bytes & MinObjAlignmentInBytesMask) == 0,
           "con_size_in_bytes is not multiple of alignment");
    const int hdr_size_in_bytes = instanceOopDesc::header_size() * HeapWordSize;
! 
    initialize_header(obj, klass, noreg, t1, t2);
  
    if (!(UseTLAB && ZeroTLAB && is_tlab_allocated)) {
      // clear rest of allocated space
      const Register t1_zero = t1;
--- 236,13 ---
  
  void C1_MacroAssembler::initialize_object(Register obj, Register klass, Register var_size_in_bytes, int con_size_in_bytes, Register t1, Register t2, bool is_tlab_allocated) {
    assert((con_size_in_bytes & MinObjAlignmentInBytesMask) == 0,
           "con_size_in_bytes is not multiple of alignment");
    const int hdr_size_in_bytes = instanceOopDesc::header_size() * HeapWordSize;
!   if (UseCompactObjectHeaders) {
+     assert(hdr_size_in_bytes == 8, "check object headers size");
+   }
    initialize_header(obj, klass, noreg, t1, t2);
  
    if (!(UseTLAB && ZeroTLAB && is_tlab_allocated)) {
      // clear rest of allocated space
      const Register t1_zero = t1;
< prev index next >