< prev index next >

src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp

Print this page
*** 1628,11 ***
                                                masm->code(),
                                                vep_offset,
                                                frame_complete,
                                                stack_slots,
                                                in_ByteSize(-1),
-                                               in_ByteSize(-1),
                                                oop_maps,
                                                exception_offset);
      if (method->is_continuation_enter_intrinsic()) {
        ContinuationEntry::set_enter_code(nm, interpreted_entry_offset);
      } else if (method->is_continuation_yield_intrinsic()) {
--- 1628,10 ---

*** 1657,11 ***
                                         masm->code(),
                                         vep_offset,
                                         frame_complete,
                                         stack_slots / VMRegImpl::slots_per_word,
                                         in_ByteSize(-1),
-                                        in_ByteSize(-1),
                                         (OopMapSet*)NULL);
    }
    address native_func = method->native_function();
    assert(native_func != NULL, "must have function");
  
--- 1656,10 ---

*** 1713,11 ***
  
    // Now any space we need for handlizing a klass if static method
  
    int klass_slot_offset = 0;
    int klass_offset = -1;
-   int lock_slot_offset = 0;
    bool is_static = false;
  
    if (method->is_static()) {
      klass_slot_offset = stack_slots;
      stack_slots += VMRegImpl::slots_per_word;
--- 1711,10 ---

*** 1726,11 ***
    }
  
    // Plus a lock if needed
  
    if (method->is_synchronized()) {
-     lock_slot_offset = stack_slots;
      stack_slots += VMRegImpl::slots_per_word;
    }
  
    // Now a place (+2) to save return values or temp during shuffling
    // + 4 for return address (which we own) and saved rbp
--- 1723,10 ---

*** 1741,12 ***
    //
    // FP-> |                     |
    //      |---------------------|
    //      | 2 slots for moves   |
    //      |---------------------|
-   //      | lock box (if sync)  |
-   //      |---------------------| <- lock_slot_offset
    //      | klass (if static)   |
    //      |---------------------| <- klass_slot_offset
    //      | oopHandle area      |
    //      |---------------------| <- oop_handle_offset (6 java arg registers)
    //      | outbound memory     |
--- 1737,10 ---

*** 2019,68 ***
  
    // Register definitions used by locking and unlocking
  
    const Register swap_reg = rax;  // Must use rax for cmpxchg instruction
    const Register obj_reg  = rbx;  // Will contain the oop
