RFR: 8370708: RISC-V: Add VerifyStackAtCalls [v3]

Fei Yang fyang at openjdk.org
Tue Oct 28 12:14:04 UTC 2025


On Tue, 28 Oct 2025 09:16:17 GMT, Robbin Ehn <rehn at openjdk.org> wrote:

>> src/hotspot/cpu/riscv/riscv.ad line 1375:
>> 
>>> 1373:   if (VerifyStackAtCalls) {
>>> 1374:     st->print("mv  t2, %ld\n\t", MAJIK_DWORD);
>>> 1375:     st->print("sd  t2, [sp, #%d]\n\t", - 3 * wordSize);
>> 
>> Hmm ... I missed this one. Shouldn't the offset of the address be: `framesize - 3 * wordSize`?
>
> The two above is printed like:
> 
>   st->print("sd  fp, [sp, #%d]\n\t", - 2 * wordSize);
>   st->print("sd  ra, [sp, #%d]\n\t", - wordSize);
> 
> I just followed that.

Ah, I see. Seems we need to update this instruction sequence to match what `build_frame` does in `MachPrologNode::emit`. I guess that was once missed when we change `MachPrologNode::emit`.


4871 void MacroAssembler::build_frame(int framesize) {
4872   assert(framesize >= 2, "framesize must include space for FP/RA");
4873   assert(framesize % (2*wordSize) == 0, "must preserve 2*wordSize alignment");
4874   sub(sp, sp, framesize);
4875   sd(fp, Address(sp, framesize - 2 * wordSize));
4876   sd(ra, Address(sp, framesize - wordSize));
4877   if (PreserveFramePointer) { add(fp, sp, framesize); }
4878 }

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28005#discussion_r2469353195


More information about the hotspot-compiler-dev mailing list