< prev index next >

src/hotspot/cpu/aarch64/c1_CodeStubs_aarch64.cpp

Print this page
*** 208,22 ***
    assert(_result->as_register() == r0, "result must in r0");
    __ b(_continuation);
  }
  // Implementation of MonitorAccessStubs
  
! MonitorEnterStub::MonitorEnterStub(LIR_Opr obj_reg, LIR_Opr lock_reg, CodeEmitInfo* info)
! : MonitorAccessStub(obj_reg, lock_reg)
  {
    _info = new CodeEmitInfo(info);
  }
  
  
  void MonitorEnterStub::emit_code(LIR_Assembler* ce) {
    assert(__ rsp_offset() == 0, "frame size should be fixed");
    __ bind(_entry);
!   ce->store_parameter(_obj_reg->as_register(),  1);
-   ce->store_parameter(_lock_reg->as_register(), 0);
    Runtime1::StubID enter_id;
    if (ce->compilation()->has_fpu_code()) {
      enter_id = Runtime1::monitorenter_id;
    } else {
      enter_id = Runtime1::monitorenter_nofpu_id;
--- 208,21 ---
    assert(_result->as_register() == r0, "result must in r0");
    __ b(_continuation);
  }
  // Implementation of MonitorAccessStubs
  
! MonitorEnterStub::MonitorEnterStub(LIR_Opr obj_reg, CodeEmitInfo* info)
! : MonitorAccessStub(obj_reg)
  {
    _info = new CodeEmitInfo(info);
  }
  
  
  void MonitorEnterStub::emit_code(LIR_Assembler* ce) {
    assert(__ rsp_offset() == 0, "frame size should be fixed");
    __ bind(_entry);
!   ce->store_parameter(_obj_reg->as_register(),  0);
    Runtime1::StubID enter_id;
    if (ce->compilation()->has_fpu_code()) {
      enter_id = Runtime1::monitorenter_id;
    } else {
      enter_id = Runtime1::monitorenter_nofpu_id;

*** 235,15 ***
  }
  
  
  void MonitorExitStub::emit_code(LIR_Assembler* ce) {
    __ bind(_entry);
!   if (_compute_lock) {
-     // lock_reg was destroyed by fast unlocking attempt => recompute it
-     ce->monitor_address(_monitor_ix, _lock_reg);
-   }
-   ce->store_parameter(_lock_reg->as_register(), 0);
    // note: non-blocking leaf routine => no call info needed
    Runtime1::StubID exit_id;
    if (ce->compilation()->has_fpu_code()) {
      exit_id = Runtime1::monitorexit_id;
    } else {
--- 234,11 ---
  }
  
  
  void MonitorExitStub::emit_code(LIR_Assembler* ce) {
    __ bind(_entry);
!   ce->store_parameter(_obj_reg->as_register(), 0);
    // note: non-blocking leaf routine => no call info needed
    Runtime1::StubID exit_id;
    if (ce->compilation()->has_fpu_code()) {
      exit_id = Runtime1::monitorexit_id;
    } else {

*** 251,10 ***
--- 246,35 ---
    }
    __ adr(lr, _continuation);
    __ far_jump(RuntimeAddress(Runtime1::entry_for(exit_id)));
  }
  
+ void LoadKlassStub::emit_code(LIR_Assembler* ce) {
+   __ bind(_entry);
+   Register res = _result->as_register();
+   ce->store_parameter(_obj->as_register(), 0);
+   if (res != r0) {
+     // Note: we cannot push/pop r0 around the call, because that
+     // would mess with the stack pointer sp, and we need that to
+     // remain intact for store_paramater/load_argument to work correctly.
+     // We swap r0 and res instead, which preserves current r0 in res.
+     // The preserved value is later saved and restored around the
+     // call in Runtime1::load_klass_id.
+     __ mov(rscratch1, r0);
+     __ mov(r0, res);
+     __ mov(res, rscratch1);
+   }
+   __ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::load_klass_id)));
+   if (res != r0) {
+     // Swap back r0 and res. This brings the call return value
+     // from r0 into res, and the preserved value in res back into r0.
+     __ mov(rscratch1, r0);
+     __ mov(r0, res);
+     __ mov(res, rscratch1);
+   }
+   __ b(_continuation);
+ }
  
  // Implementation of patching:
  // - Copy the code at given offset to an inlined buffer (first the bytes, then the number of bytes)
  // - Replace original code with a call to the stub
  // At Runtime:
< prev index next >