< prev index next >

src/hotspot/cpu/x86/interp_masm_x86.cpp

Print this page
*** 1157,13 ***
--- 1157,15 ---
  void InterpreterMacroAssembler::lock_object(Register lock_reg) {
    assert(lock_reg == LP64_ONLY(c_rarg1) NOT_LP64(rdx),
           "The argument is only for looks. It must be c_rarg1");
  
    if (LockingMode == LM_MONITOR) {
+     push_cont_fastpath();
      call_VM(noreg,
              CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter),
              lock_reg);
+     pop_cont_fastpath();
    } else {
      Label count_locking, done, slow_case;
  
      const Register swap_reg = rax; // Must use rax for cmpxchg instruction
      const Register tmp_reg = rbx;

*** 1243,28 ***
        andptr(swap_reg, zero_bits - (int)os::vm_page_size());
  
        // Save the test result, for recursive case, the result is zero
        movptr(Address(lock_reg, mark_offset), swap_reg);
        jcc(Assembler::notZero, slow_case);
- 
-       bind(count_locking);
      }
      inc_held_monitor_count();
      jmp(done);
  
      bind(slow_case);
  
      // Call the runtime routine for slow case
      if (LockingMode == LM_LIGHTWEIGHT) {
        call_VM(noreg,
                CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter_obj),
                obj_reg);
      } else {
        call_VM(noreg,
                CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter),
                lock_reg);
      }
      bind(done);
    }
  }
  
  
--- 1245,31 ---
        andptr(swap_reg, zero_bits - (int)os::vm_page_size());
  
        // Save the test result, for recursive case, the result is zero
        movptr(Address(lock_reg, mark_offset), swap_reg);
        jcc(Assembler::notZero, slow_case);
      }
+     jmp(done);
+ 
+     bind(count_locking);
      inc_held_monitor_count();
      jmp(done);
  
      bind(slow_case);
  
+     push_cont_fastpath();
      // Call the runtime routine for slow case
      if (LockingMode == LM_LIGHTWEIGHT) {
        call_VM(noreg,
                CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter_obj),
                obj_reg);
      } else {
        call_VM(noreg,
                CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter),
                lock_reg);
      }
+     pop_cont_fastpath();
      bind(done);
    }
  }
  
  

*** 1285,11 ***
           "The argument is only for looks. It must be c_rarg1");
  
    if (LockingMode == LM_MONITOR) {
      call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorexit), lock_reg);
    } else {
!     Label count_locking, done, slow_case;
  
      const Register swap_reg   = rax;  // Must use rax for cmpxchg instruction
      const Register header_reg = LP64_ONLY(c_rarg2) NOT_LP64(rbx);  // Will contain the old oopMark
      const Register obj_reg    = LP64_ONLY(c_rarg3) NOT_LP64(rcx);  // Will contain the oop
  
--- 1290,11 ---
           "The argument is only for looks. It must be c_rarg1");
  
    if (LockingMode == LM_MONITOR) {
      call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorexit), lock_reg);
    } else {
!     Label done, slow_case;
  
      const Register swap_reg   = rax;  // Must use rax for cmpxchg instruction
      const Register header_reg = LP64_ONLY(c_rarg2) NOT_LP64(rbx);  // Will contain the old oopMark
      const Register obj_reg    = LP64_ONLY(c_rarg3) NOT_LP64(rcx);  // Will contain the oop
  

*** 1323,22 ***
  
        // Test for recursion
        testptr(header_reg, header_reg);
  
        // zero for recursive case
!       jcc(Assembler::zero, count_locking);
  
        // Atomic swap back the old header
        lock();
        cmpxchgptr(header_reg, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
  
        // zero for simple unlock of a stack-lock case
        jcc(Assembler::notZero, slow_case);
! 
-       bind(count_locking);
      }
-     dec_held_monitor_count();
      jmp(done);
  
      bind(slow_case);
      // Call the runtime routine for slow case.
      movptr(Address(lock_reg, BasicObjectLock::obj_offset()), obj_reg); // restore obj
--- 1328,20 ---
  
        // Test for recursion
        testptr(header_reg, header_reg);
  
        // zero for recursive case
!       jcc(Assembler::zero, done);
  
        // Atomic swap back the old header
        lock();
        cmpxchgptr(header_reg, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
  
        // zero for simple unlock of a stack-lock case
        jcc(Assembler::notZero, slow_case);
!       dec_held_monitor_count();
      }
      jmp(done);
  
      bind(slow_case);
      // Call the runtime routine for slow case.
      movptr(Address(lock_reg, BasicObjectLock::obj_offset()), obj_reg); // restore obj
< prev index next >