< prev index next >

src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp

Print this page
*** 3046,10 ***
--- 3046,11 ---
    Register src_pos = op->src_pos()->as_register();
    Register dst_pos = op->dst_pos()->as_register();
    Register length  = op->length()->as_register();
    Register tmp = op->tmp()->as_register();
    Register tmp_load_klass = LP64_ONLY(rscratch1) NOT_LP64(noreg);
+   Register tmp2 = UseCompactObjectHeaders ? rscratch2 : noreg;
  
    CodeStub* stub = op->stub();
    int flags = op->flags();
    BasicType basic_type = default_type != nullptr ? default_type->element_type()->basic_type() : T_ILLEGAL;
    if (is_reference_type(basic_type)) basic_type = T_OBJECT;

*** 3170,12 ***
        ShouldNotReachHere();
    }
  
    Address src_length_addr = Address(src, arrayOopDesc::length_offset_in_bytes());
    Address dst_length_addr = Address(dst, arrayOopDesc::length_offset_in_bytes());
-   Address src_klass_addr = Address(src, oopDesc::klass_offset_in_bytes());
-   Address dst_klass_addr = Address(dst, oopDesc::klass_offset_in_bytes());
  
    // length and pos's are all sign extended at this point on 64bit
  
    // test for null
    if (flags & LIR_OpArrayCopy::src_null_check) {
--- 3171,10 ---

*** 3237,17 ***
  
    if (flags & LIR_OpArrayCopy::type_check) {
      // We don't know the array types are compatible
      if (basic_type != T_OBJECT) {
        // Simple test for basic type arrays
!       if (UseCompressedClassPointers) {
-         __ movl(tmp, src_klass_addr);
-         __ cmpl(tmp, dst_klass_addr);
-       } else {
-         __ movptr(tmp, src_klass_addr);
-         __ cmpptr(tmp, dst_klass_addr);
-       }
        __ jcc(Assembler::notEqual, *stub->entry());
      } else {
        // For object arrays, if src is a sub class of dst then we can
        // safely do the copy.
        Label cont, slow;
--- 3236,11 ---
  
    if (flags & LIR_OpArrayCopy::type_check) {
      // We don't know the array types are compatible
      if (basic_type != T_OBJECT) {
        // Simple test for basic type arrays
!       __ cmp_klass(src, dst, tmp, tmp2);
        __ jcc(Assembler::notEqual, *stub->entry());
      } else {
        // For object arrays, if src is a sub class of dst then we can
        // safely do the copy.
        Label cont, slow;

*** 3302,10 ***
--- 3295,11 ---
         store_parameter(length, 2);
         store_parameter(src_pos, 3);
         store_parameter(src, 4);
  
  #ifndef _LP64
+        Address dst_klass_addr = Address(dst, oopDesc::klass_offset_in_bytes());
          __ movptr(tmp, dst_klass_addr);
          __ movptr(tmp, Address(tmp, ObjArrayKlass::element_klass_offset()));
          __ push(tmp);
          __ movl(tmp, Address(tmp, Klass::super_check_offset_offset()));
          __ push(tmp);

*** 3405,20 ***
        __ encode_klass_not_null(tmp, rscratch1);
      }
  #endif
  
      if (basic_type != T_OBJECT) {
! 
-       if (UseCompressedClassPointers)          __ cmpl(tmp, dst_klass_addr);
-       else                   __ cmpptr(tmp, dst_klass_addr);
        __ jcc(Assembler::notEqual, halt);
!       if (UseCompressedClassPointers)          __ cmpl(tmp, src_klass_addr);
-       else                   __ cmpptr(tmp, src_klass_addr);
        __ jcc(Assembler::equal, known_ok);
      } else {
!       if (UseCompressedClassPointers)          __ cmpl(tmp, dst_klass_addr);
-       else                   __ cmpptr(tmp, dst_klass_addr);
        __ jcc(Assembler::equal, known_ok);
        __ cmpptr(src, dst);
        __ jcc(Assembler::equal, known_ok);
      }
      __ bind(halt);
--- 3399,16 ---
        __ encode_klass_not_null(tmp, rscratch1);
      }
  #endif
  
      if (basic_type != T_OBJECT) {
!       __ cmp_klass(tmp, dst, tmp2);
        __ jcc(Assembler::notEqual, halt);
!       __ cmp_klass(tmp, src, tmp2);
        __ jcc(Assembler::equal, known_ok);
      } else {
!       __ cmp_klass(tmp, dst, tmp2);
        __ jcc(Assembler::equal, known_ok);
        __ cmpptr(src, dst);
        __ jcc(Assembler::equal, known_ok);
      }
      __ bind(halt);

*** 3512,16 ***
    if (info != nullptr) {
      add_debug_info_for_null_check_here(info);
    }
  
  #ifdef _LP64
!   if (UseCompressedClassPointers) {
      __ movl(result, Address(obj, oopDesc::klass_offset_in_bytes()));
      __ decode_klass_not_null(result, rscratch1);
    } else
  #endif
      __ movptr(result, Address(obj, oopDesc::klass_offset_in_bytes()));
  }
  
  void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) {
    ciMethod* method = op->profiled_method();
    int bci          = op->profiled_bci();
--- 3502,26 ---
    if (info != nullptr) {
      add_debug_info_for_null_check_here(info);
    }
  
  #ifdef _LP64
!   if (UseCompactObjectHeaders) {
+     Register tmp = rscratch1;
+     assert_different_registers(tmp, obj);
+     assert_different_registers(tmp, result);
+ 
+     __ movq(result, Address(obj, oopDesc::mark_offset_in_bytes()));
+     __ shrq(result, markWord::klass_shift);
+     __ decode_klass_not_null(result, tmp);
+   } else if (UseCompressedClassPointers) {
      __ movl(result, Address(obj, oopDesc::klass_offset_in_bytes()));
      __ decode_klass_not_null(result, rscratch1);
    } else
  #endif
+   {
      __ movptr(result, Address(obj, oopDesc::klass_offset_in_bytes()));
+   }
  }
  
  void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) {
    ciMethod* method = op->profiled_method();
    int bci          = op->profiled_bci();
< prev index next >