775 // 1) (mark & 7) == 0, and
776 // 2) sp <= mark < mark + os::pagesize()
777 //
778 // These 3 tests can be done by evaluating the following
779 // expression: ((mark - sp) & (7 - os::vm_page_size())),
780 // assuming both stack pointer and pagesize have their
781 // least significant 3 bits clear.
782 // NOTE: the oopMark is in swap_reg x10 as the result of cmpxchg
783 sub(swap_reg, swap_reg, sp);
784 mv(t0, (int64_t)(7 - (int)os::vm_page_size()));
785 andr(swap_reg, swap_reg, t0);
786
787 // Save the test result, for recursive case, the result is zero
788 sd(swap_reg, Address(lock_reg, mark_offset));
789 beqz(swap_reg, count);
790 }
791
792 bind(slow_case);
793
794 // Call the runtime routine for slow case
795 if (LockingMode == LM_LIGHTWEIGHT) {
796 call_VM(noreg,
797 CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter_obj),
798 obj_reg);
799 } else {
800 call_VM(noreg,
801 CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter),
802 lock_reg);
803 }
804 j(done);
805
806 bind(count);
807 increment(Address(xthread, JavaThread::held_monitor_count_offset()));
808
809 bind(done);
810 }
811 }
812
813
814 // Unlocks an object. Used in monitorexit bytecode and
815 // remove_activation. Throws an IllegalMonitorException if object is
816 // not locked by current thread.
817 //
818 // Args:
819 // c_rarg1: BasicObjectLock for lock
820 //
821 // Kills:
822 // x10
823 // c_rarg0, c_rarg1, c_rarg2, c_rarg3, c_rarg4, ... (param regs)
|
775 // 1) (mark & 7) == 0, and
776 // 2) sp <= mark < mark + os::pagesize()
777 //
778 // These 3 tests can be done by evaluating the following
779 // expression: ((mark - sp) & (7 - os::vm_page_size())),
780 // assuming both stack pointer and pagesize have their
781 // least significant 3 bits clear.
782 // NOTE: the oopMark is in swap_reg x10 as the result of cmpxchg
783 sub(swap_reg, swap_reg, sp);
784 mv(t0, (int64_t)(7 - (int)os::vm_page_size()));
785 andr(swap_reg, swap_reg, t0);
786
787 // Save the test result, for recursive case, the result is zero
788 sd(swap_reg, Address(lock_reg, mark_offset));
789 beqz(swap_reg, count);
790 }
791
792 bind(slow_case);
793
794 // Call the runtime routine for slow case
795 call_VM(noreg,
796 CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter),
797 lock_reg);
798 j(done);
799
800 bind(count);
801 increment(Address(xthread, JavaThread::held_monitor_count_offset()));
802
803 bind(done);
804 }
805 }
806
807
808 // Unlocks an object. Used in monitorexit bytecode and
809 // remove_activation. Throws an IllegalMonitorException if object is
810 // not locked by current thread.
811 //
812 // Args:
813 // c_rarg1: BasicObjectLock for lock
814 //
815 // Kills:
816 // x10
817 // c_rarg0, c_rarg1, c_rarg2, c_rarg3, c_rarg4, ... (param regs)
|