RFR: 8350482: [s390x] Relativize esp in interpreter frames [v2]

Lutz Schmidt lucy at openjdk.org
Mon May 12 20:25:54 UTC 2025


On Mon, 12 May 2025 10:01:29 GMT, Amit Kumar <amitkumar at openjdk.org> wrote:

>> src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp line 1186:
>> 
>>> 1184:   __ z_sgrk(Z_R0, Z_esp, fp);
>>> 1185:   __ z_srag(Z_R0, Z_R0, Interpreter::logStackElementSize);
>>> 1186:   __ z_stg(Z_R0, _z_ijava_state_neg(esp), fp);
>> 
>> Please use `save_esp()` here to avoid code duplication.
>
> `save_esp()` uses `Z_fp` which is `Z_R9`. But here `fp` refers to `Z_R11` or `Z_tmp_2`. 
> 
> One possibility is to modify `save_esp` and make sure that it takes `fp` as an argument. Other way it leave it as-it-is. Which one do you prefer.

Hmm, I'm torn between the two resolutions. I hate code duplication, but I also hate unnecessary code complication to avoid duplication. 

After a few greps, I'm biased towards the `save_esp()` modification. Why?` save_esp()` is s390 only and there pre-exist just three calls in `interp_masm_s390.cpp`. Plus, `save_esp()` is public anyway for some reason.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23724#discussion_r2085384813


More information about the hotspot-dev mailing list