< prev index next >

src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp

Print this page
@@ -2586,22 +2586,31 @@
  }
  
  void LIR_Assembler::emit_load_klass(LIR_OpLoadKlass* op) {
    Register obj = op->obj()->as_pointer_register();
    Register result = op->result_opr()->as_pointer_register();
+   Register tmp = rscratch1;
  
    CodeEmitInfo* info = op->info();
    if (info != NULL) {
      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()));
-   }
+   assert(UseCompressedClassPointers, "expects UseCompressedClassPointers");
+ 
+   // Check if we can take the (common) fast path, if obj is unlocked.
+   __ ldr(tmp, Address(obj, oopDesc::mark_offset_in_bytes()));
+   __ eor(tmp, tmp, markWord::unlocked_value);
+   __ tst(tmp, markWord::lock_mask_in_place);
+   __ br(Assembler::NE, *op->stub()->entry());
+ 
+   // Fast-path: shift and decode Klass*.
+   __ mov(result, tmp);
+   __ lsr(result, result, markWord::klass_shift);
+   __ decode_klass_not_null(result);
+ 
+   __ bind(*op->stub()->continuation());
  }
  
  void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) {
    ciMethod* method = op->profiled_method();
    int bci          = op->profiled_bci();
< prev index next >