8313419: Template interpreter produces no safepoint check for return bytecodes

Reviewed-by: pchilanomate
This commit is contained in:
Fredrik Bredberg 2023-08-18 14:33:03 +00:00 committed by Patricio Chilano Mateo
parent c36e009772
commit bcba5e9785
3 changed files with 35 additions and 0 deletions

View File

@ -2205,6 +2205,18 @@ void TemplateTable::_return(TosState state)
if (_desc->bytecode() == Bytecodes::_return)
__ membar(MacroAssembler::StoreStore);
if (_desc->bytecode() != Bytecodes::_return_register_finalizer) {
Label no_safepoint;
__ ldr(rscratch1, Address(rthread, JavaThread::polling_word_offset()));
__ tbz(rscratch1, log2i_exact(SafepointMechanism::poll_bit()), no_safepoint);
__ push(state);
__ push_cont_fastpath(rthread);
__ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_safepoint));
__ pop_cont_fastpath(rthread);
__ pop(state);
__ bind(no_safepoint);
}
// Narrow result if state is itos but result type is smaller.
// Need to narrow in the return bytecode rather than in generate_return_entry
// since compiled code callers expect the result to already be narrowed.

View File

@ -2492,6 +2492,16 @@ void TemplateTable::_return(TosState state) {
__ bind(skip_register_finalizer);
}
if (_desc->bytecode() != Bytecodes::_return_register_finalizer) {
Label no_safepoint;
__ ldr(Rtemp, Address(Rthread, JavaThread::polling_word_offset()));
__ tbz(Rtemp, exact_log2(SafepointMechanism::poll_bit()), no_safepoint);
__ push(state);
__ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_safepoint));
__ pop(state);
__ bind(no_safepoint);
}
// Narrow result if state is itos but result type is smaller.
// Need to narrow in the return bytecode rather than in generate_return_entry
// since compiled code callers expect the result to already be narrowed.

View File

@ -2114,6 +2114,19 @@ void TemplateTable::_return(TosState state) {
__ membar(MacroAssembler::StoreStore);
}
if (_desc->bytecode() != Bytecodes::_return_register_finalizer) {
Label no_safepoint;
__ ld(t0, Address(xthread, JavaThread::polling_word_offset()));
__ test_bit(t0, t0, exact_log2(SafepointMechanism::poll_bit()));
__ beqz(t0, no_safepoint);
__ push(state);
__ push_cont_fastpath(xthread);
__ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_safepoint));
__ pop_cont_fastpath(xthread);
__ pop(state);
__ bind(no_safepoint);
}
// Narrow result if state is itos but result type is smaller.
// Need to narrow in the return bytecode rather than in generate_return_entry
// since compiled code callers expect the result to already be narrowed.