RFR: 8350182: [s390x] Relativize locals in interpreter frames
Amit Kumar
amitkumar at openjdk.org
Mon Feb 17 11:08:24 UTC 2025
On Mon, 17 Feb 2025 09:53:37 GMT, Amit Kumar <amitkumar at openjdk.org> wrote:
> Port for [JDK-8299795](https://bugs.openjdk.org/browse/JDK-8299795) Relativize Z_locals in interpreter frame for s390x.
>
> Tier1 test with fastdebug vm are clean.
src/hotspot/cpu/s390/interp_masm_s390.cpp line 117:
> 115: z_agr(Z_R1_scratch, Z_fp);
> 116:
> 117: z_cgr(Z_locals, Z_R1_scratch);
By default assertion was failing, Because stored value is fp relativised and Z_locals is holding pointer. So I have updated it.
I have done some manual step through and found that it should be okay to keep, unless we don't want to kill another register here.
diff --git a/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp b/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp
index c40be5edec7..fc5b9f10af1 100644
--- a/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp
+++ b/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp
@@ -1134,8 +1134,16 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) {
__ z_agr(Z_locals, Z_esp);
// z_ijava_state->locals - i*BytesPerWord points to i-th Java local (i starts at 0)
// z_ijava_state->locals = Z_esp + parameter_count bytes
+ __ z_sgrk(Z_locals, Z_locals, fp); // Z_R1 = Z_locals - fp();
+ __ z_srlg(Z_locals, Z_locals, Interpreter::logStackElementSize);
+ // Store relativized Z_locals, see frame::interpreter_frame_locals().
__ z_stg(Z_locals, _z_ijava_state_neg(locals), fp);
// z_ijava_state->oop_temp = nullptr;
__ store_const(Address(fp, oop_tmp_offset), 0);
with this change, `Z_locals` is holding the correct value (fp relativized) which is stored at the state offset:
(gdb) i r r12
r12 0x1 1
(gdb) x/2gx $r9 - 88
0x3fffb37be98: 0x0000000000000001 0x000003fffb37be80
(gdb)
Similarly, with the change I have pushed:
instr:
0x3fff8192b5a: lg %r1,-88(%r9)
0x3fff8192b60: sllg %r1,%r1,3
0x3fff8192b66: agr %r1,%r9
result:
(gdb) i r r12
r12 0x3fffb37bef8 4397966278392
(gdb) i r r1
r1 0x3fffb37bef8 4397966278392
(gdb)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23660#discussion_r1957988781
More information about the hotspot-dev
mailing list