8253901: ARM32: SIGSEGV during monitorexit due to incorrect register use (after JDK-8253540)

Reviewed-by: shade
This commit is contained in:
Boris Ulasevich 2020-10-08 06:52:27 +00:00
parent abe2593772
commit fd0cb98ed0
3 changed files with 9 additions and 7 deletions

@ -729,7 +729,7 @@ void InterpreterMacroAssembler::remove_activation(TosState state, Register ret_a
// BasicObjectLock will be first in list, since this is a synchronized method. However, need
// to check that the object has not been unlocked by an explicit monitorexit bytecode.
const Register Rmonitor = R1; // fixed in unlock_object()
const Register Rmonitor = R0; // fixed in unlock_object()
const Register Robj = R2;
// address of first monitor
@ -772,8 +772,8 @@ void InterpreterMacroAssembler::remove_activation(TosState state, Register ret_a
// Unlock does not block, so don't have to worry about the frame
push(state);
mov(R1, Rcur);
unlock_object(R1);
mov(Rmonitor, Rcur);
unlock_object(Rmonitor);
if (install_monitor_exception) {
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::new_illegal_monitor_state_exception));
@ -987,7 +987,7 @@ void InterpreterMacroAssembler::lock_object(Register Rlock) {
// Throw an IllegalMonitorException if object is not locked by current thread
// Blows volatile registers R0-R3, Rtemp, LR. Calls VM.
void InterpreterMacroAssembler::unlock_object(Register Rlock) {
assert(Rlock == R1, "the second argument");
assert(Rlock == R0, "the first argument");
if (UseHeavyMonitors) {
call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorexit), Rlock);

@ -1033,8 +1033,8 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
if (synchronized) {
// address of first monitor
__ sub(R1, FP, - (frame::interpreter_frame_monitor_block_bottom_offset - frame::interpreter_frame_monitor_size()) * wordSize);
__ unlock_object(R1);
__ sub(R0, FP, - (frame::interpreter_frame_monitor_block_bottom_offset - frame::interpreter_frame_monitor_size()) * wordSize);
__ unlock_object(R0);
}
// jvmti/dtrace support

@ -4422,6 +4422,7 @@ void TemplateTable::monitorexit() {
const Register Rcur = R1_tmp;
const Register Rbottom = R2_tmp;
const Register Rcur_obj = Rtemp;
const Register Rmonitor = R0; // fixed in unlock_object()
// check for NULL object
__ null_check(Robj, Rtemp);
@ -4464,7 +4465,8 @@ void TemplateTable::monitorexit() {
// Rcur: points to monitor entry
__ bind(found);
__ push_ptr(Robj); // make sure object is on stack (contract with oopMaps)
__ unlock_object(Rcur);
__ mov(Rmonitor, Rcur);
__ unlock_object(Rmonitor);
__ pop_ptr(Robj); // discard object
}