3949 __ str(c_rarg2, Address(c_rarg3, 0)); // and store it at new location
3950 __ add(c_rarg3, c_rarg3, wordSize); // advance to next word
3951 __ bind(entry);
3952 __ cmp(c_rarg3, c_rarg1); // check if bottom reached
3953 __ br(Assembler::NE, loop); // if not at bottom then
3954 // copy next word
3955 }
3956
3957 // call run-time routine
3958 // c_rarg1: points to monitor entry
3959 __ bind(allocated);
3960
3961 // Increment bcp to point to the next bytecode, so exception
3962 // handling for async. exceptions work correctly.
3963 // The object has already been popped from the stack, so the
3964 // expression stack looks correct.
3965 __ increment(rbcp);
3966
3967 // store object
3968 __ str(r0, Address(c_rarg1, BasicObjectLock::obj_offset()));
3969 __ lock_object(c_rarg1);
3970
3971 // check to make sure this monitor doesn't cause stack overflow after locking
3972 __ save_bcp(); // in case of exception
3973 __ generate_stack_overflow_check(0);
3974
3975 // The bcp has already been incremented. Just need to dispatch to
3976 // next instruction.
3977 __ dispatch_next(vtos);
3978 }
3979
3980
3981 void TemplateTable::monitorexit()
3982 {
3983 transition(atos, vtos);
3984
3985 // check for null object
3986 __ null_check(r0);
3987
3988 const Address monitor_block_top(
3989 rfp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
3990 const Address monitor_block_bot(
3991 rfp, frame::interpreter_frame_initial_sp_offset * wordSize);
3992 const int entry_size = frame::interpreter_frame_monitor_size_in_bytes();
3993
3994 Label found;
4003 __ lea(c_rarg2, monitor_block_bot); // points to word before bottom
4004 // of monitor block
4005 __ b(entry);
4006
4007 __ bind(loop);
4008 // check if current entry is for same object
4009 __ ldr(rscratch1, Address(c_rarg1, BasicObjectLock::obj_offset()));
4010 __ cmp(r0, rscratch1);
4011 // if same object then stop searching
4012 __ br(Assembler::EQ, found);
4013 // otherwise advance to next entry
4014 __ add(c_rarg1, c_rarg1, entry_size);
4015 __ bind(entry);
4016 // check if bottom reached
4017 __ cmp(c_rarg1, c_rarg2);
4018 // if not at bottom then check this entry
4019 __ br(Assembler::NE, loop);
4020 }
4021
4022 // error handling. Unlocking was not block-structured
4023 __ call_VM(noreg, CAST_FROM_FN_PTR(address,
4024 InterpreterRuntime::throw_illegal_monitor_state_exception));
4025 __ should_not_reach_here();
4026
4027 // call run-time routine
4028 __ bind(found);
4029 __ push_ptr(r0); // make sure object is on stack (contract with oopMaps)
4030 __ unlock_object(c_rarg1);
4031 __ pop_ptr(r0); // discard object
4032 }
4033
4034
4035 // Wide instructions
4036 void TemplateTable::wide()
4037 {
4038 __ load_unsigned_byte(r19, at_bcp(1));
4039 __ mov(rscratch1, (address)Interpreter::_wentry_point);
4040 __ ldr(rscratch1, Address(rscratch1, r19, Address::uxtw(3)));
4041 __ br(rscratch1);
4042 }
|
3949 __ str(c_rarg2, Address(c_rarg3, 0)); // and store it at new location
3950 __ add(c_rarg3, c_rarg3, wordSize); // advance to next word
3951 __ bind(entry);
3952 __ cmp(c_rarg3, c_rarg1); // check if bottom reached
3953 __ br(Assembler::NE, loop); // if not at bottom then
3954 // copy next word
3955 }
3956
3957 // call run-time routine
3958 // c_rarg1: points to monitor entry
3959 __ bind(allocated);
3960
3961 // Increment bcp to point to the next bytecode, so exception
3962 // handling for async. exceptions work correctly.
3963 // The object has already been popped from the stack, so the
3964 // expression stack looks correct.
3965 __ increment(rbcp);
3966
3967 // store object
3968 __ str(r0, Address(c_rarg1, BasicObjectLock::obj_offset()));
3969 __ set_last_Java_frame(sp, rfp, rscratch1, rscratch2);
3970 __ lock_object(c_rarg1);
3971 __ reset_last_Java_frame(true);
3972
3973 // check to make sure this monitor doesn't cause stack overflow after locking
3974 __ save_bcp(); // in case of exception
3975 __ generate_stack_overflow_check(0);
3976
3977 // Check preemption
3978 Label ok;
3979 __ ldrb(rscratch1, Address(rthread, in_bytes(JavaThread::preempting_offset())));
3980 __ cbz(rscratch1, ok);
3981 __ lea(rscratch1, RuntimeAddress(StubRoutines::cont_preempt_stub()));
3982 __ br(rscratch1);
3983 __ bind(ok);
3984
3985 // The bcp has already been incremented. Just need to dispatch to
3986 // next instruction.
3987 __ dispatch_next(vtos);
3988 }
3989
3990
3991 void TemplateTable::monitorexit()
3992 {
3993 transition(atos, vtos);
3994
3995 // check for null object
3996 __ null_check(r0);
3997
3998 const Address monitor_block_top(
3999 rfp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
4000 const Address monitor_block_bot(
4001 rfp, frame::interpreter_frame_initial_sp_offset * wordSize);
4002 const int entry_size = frame::interpreter_frame_monitor_size_in_bytes();
4003
4004 Label found;
4013 __ lea(c_rarg2, monitor_block_bot); // points to word before bottom
4014 // of monitor block
4015 __ b(entry);
4016
4017 __ bind(loop);
4018 // check if current entry is for same object
4019 __ ldr(rscratch1, Address(c_rarg1, BasicObjectLock::obj_offset()));
4020 __ cmp(r0, rscratch1);
4021 // if same object then stop searching
4022 __ br(Assembler::EQ, found);
4023 // otherwise advance to next entry
4024 __ add(c_rarg1, c_rarg1, entry_size);
4025 __ bind(entry);
4026 // check if bottom reached
4027 __ cmp(c_rarg1, c_rarg2);
4028 // if not at bottom then check this entry
4029 __ br(Assembler::NE, loop);
4030 }
4031
4032 // error handling. Unlocking was not block-structured
4033 __ adr(rscratch1, __ pc());
4034 __ set_last_Java_frame(sp, rfp, rscratch1, rscratch2);
4035 __ call_VM(noreg, CAST_FROM_FN_PTR(address,
4036 InterpreterRuntime::throw_illegal_monitor_state_exception));
4037 __ should_not_reach_here();
4038
4039 // call run-time routine
4040 __ bind(found);
4041 __ push_ptr(r0); // make sure object is on stack (contract with oopMaps)
4042 __ unlock_object(c_rarg1);
4043 __ pop_ptr(r0); // discard object
4044 }
4045
4046
4047 // Wide instructions
4048 void TemplateTable::wide()
4049 {
4050 __ load_unsigned_byte(r19, at_bcp(1));
4051 __ mov(rscratch1, (address)Interpreter::_wentry_point);
4052 __ ldr(rscratch1, Address(rscratch1, r19, Address::uxtw(3)));
4053 __ br(rscratch1);
4054 }
|