[RISC-V] Use correct registers set for fast tail call when function needs GSCookie...
authoryurai007 <dawid_jurek@vp.pl>
Fri, 26 Jan 2024 19:40:07 +0000 (20:40 +0100)
committerGleb Balykov/Advanced System SW Lab /SRR/Staff Engineer/Samsung Electronics <g.balykov@samsung.com>
Thu, 22 Feb 2024 11:52:55 +0000 (14:52 +0300)
commit64dc61b1b113682f6ec99d94ef88edf39ef0e8a7
tree55db52b74223ce7f6524be2e675587824160f856
parent925de8331bc4a1b3c9a14fa8b00964c34022ff22
[RISC-V] Use correct registers set for fast tail call when function needs GSCookie check (#97510)

Consider scenario when JIT needs to emit GS Cookie check before performing
fast tail call through t0 at the end of function epilog. In that case CodeGen::genEmitGSCookieCheck
may blindly override t0 register to GSCookie address without respecting value already stored in t0.
We end up with hard to debug crash since our stack contains only one 0x9abcdef012345678 frame.
To prevent such issue, in this patch we follow ARM64 behaviour
and don't pick REG_GSCOOKIE_TMP_0/1 registers for fast tail calls.
It fixes couple of CoreCLR tests running in JitStress mode.
src/coreclr/jit/lsrariscv64.cpp