diff options
| author | Alan Wu <XrXr@users.noreply.github.com> | 2023-09-29 22:29:24 -0400 |
|---|---|---|
| committer | Alan Wu <XrXr@users.noreply.github.com> | 2023-10-05 15:53:05 -0400 |
| commit | 41a6e4bdf9738e2cf1ea356422a429efeeb5a8f0 (patch) | |
| tree | 1e046d638aca5e1b94e27c4b72391cab821e1cdc /include | |
| parent | a5cc6341c0688c346f70098652b2375c03df40aa (diff) | |
YJIT: Avoid writing return value to memory in `leave`
Previously, at the end of `leave` we did
`*caller_cfp->sp = return_value`, like the interpreter.
With future changes that leaves the SP field uninitialized for C frames,
this will become problematic. For cases like returning from
`rb_funcall()`, the return value was written above the stack and
never read anyway (callers use the copy in the return register).
Leave the return value in a register at the end of `leave` and have the
code at `cfp->jit_return` decide what to do with it. This avoids the
unnecessary memory write mentioned above. For JIT-to-JIT returns, it goes
through `asm.stack_push()` and benefits from register allocation for
stack temporaries.
Mostly flat on benchmarks, with maybe some marginal speed improvements.
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions
