YJIT: fix small bug causing jit_rb_int_rshift to side-exit (#9684)

YJIT: fix bug causing jit_rb_int_rshift to side-exit

The nqueens benchmark was showing zero performance improvement
because we immediately side-exited as soon as the shift amount
changed. If the amount changes, we want to fall back to the
C function call, not side-exit.
This commit is contained in:
Maxime Chevalier-Boisvert 2024-01-24 13:09:08 -05:00 committed by GitHub
parent 578ff32611
commit 23d4682926
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4712,6 +4712,8 @@ fn jit_rb_int_lshift(
}
// Fallback to a C call if the shift amount varies
// This check is needed because the chain guard will side-exit
// if its max depth is reached
if asm.ctx.get_chain_depth() > 0 {
return false;
}
@ -4771,7 +4773,9 @@ fn jit_rb_int_rshift(
}
// Fallback to a C call if the shift amount varies
if asm.ctx.get_chain_depth() > 1 {
// This check is needed because the chain guard will side-exit
// if its max depth is reached
if asm.ctx.get_chain_depth() > 0 {
return false;
}