< prev index next >

src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp

Print this page
*** 142,34 ***
    }
  }
  
  
  void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register len, Register t1, Register t2) {
-   assert_different_registers(obj, klass, len);
    Register tmp_encode_klass = LP64_ONLY(rscratch1) NOT_LP64(noreg);
!   // This assumes that all prototype bits fit in an int32_t
!   movptr(Address(obj, oopDesc::mark_offset_in_bytes ()), (int32_t)(intptr_t)markWord::prototype().value());
! #ifdef _LP64
!   if (UseCompressedClassPointers) { // Take care not to kill klass
!     movptr(t1, klass);
-     encode_klass_not_null(t1, tmp_encode_klass);
-     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);
    }
- #ifdef _LP64
-   else if (UseCompressedClassPointers) {
-     xorptr(t1, t1);
-     store_klass_gap(obj, t1);
-   }
- #endif
  }
  
  
  // preserves obj, destroys len_in_bytes
  void C1_MacroAssembler::initialize_body(Register obj, Register len_in_bytes, int hdr_size_in_bytes, Register t1) {
--- 142,21 ---
    }
  }
  
  
  void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register len, Register t1, Register t2) {
    Register tmp_encode_klass = LP64_ONLY(rscratch1) NOT_LP64(noreg);
!   assert_different_registers(obj, klass, len, t1, t2);
!   movptr(t1, Address(klass, Klass::prototype_header_offset()));
!   movptr(Address(obj, oopDesc::mark_offset_in_bytes()), t1);
! #ifndef _LP64
!   movptr(Address(obj, oopDesc::klass_offset_in_bytes()), klass);
  #endif
  
    if (len->is_valid()) {
      movl(Address(obj, arrayOopDesc::length_offset_in_bytes()), len);
    }
  }
  
  
  // preserves obj, destroys len_in_bytes
  void C1_MacroAssembler::initialize_body(Register obj, Register len_in_bytes, int hdr_size_in_bytes, Register t1) {

*** 243,11 ***
    }
  
    verify_oop(obj);
  }
  
! void C1_MacroAssembler::allocate_array(Register obj, Register len, Register t1, Register t2, int header_size, Address::ScaleFactor f, Register klass, Label& slow_case) {
    assert(obj == rax, "obj must be in rax, for cmpxchg");
    assert_different_registers(obj, len, t1, t2, klass);
  
    // determine alignment mask
    assert(!(BytesPerWord & 1), "must be a multiple of 2 for masking code to work");
--- 230,11 ---
    }
  
    verify_oop(obj);
  }
  
! void C1_MacroAssembler::allocate_array(Register obj, Register len, Register t1, Register t2, int base_offset_in_bytes, Address::ScaleFactor f, Register klass, Label& slow_case) {
    assert(obj == rax, "obj must be in rax, for cmpxchg");
    assert_different_registers(obj, len, t1, t2, klass);
  
    // determine alignment mask
    assert(!(BytesPerWord & 1), "must be a multiple of 2 for masking code to work");

*** 256,21 ***
    cmpptr(len, (int32_t)max_array_allocation_length);
    jcc(Assembler::above, slow_case);
  
    const Register arr_size = t2; // okay to be the same
    // align object end
!   movptr(arr_size, (int32_t)header_size * BytesPerWord + MinObjAlignmentInBytesMask);
    lea(arr_size, Address(arr_size, len, f));
    andptr(arr_size, ~MinObjAlignmentInBytesMask);
  
    try_allocate(obj, arr_size, 0, t1, t2, slow_case);
  
    initialize_header(obj, klass, len, t1, t2);
  
    // clear rest of allocated space
    const Register len_zero = len;
!   initialize_body(obj, arr_size, header_size * BytesPerWord, len_zero);
  
    if (CURRENT_ENV->dtrace_alloc_probes()) {
      assert(obj == rax, "must be");
      call(RuntimeAddress(Runtime1::entry_for(Runtime1::dtrace_object_alloc_id)));
    }
--- 243,21 ---
    cmpptr(len, (int32_t)max_array_allocation_length);
    jcc(Assembler::above, slow_case);
  
    const Register arr_size = t2; // okay to be the same
    // align object end
!   movptr(arr_size, (int32_t)base_offset_in_bytes + MinObjAlignmentInBytesMask);
    lea(arr_size, Address(arr_size, len, f));
    andptr(arr_size, ~MinObjAlignmentInBytesMask);
  
    try_allocate(obj, arr_size, 0, t1, t2, slow_case);
  
    initialize_header(obj, klass, len, t1, t2);
  
    // clear rest of allocated space
    const Register len_zero = len;
!   initialize_body(obj, arr_size, base_offset_in_bytes, len_zero);
  
    if (CURRENT_ENV->dtrace_alloc_probes()) {
      assert(obj == rax, "must be");
      call(RuntimeAddress(Runtime1::entry_for(Runtime1::dtrace_object_alloc_id)));
    }
< prev index next >