< prev index next >

src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp

Print this page
@@ -2244,12 +2244,10 @@
    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());
    }

@@ -2306,19 +2304,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
-       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);
-       }
+       __ 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;

@@ -2436,40 +2426,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 (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);
-       }
+       __ cmp_klass(dst, 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);
-       }
+       __ cmp_klass(src, 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);
-       }
+       __ cmp_klass(dst, tmp, rscratch1);
        __ br(Assembler::EQ, known_ok);
        __ cmp(src, dst);
        __ br(Assembler::EQ, known_ok);
      }
      __ bind(halt);

@@ -2549,11 +2517,16 @@
    if (info != nullptr) {
      add_debug_info_for_null_check_here(info);
    }
  
    if (UseCompressedClassPointers) {
-     __ ldrw(result, Address (obj, oopDesc::klass_offset_in_bytes()));
+     if (UseCompactObjectHeaders) {
+       __ ldr(result, Address(obj, oopDesc::mark_offset_in_bytes()));
+       __ 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 >