3823 // in the assembly code structure as well
3824 //
3825 // Stack layout:
3826 //
3827 // [expressions ] <--- esp = expression stack top
3828 // ..
3829 // [expressions ]
3830 // [monitor entry] <--- monitor block top = expression stack bot
3831 // ..
3832 // [monitor entry]
3833 // [frame data ] <--- monitor block bot
3834 // ...
3835 // [saved rbp ] <--- rbp
3836 void TemplateTable::monitorenter()
3837 {
3838 transition(atos, vtos);
3839
3840 // check for NULL object
3841 __ null_check(r0);
3842
3843 __ resolve_for_write(OOP_NOT_NULL, r0);
3844
3845 const Address monitor_block_top(
3846 rfp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
3847 const Address monitor_block_bot(
3848 rfp, frame::interpreter_frame_initial_sp_offset * wordSize);
3849 const int entry_size = frame::interpreter_frame_monitor_size() * wordSize;
3850
3851 Label allocated;
3852
3853 // initialize entry pointer
3854 __ mov(c_rarg1, zr); // points to free slot or NULL
3855
3856 // find a free slot in the monitor block (result in c_rarg1)
3857 {
3858 Label entry, loop, exit;
3859 __ ldr(c_rarg3, monitor_block_top); // points to current entry,
3860 // starting with top-most entry
3861 __ lea(c_rarg2, monitor_block_bot); // points to word before bottom
3862
3863 __ b(entry);
3924 __ str(r0, Address(c_rarg1, BasicObjectLock::obj_offset_in_bytes()));
3925 __ lock_object(c_rarg1);
3926
3927 // check to make sure this monitor doesn't cause stack overflow after locking
3928 __ save_bcp(); // in case of exception
3929 __ generate_stack_overflow_check(0);
3930
3931 // The bcp has already been incremented. Just need to dispatch to
3932 // next instruction.
3933 __ dispatch_next(vtos);
3934 }
3935
3936
3937 void TemplateTable::monitorexit()
3938 {
3939 transition(atos, vtos);
3940
3941 // check for NULL object
3942 __ null_check(r0);
3943
3944 __ resolve_for_write(OOP_NOT_NULL, r0);
3945
3946 const Address monitor_block_top(
3947 rfp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
3948 const Address monitor_block_bot(
3949 rfp, frame::interpreter_frame_initial_sp_offset * wordSize);
3950 const int entry_size = frame::interpreter_frame_monitor_size() * wordSize;
3951
3952 Label found;
3953
3954 // find matching slot
3955 {
3956 Label entry, loop;
3957 __ ldr(c_rarg1, monitor_block_top); // points to current entry,
3958 // starting with top-most entry
3959 __ lea(c_rarg2, monitor_block_bot); // points to word before bottom
3960 // of monitor block
3961 __ b(entry);
3962
3963 __ bind(loop);
3964 // check if current entry is for same object
|
3823 // in the assembly code structure as well
3824 //
3825 // Stack layout:
3826 //
3827 // [expressions ] <--- esp = expression stack top
3828 // ..
3829 // [expressions ]
3830 // [monitor entry] <--- monitor block top = expression stack bot
3831 // ..
3832 // [monitor entry]
3833 // [frame data ] <--- monitor block bot
3834 // ...
3835 // [saved rbp ] <--- rbp
3836 void TemplateTable::monitorenter()
3837 {
3838 transition(atos, vtos);
3839
3840 // check for NULL object
3841 __ null_check(r0);
3842
3843 __ resolve(IS_NOT_NULL, r0);
3844
3845 const Address monitor_block_top(
3846 rfp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
3847 const Address monitor_block_bot(
3848 rfp, frame::interpreter_frame_initial_sp_offset * wordSize);
3849 const int entry_size = frame::interpreter_frame_monitor_size() * wordSize;
3850
3851 Label allocated;
3852
3853 // initialize entry pointer
3854 __ mov(c_rarg1, zr); // points to free slot or NULL
3855
3856 // find a free slot in the monitor block (result in c_rarg1)
3857 {
3858 Label entry, loop, exit;
3859 __ ldr(c_rarg3, monitor_block_top); // points to current entry,
3860 // starting with top-most entry
3861 __ lea(c_rarg2, monitor_block_bot); // points to word before bottom
3862
3863 __ b(entry);
3924 __ str(r0, Address(c_rarg1, BasicObjectLock::obj_offset_in_bytes()));
3925 __ lock_object(c_rarg1);
3926
3927 // check to make sure this monitor doesn't cause stack overflow after locking
3928 __ save_bcp(); // in case of exception
3929 __ generate_stack_overflow_check(0);
3930
3931 // The bcp has already been incremented. Just need to dispatch to
3932 // next instruction.
3933 __ dispatch_next(vtos);
3934 }
3935
3936
3937 void TemplateTable::monitorexit()
3938 {
3939 transition(atos, vtos);
3940
3941 // check for NULL object
3942 __ null_check(r0);
3943
3944 __ resolve(IS_NOT_NULL, r0);
3945
3946 const Address monitor_block_top(
3947 rfp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
3948 const Address monitor_block_bot(
3949 rfp, frame::interpreter_frame_initial_sp_offset * wordSize);
3950 const int entry_size = frame::interpreter_frame_monitor_size() * wordSize;
3951
3952 Label found;
3953
3954 // find matching slot
3955 {
3956 Label entry, loop;
3957 __ ldr(c_rarg1, monitor_block_top); // points to current entry,
3958 // starting with top-most entry
3959 __ lea(c_rarg2, monitor_block_bot); // points to word before bottom
3960 // of monitor block
3961 __ b(entry);
3962
3963 __ bind(loop);
3964 // check if current entry is for same object
|