!   const Register lock_reg = r13;  // Address of compiler lock object (BasicLock)
-   const Register old_hdr  = r13;  // value of old header at unlock time
  
    Label slow_path_lock;
    Label lock_done;
  
    if (method->is_synchronized()) {
-     Label count_mon;
- 
-     const int mark_word_offset = BasicLock::displaced_header_offset_in_bytes();
- 
      // Get the handle (the 2nd argument)
      __ mov(oop_handle_reg, c_rarg1);
  
-     // Get address of the box
- 
-     __ lea(lock_reg, Address(rsp, lock_slot_offset * VMRegImpl::stack_slot_size));
- 
      // Load the oop from the handle
      __ movptr(obj_reg, Address(oop_handle_reg, 0));
  
      if (!UseHeavyMonitors) {
! 
!       // Load immediate 1 into swap_reg %rax
!       __ movl(swap_reg, 1);
- 
-       // Load (object->mark() | 1) into swap_reg %rax
-       __ orptr(swap_reg, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
- 
-       // Save (object->mark() | 1) into BasicLock's displaced header
-       __ movptr(Address(lock_reg, mark_word_offset), swap_reg);
- 
-       // src -> dest iff dest == rax else rax <- dest
-       __ lock();
-       __ cmpxchgptr(lock_reg, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
-       __ jcc(Assembler::equal, count_mon);
- 
-       // Hmm should this move to the slow path code area???
- 
-       // Test if the oopMark is an obvious stack pointer, i.e.,
-       //  1) (mark & 3) == 0, and
-       //  2) rsp <= mark < mark + os::pagesize()
-       // These 3 tests can be done by evaluating the following
-       // expression: ((mark - rsp) & (3 - os::vm_page_size())),
-       // assuming both stack pointer and pagesize have their
-       // least significant 2 bits clear.
-       // NOTE: the oopMark is in swap_reg %rax as the result of cmpxchg
- 
-       __ subptr(swap_reg, rsp);
-       __ andptr(swap_reg, 3 - os::vm_page_size());
- 
-       // Save the test result, for recursive case, the result is zero
-       __ movptr(Address(lock_reg, mark_word_offset), swap_reg);
-       __ jcc(Assembler::notEqual, slow_path_lock);
      } else {
        __ jmp(slow_path_lock);
      }
-     __ bind(count_mon);
      __ inc_held_monitor_count();
  
      // Slow path will re-enter here
      __ bind(lock_done);
    }
--- 2013,29 ---
  
    // Register definitions used by locking and unlocking
  
    const Register swap_reg = rax;  // Must use rax for cmpxchg instruction
    const Register obj_reg  = rbx;  // Will contain the oop
!   const Register tmp      = r13;
  
    Label slow_path_lock;
    Label lock_done;
  
    if (method->is_synchronized()) {
      // Get the handle (the 2nd argument)
      __ mov(oop_handle_reg, c_rarg1);
  
      // Load the oop from the handle
      __ movptr(obj_reg, Address(oop_handle_reg, 0));
  
      if (!UseHeavyMonitors) {
!       // Load object header
!       __ movptr(swap_reg, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
!       __ fast_lock_impl(obj_reg, swap_reg, r15_thread, tmp, rscratch1, slow_path_lock);
      } else {
        __ jmp(slow_path_lock);
      }
      __ inc_held_monitor_count();
  
      // Slow path will re-enter here
      __ bind(lock_done);
    }

*** 2186,35 ***
      Label fast_done;
  
      // Get locked oop from the handle we passed to jni
      __ movptr(obj_reg, Address(oop_handle_reg, 0));
  
-     if (!UseHeavyMonitors) {
-       Label not_recur;
-       // Simple recursive lock?
-       __ cmpptr(Address(rsp, lock_slot_offset * VMRegImpl::stack_slot_size), NULL_WORD);
-       __ jcc(Assembler::notEqual, not_recur);
-       __ dec_held_monitor_count();
-       __ jmpb(fast_done);
-       __ bind(not_recur);
-     }
- 
      // Must save rax if it is live now because cmpxchg must use it
      if (ret_type != T_FLOAT && ret_type != T_DOUBLE && ret_type != T_VOID) {
        save_native_result(masm, ret_type, stack_slots);
      }
  
      if (!UseHeavyMonitors) {
!       // get address of the stack lock
!       __ lea(rax, Address(rsp, lock_slot_offset * VMRegImpl::stack_slot_size));
!       //  get old displaced header
-       __ movptr(old_hdr, Address(rax, 0));
- 
-       // Atomic swap old header if oop still contains the stack lock
-       __ lock();
-       __ cmpxchgptr(old_hdr, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
-       __ jcc(Assembler::notEqual, slow_path_unlock);
        __ dec_held_monitor_count();
      } else {
        __ jmp(slow_path_unlock);
      }
  
--- 2141,19 ---
      Label fast_done;
  
      // Get locked oop from the handle we passed to jni
      __ movptr(obj_reg, Address(oop_handle_reg, 0));
  
      // Must save rax if it is live now because cmpxchg must use it
      if (ret_type != T_FLOAT && ret_type != T_DOUBLE && ret_type != T_VOID) {
        save_native_result(masm, ret_type, stack_slots);
      }
  
      if (!UseHeavyMonitors) {
!       __ movptr(swap_reg, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
!       __ andptr(swap_reg, ~(int32_t)markWord::lock_mask_in_place);
!       __ fast_unlock_impl(obj_reg, swap_reg, tmp, slow_path_unlock);
        __ dec_held_monitor_count();
      } else {
        __ jmp(slow_path_unlock);
      }
  

*** 2285,15 ***
  
      // protect the args we've loaded
      save_args(masm, total_c_args, c_arg, out_regs);
  
      __ mov(c_rarg0, obj_reg);
!     __ mov(c_rarg1, lock_reg);
-     __ mov(c_rarg2, r15_thread);
  
      // Not a leaf but we have last_Java_frame setup as we want
!     __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::complete_monitor_locking_C), 3);
      restore_args(masm, total_c_args, c_arg, out_regs);
  
  #ifdef ASSERT
      { Label L;
      __ cmpptr(Address(r15_thread, in_bytes(Thread::pending_exception_offset())), NULL_WORD);
--- 2224,14 ---
  
      // protect the args we've loaded
      save_args(masm, total_c_args, c_arg, out_regs);
  
      __ mov(c_rarg0, obj_reg);
!     __ mov(c_rarg1, r15_thread);
  
      // Not a leaf but we have last_Java_frame setup as we want
!     __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::complete_monitor_locking_C), 2);
      restore_args(masm, total_c_args, c_arg, out_regs);
  
  #ifdef ASSERT
      { Label L;
      __ cmpptr(Address(r15_thread, in_bytes(Thread::pending_exception_offset())), NULL_WORD);

*** 2314,14 ***
      __ vzeroupper();
      if (ret_type == T_FLOAT || ret_type == T_DOUBLE ) {
        save_native_result(masm, ret_type, stack_slots);
      }
  
-     __ lea(c_rarg1, Address(rsp, lock_slot_offset * VMRegImpl::stack_slot_size));
- 
      __ mov(c_rarg0, obj_reg);
!     __ mov(c_rarg2, r15_thread);
      __ mov(r12, rsp); // remember sp
      __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows
      __ andptr(rsp, -16); // align stack as required by ABI
  
      // Save pending exception around call to VM (which contains an EXCEPTION_MARK)
--- 2252,12 ---
      __ vzeroupper();
      if (ret_type == T_FLOAT || ret_type == T_DOUBLE ) {
        save_native_result(masm, ret_type, stack_slots);
      }
  
      __ mov(c_rarg0, obj_reg);
!     __ mov(c_rarg1, r15_thread);
      __ mov(r12, rsp); // remember sp
      __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows
      __ andptr(rsp, -16); // align stack as required by ABI
  
      // Save pending exception around call to VM (which contains an EXCEPTION_MARK)

*** 2378,11 ***
                                              masm->code(),
                                              vep_offset,
                                              frame_complete,
                                              stack_slots / VMRegImpl::slots_per_word,
                                              (is_static ? in_ByteSize(klass_offset) : in_ByteSize(receiver_offset)),
-                                             in_ByteSize(lock_slot_offset*VMRegImpl::stack_slot_size),
                                              oop_maps);
  
    return nm;
  }
  
--- 2314,10 ---
< prev index next >