< prev index next >

src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp

Print this page
*** 1228,11 ***
      }
      __ allocate_array(op->obj()->as_register(),
                        len,
                        tmp1,
                        tmp2,
!                       arrayOopDesc::header_size(op->type()),
                        array_element_size(op->type()),
                        op->klass()->as_register(),
                        *op->stub()->entry());
    }
    __ bind(*op->stub()->continuation());
--- 1228,11 ---
      }
      __ allocate_array(op->obj()->as_register(),
                        len,
                        tmp1,
                        tmp2,
!                       arrayOopDesc::base_offset_in_bytes(op->type()),
                        array_element_size(op->type()),
                        op->klass()->as_register(),
                        *op->stub()->entry());
    }
    __ bind(*op->stub()->continuation());

*** 2288,12 ***
    int elem_size = type2aelembytes(basic_type);
    int scale = exact_log2(elem_size);
  
    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());
  
    // test for null
    if (flags & LIR_OpArrayCopy::src_null_check) {
      __ cbz(src, *stub->entry());
    }
--- 2288,10 ---

*** 2350,19 ***
  
    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) {
-         __ ldrw(tmp, src_klass_addr);
-         __ ldrw(rscratch1, dst_klass_addr);
-         __ cmpw(tmp, rscratch1);
-       } else {
-         __ ldr(tmp, src_klass_addr);
-         __ ldr(rscratch1, dst_klass_addr);
-         __ cmp(tmp, rscratch1);
-       }
        __ br(Assembler::NE, *stub->entry());
      } else {
        // For object arrays, if src is a sub class of dst then we can
        // safely do the copy.
        Label cont, slow;
--- 2348,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, rscratch1);
        __ br(Assembler::NE, *stub->entry());
      } else {
        // For object arrays, if src is a sub class of dst then we can
        // safely do the copy.
        Label cont, slow;

*** 2480,40 ***
      // dst type is exactly the expected type and the src type is a
      // subtype which we can't check or src is the same array as dst
      // but not necessarily exactly of type default_type.
      Label known_ok, halt;
      __ mov_metadata(tmp, default_type->constant_encoding());
-     if (UseCompressedClassPointers) {
-       __ encode_klass_not_null(tmp);
-     }
  
      if (basic_type != T_OBJECT) {
! 
-       if (UseCompressedClassPointers) {
-         __ ldrw(rscratch1, dst_klass_addr);
-         __ cmpw(tmp, rscratch1);
-       } else {
-         __ ldr(rscratch1, dst_klass_addr);
-         __ cmp(tmp, rscratch1);
-       }
        __ br(Assembler::NE, halt);
!       if (UseCompressedClassPointers) {
-         __ ldrw(rscratch1, src_klass_addr);
-         __ cmpw(tmp, rscratch1);
-       } else {
-         __ ldr(rscratch1, src_klass_addr);
-         __ cmp(tmp, rscratch1);
-       }
        __ br(Assembler::EQ, known_ok);
      } else {
!       if (UseCompressedClassPointers) {
-         __ ldrw(rscratch1, dst_klass_addr);
-         __ cmpw(tmp, rscratch1);
-       } else {
-         __ ldr(rscratch1, dst_klass_addr);
-         __ cmp(tmp, rscratch1);
-       }
        __ br(Assembler::EQ, known_ok);
        __ cmp(src, dst);
        __ br(Assembler::EQ, known_ok);
      }
      __ bind(halt);
--- 2470,18 ---
      // dst type is exactly the expected type and the src type is a
      // subtype which we can't check or src is the same array as dst
      // but not necessarily exactly of type default_type.
      Label known_ok, halt;
      __ mov_metadata(tmp, default_type->constant_encoding());
  
      if (basic_type != T_OBJECT) {
!       __ cmp_klass(dst, tmp, rscratch1);
        __ br(Assembler::NE, halt);
!       __ cmp_klass(src, tmp, rscratch1);
        __ br(Assembler::EQ, known_ok);
      } else {
!       __ cmp_klass(dst, tmp, rscratch1);
        __ br(Assembler::EQ, known_ok);
        __ cmp(src, dst);
        __ br(Assembler::EQ, known_ok);
      }
      __ bind(halt);

*** 2591,11 ***
    if (info != nullptr) {
      add_debug_info_for_null_check_here(info);
    }
  
    if (UseCompressedClassPointers) {
!     __ ldrw(result, Address (obj, oopDesc::klass_offset_in_bytes()));
      __ decode_klass_not_null(result);
    } else {
      __ ldr(result, Address (obj, oopDesc::klass_offset_in_bytes()));
    }
  }
--- 2559,22 ---
    if (info != nullptr) {
      add_debug_info_for_null_check_here(info);
    }
  
    if (UseCompressedClassPointers) {
!     if (UseCompactObjectHeaders) {
+       // Check if we can take the (common) fast path, if obj is unlocked.
+       __ ldr(result, Address(obj, oopDesc::mark_offset_in_bytes()));
+       __ tst(result, markWord::monitor_value);
+       __ br(Assembler::NE, *op->stub()->entry());
+       __ bind(*op->stub()->continuation());
+ 
+       // Shift to get proper narrow Klass*.
+       __ lsr(result, result, markWord::klass_shift);
+     } else {
+       __ ldrw(result, Address (obj, oopDesc::klass_offset_in_bytes()));
+     }
      __ decode_klass_not_null(result);
    } else {
      __ ldr(result, Address (obj, oopDesc::klass_offset_in_bytes()));
    }
  }
< prev index next >