Skip to content

Commit

Permalink
Fixed return should be done with RA by using RET mnemonic
Browse files Browse the repository at this point in the history
  • Loading branch information
robehn committed Oct 14, 2024
1 parent d81501a commit 1bfd40c
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M

address fn = nullptr;
address entry_point = nullptr;
Register continuation = ra;
switch (kind) {
case Interpreter::java_lang_math_abs:
entry_point = __ pc();
Expand All @@ -185,83 +184,82 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M
__ fld(f10, Address(esp));
__ mv(sp, x19_sender_sp);
__ mv(x9, ra);
continuation = x9; // The first callee-saved register
if (StubRoutines::dsin() == nullptr) {
fn = CAST_FROM_FN_PTR(address, SharedRuntime::dsin);
} else {
fn = CAST_FROM_FN_PTR(address, StubRoutines::dsin());
}
__ call(fn);
__ mv(ra, x9);
break;
case Interpreter::java_lang_math_cos :
entry_point = __ pc();
__ fld(f10, Address(esp));
__ mv(sp, x19_sender_sp);
__ mv(x9, ra);
continuation = x9; // The first callee-saved register
if (StubRoutines::dcos() == nullptr) {
fn = CAST_FROM_FN_PTR(address, SharedRuntime::dcos);
} else {
fn = CAST_FROM_FN_PTR(address, StubRoutines::dcos());
}
__ call(fn);
__ mv(ra, x9);
break;
case Interpreter::java_lang_math_tan :
entry_point = __ pc();
__ fld(f10, Address(esp));
__ mv(sp, x19_sender_sp);
__ mv(x9, ra);
continuation = x9; // The first callee-saved register
if (StubRoutines::dtan() == nullptr) {
fn = CAST_FROM_FN_PTR(address, SharedRuntime::dtan);
} else {
fn = CAST_FROM_FN_PTR(address, StubRoutines::dtan());
}
__ call(fn);
__ mv(ra, x9);
break;
case Interpreter::java_lang_math_log :
entry_point = __ pc();
__ fld(f10, Address(esp));
__ mv(sp, x19_sender_sp);
__ mv(x9, ra);
continuation = x9; // The first callee-saved register
if (StubRoutines::dlog() == nullptr) {
fn = CAST_FROM_FN_PTR(address, SharedRuntime::dlog);
} else {
fn = CAST_FROM_FN_PTR(address, StubRoutines::dlog());
}
__ call(fn);
__ mv(ra, x9);
break;
case Interpreter::java_lang_math_log10 :
entry_point = __ pc();
__ fld(f10, Address(esp));
__ mv(sp, x19_sender_sp);
__ mv(x9, ra);
continuation = x9; // The first callee-saved register
if (StubRoutines::dlog10() == nullptr) {
fn = CAST_FROM_FN_PTR(address, SharedRuntime::dlog10);
} else {
fn = CAST_FROM_FN_PTR(address, StubRoutines::dlog10());
}
__ call(fn);
__ mv(ra, x9);
break;
case Interpreter::java_lang_math_exp :
entry_point = __ pc();
__ fld(f10, Address(esp));
__ mv(sp, x19_sender_sp);
__ mv(x9, ra);
continuation = x9; // The first callee-saved register
if (StubRoutines::dexp() == nullptr) {
fn = CAST_FROM_FN_PTR(address, SharedRuntime::dexp);
} else {
fn = CAST_FROM_FN_PTR(address, StubRoutines::dexp());
}
__ call(fn);
__ mv(ra, x9);
break;
case Interpreter::java_lang_math_pow :
entry_point = __ pc();
__ mv(x9, ra);
continuation = x9;
__ fld(f10, Address(esp, 2 * Interpreter::stackElementSize));
__ fld(f11, Address(esp));
__ mv(sp, x19_sender_sp);
Expand All @@ -271,6 +269,7 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M
fn = CAST_FROM_FN_PTR(address, StubRoutines::dpow());
}
__ call(fn);
__ mv(ra, x9);
break;
case Interpreter::java_lang_math_fmaD :
if (UseFMA) {
Expand All @@ -296,8 +295,7 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M
;
}
if (entry_point != nullptr) {
__ mv(t1, continuation);
__ jr(t1);
__ ret();
}

return entry_point;
Expand Down

0 comments on commit 1bfd40c

Please sign in to comment.