From 23d46829264e21ec542c099d61922efa58cac916 Mon Sep 17 00:00:00 2001 From: Maxime Chevalier-Boisvert Date: Wed, 24 Jan 2024 13:09:08 -0500 Subject: [PATCH] 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. --- yjit/src/codegen.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs index 0f9e15b513..576a988879 100644 --- a/yjit/src/codegen.rs +++ b/yjit/src/codegen.rs @@ -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; }