Skip to content

Commit 29384f9

Browse files
zhengxiaolinXRealFYang
authored andcommitted
8279664: riscv: JFR crashes at 0x0
Reviewed-by: yadongwang, fyang
1 parent 414c580 commit 29384f9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/hotspot/cpu/riscv/macroAssembler_riscv.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ class MacroAssembler: public Assembler {
5252
void align(int modulus, int extra_offset = 0);
5353

5454
// Stack frame creation/removal
55+
// Note that SP must be updated to the right place before saving/restoring RA and FP
56+
// because signal based thread suspend/resume could happen asynchronously.
5557
void enter() {
5658
addi(sp, sp, - 2 * wordSize);
5759
sd(ra, Address(sp, wordSize));
@@ -60,9 +62,10 @@ class MacroAssembler: public Assembler {
6062
}
6163

6264
void leave() {
63-
mv(sp, fp);
64-
ld(fp, Address(sp, -2 * wordSize));
65-
ld(ra, Address(sp, -wordSize));
65+
addi(sp, fp, - 2 * wordSize);
66+
ld(fp, Address(sp));
67+
ld(ra, Address(sp, wordSize));
68+
addi(sp, sp, 2 * wordSize);
6669
}
6770

6871

0 commit comments

Comments
 (0)