1670 __ cmpxchgptr(lock_reg, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
1671 __ jcc(Assembler::equal, count_mon);
1672
1673 // Test if the oopMark is an obvious stack pointer, i.e.,
1674 // 1) (mark & 3) == 0, and
1675 // 2) rsp <= mark < mark + os::pagesize()
1676 // These 3 tests can be done by evaluating the following
1677 // expression: ((mark - rsp) & (3 - os::vm_page_size())),
1678 // assuming both stack pointer and pagesize have their
1679 // least significant 2 bits clear.
1680 // NOTE: the oopMark is in swap_reg %rax, as the result of cmpxchg
1681
1682 __ subptr(swap_reg, rsp);
1683 __ andptr(swap_reg, 3 - (int)os::vm_page_size());
1684
1685 // Save the test result, for recursive case, the result is zero
1686 __ movptr(Address(lock_reg, mark_word_offset), swap_reg);
1687 __ jcc(Assembler::notEqual, slow_path_lock);
1688 } else {
1689 assert(LockingMode == LM_LIGHTWEIGHT, "must be");
1690 __ lightweight_lock(obj_reg, swap_reg, thread, lock_reg, slow_path_lock);
1691 }
1692 __ bind(count_mon);
1693 __ inc_held_monitor_count();
1694
1695 // Slow path will re-enter here
1696 __ bind(lock_done);
1697 }
1698
1699
1700 // Finally just about ready to make the JNI call
1701
1702 // get JNIEnv* which is first argument to native
1703 __ lea(rdx, Address(thread, in_bytes(JavaThread::jni_environment_offset())));
1704 __ movptr(Address(rsp, 0), rdx);
1705
1706 // Now set thread in native
1707 __ movl(Address(thread, JavaThread::thread_state_offset()), _thread_in_native);
1708
1709 __ call(RuntimeAddress(native_func));
1710
|
1670 __ cmpxchgptr(lock_reg, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
1671 __ jcc(Assembler::equal, count_mon);
1672
1673 // Test if the oopMark is an obvious stack pointer, i.e.,
1674 // 1) (mark & 3) == 0, and
1675 // 2) rsp <= mark < mark + os::pagesize()
1676 // These 3 tests can be done by evaluating the following
1677 // expression: ((mark - rsp) & (3 - os::vm_page_size())),
1678 // assuming both stack pointer and pagesize have their
1679 // least significant 2 bits clear.
1680 // NOTE: the oopMark is in swap_reg %rax, as the result of cmpxchg
1681
1682 __ subptr(swap_reg, rsp);
1683 __ andptr(swap_reg, 3 - (int)os::vm_page_size());
1684
1685 // Save the test result, for recursive case, the result is zero
1686 __ movptr(Address(lock_reg, mark_word_offset), swap_reg);
1687 __ jcc(Assembler::notEqual, slow_path_lock);
1688 } else {
1689 assert(LockingMode == LM_LIGHTWEIGHT, "must be");
1690 // Lacking registers and thread on x86_32. Always take slow path.
1691 __ jmp(slow_path_lock);
1692 }
1693 __ bind(count_mon);
1694 __ inc_held_monitor_count();
1695
1696 // Slow path will re-enter here
1697 __ bind(lock_done);
1698 }
1699
1700
1701 // Finally just about ready to make the JNI call
1702
1703 // get JNIEnv* which is first argument to native
1704 __ lea(rdx, Address(thread, in_bytes(JavaThread::jni_environment_offset())));
1705 __ movptr(Address(rsp, 0), rdx);
1706
1707 // Now set thread in native
1708 __ movl(Address(thread, JavaThread::thread_state_offset()), _thread_in_native);
1709
1710 __ call(RuntimeAddress(native_func));
1711
|