3800 // in the assembly code structure as well
3801 //
3802 // Stack layout:
3803 //
3804 // [expressions ] <--- esp = expression stack top
3805 // ..
3806 // [expressions ]
3807 // [monitor entry] <--- monitor block top = expression stack bot
3808 // ..
3809 // [monitor entry]
3810 // [frame data ] <--- monitor block bot
3811 // ...
3812 // [saved rbp ] <--- rbp
3813 void TemplateTable::monitorenter()
3814 {
3815 transition(atos, vtos);
3816
3817 // check for NULL object
3818 __ null_check(r0);
3819
3820 const Address monitor_block_top(
3821 rfp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
3822 const Address monitor_block_bot(
3823 rfp, frame::interpreter_frame_initial_sp_offset * wordSize);
3824 const int entry_size = frame::interpreter_frame_monitor_size() * wordSize;
3825
3826 Label allocated;
3827
3828 // initialize entry pointer
3829 __ mov(c_rarg1, zr); // points to free slot or NULL
3830
3831 // find a free slot in the monitor block (result in c_rarg1)
3832 {
3833 Label entry, loop, exit;
3834 __ ldr(c_rarg3, monitor_block_top); // points to current entry,
3835 // starting with top-most entry
3836 __ lea(c_rarg2, monitor_block_bot); // points to word before bottom
3837
3838 __ b(entry);
3839
3898 // store object
3899 __ str(r0, Address(c_rarg1, BasicObjectLock::obj_offset_in_bytes()));
3900 __ lock_object(c_rarg1);
3901
3902 // check to make sure this monitor doesn't cause stack overflow after locking
3903 __ save_bcp(); // in case of exception
3904 __ generate_stack_overflow_check(0);
3905
3906 // The bcp has already been incremented. Just need to dispatch to
3907 // next instruction.
3908 __ dispatch_next(vtos);
3909 }
3910
3911
3912 void TemplateTable::monitorexit()
3913 {
3914 transition(atos, vtos);
3915
3916 // check for NULL object
3917 __ null_check(r0);
3918
3919 const Address monitor_block_top(
3920 rfp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
3921 const Address monitor_block_bot(
3922 rfp, frame::interpreter_frame_initial_sp_offset * wordSize);
3923 const int entry_size = frame::interpreter_frame_monitor_size() * wordSize;
3924
3925 Label found;
3926
3927 // find matching slot
3928 {
3929 Label entry, loop;
3930 __ ldr(c_rarg1, monitor_block_top); // points to current entry,
3931 // starting with top-most entry
3932 __ lea(c_rarg2, monitor_block_bot); // points to word before bottom
3933 // of monitor block
3934 __ b(entry);
3935
3936 __ bind(loop);
3937 // check if current entry is for same object
|
3800 // in the assembly code structure as well
3801 //
3802 // Stack layout:
3803 //
3804 // [expressions ] <--- esp = expression stack top
3805 // ..
3806 // [expressions ]
3807 // [monitor entry] <--- monitor block top = expression stack bot
3808 // ..
3809 // [monitor entry]
3810 // [frame data ] <--- monitor block bot
3811 // ...
3812 // [saved rbp ] <--- rbp
3813 void TemplateTable::monitorenter()
3814 {
3815 transition(atos, vtos);
3816
3817 // check for NULL object
3818 __ null_check(r0);
3819
3820 __ resolve_for_write(OOP_NOT_NULL, r0);
3821
3822 const Address monitor_block_top(
3823 rfp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
3824 const Address monitor_block_bot(
3825 rfp, frame::interpreter_frame_initial_sp_offset * wordSize);
3826 const int entry_size = frame::interpreter_frame_monitor_size() * wordSize;
3827
3828 Label allocated;
3829
3830 // initialize entry pointer
3831 __ mov(c_rarg1, zr); // points to free slot or NULL
3832
3833 // find a free slot in the monitor block (result in c_rarg1)
3834 {
3835 Label entry, loop, exit;
3836 __ ldr(c_rarg3, monitor_block_top); // points to current entry,
3837 // starting with top-most entry
3838 __ lea(c_rarg2, monitor_block_bot); // points to word before bottom
3839
3840 __ b(entry);
3841
3900 // store object
3901 __ str(r0, Address(c_rarg1, BasicObjectLock::obj_offset_in_bytes()));
3902 __ lock_object(c_rarg1);
3903
3904 // check to make sure this monitor doesn't cause stack overflow after locking
3905 __ save_bcp(); // in case of exception
3906 __ generate_stack_overflow_check(0);
3907
3908 // The bcp has already been incremented. Just need to dispatch to
3909 // next instruction.
3910 __ dispatch_next(vtos);
3911 }
3912
3913
3914 void TemplateTable::monitorexit()
3915 {
3916 transition(atos, vtos);
3917
3918 // check for NULL object
3919 __ null_check(r0);
3920
3921 __ resolve_for_write(OOP_NOT_NULL, r0);
3922
3923 const Address monitor_block_top(
3924 rfp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
3925 const Address monitor_block_bot(
3926 rfp, frame::interpreter_frame_initial_sp_offset * wordSize);
3927 const int entry_size = frame::interpreter_frame_monitor_size() * wordSize;
3928
3929 Label found;
3930
3931 // find matching slot
3932 {
3933 Label entry, loop;
3934 __ ldr(c_rarg1, monitor_block_top); // points to current entry,
3935 // starting with top-most entry
3936 __ lea(c_rarg2, monitor_block_bot); // points to word before bottom
3937 // of monitor block
3938 __ b(entry);
3939
3940 __ bind(loop);
3941 // check if current entry is for same object
|