RFR: 8303153: Native interpreter frame missing mirror
Fei Yang
fyang at openjdk.org
Fri May 5 12:21:18 UTC 2023
On Thu, 4 May 2023 08:00:23 GMT, Fredrik Bredberg <duke at openjdk.org> wrote:
> The mirror needs to be stored in the frame for native calls also on AArch64 and RISC-V (as it is on other platforms).
> See JDK-8303153 for more info.
> Passes tier1-5 tests on AArch64. Done basic tests on RISC-V using QEmu.
Hi,
Thanks for taking care of RISC-V at the same time.
I think it would be cleaner if we do following for the RISC-V part:
diff --git a/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp b/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp
index 3e0e94515fc..f8ce528634f 100644
--- a/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp
+++ b/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp
@@ -770,8 +770,10 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) {
__ sd(x19_sender_sp, Address(sp, 9 * wordSize));
__ sd(zr, Address(sp, 8 * wordSize));
- // Get mirror
+ // Get mirror and store it in the frame as GC root for this Method*
__ load_mirror(t2, xmethod, x15, t1);
+ __ sd(t2, Address(sp, 4 * wordSize));
+
if (!native_call) {
__ ld(t0, Address(xmethod, Method::const_offset()));
__ lhu(t0, Address(t0, ConstMethod::max_stack_offset()));
@@ -779,9 +781,8 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) {
__ slli(t0, t0, 3);
__ sub(t0, sp, t0);
__ andi(t0, t0, -16);
- // Store extended SP and mirror
+ // Store extended SP
__ sd(t0, Address(sp, 5 * wordSize));
- __ sd(t2, Address(sp, 4 * wordSize));
// Move SP out of the way
__ mv(sp, t0);
} else {
@@ -789,7 +790,6 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) {
// an exception (see TemplateInterpreterGenerator::generate_throw_exception())
__ sub(t0, sp, 2 * wordSize);
__ sd(t0, Address(sp, 5 * wordSize));
- __ sd(zr, Address(sp, 4 * wordSize));
__ mv(sp, t0);
}
}
-------------
Changes requested by fyang (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/13794#pullrequestreview-1414680357
More information about the hotspot-dev
mailing list