From 5a259d875ee6ebd93d3c0932d50784021bc97ea2 Mon Sep 17 00:00:00 2001 From: Fredrik Bredberg Date: Mon, 8 May 2023 14:44:54 +0000 Subject: [PATCH] 8303153: Native interpreter frame missing mirror Reviewed-by: coleenp, fyang --- .../cpu/aarch64/templateInterpreterGenerator_aarch64.cpp | 2 +- .../cpu/riscv/templateInterpreterGenerator_riscv.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp index fada22ae385..40a33ae1230 100644 --- a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp @@ -884,7 +884,7 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) { // Make sure there is room for the exception oop pushed in case method throws // an exception (see TemplateInterpreterGenerator::generate_throw_exception()) __ sub(rscratch1, sp, 2 * wordSize); - __ stp(zr, rscratch1, Address(sp, 4 * wordSize)); + __ stp(r10, rscratch1, Address(sp, 4 * wordSize)); __ mov(sp, rscratch1); } } 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); } }