summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2023-08-09 14:46:42 -0700
committerGitHub <noreply@github.com>2023-08-09 14:46:42 -0700
commit1ccd0eae112bce845b728e487cb124159f6eb01c (patch)
tree62ed1432debeb2a129fdb985baf6095d9d6d49cd
parent493acaf4d4634834ff010aca7f2fa5641f32416a (diff)
YJIT: Chain guard method IDs for respond_to? (#8196)
Notes
Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
-rw-r--r--yjit/src/codegen.rs12
-rw-r--r--yjit/src/stats.rs2
2 files changed, 11 insertions, 3 deletions
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs
index f4a184b8ab..c761212fe7 100644
--- a/yjit/src/codegen.rs
+++ b/yjit/src/codegen.rs
@@ -1958,7 +1958,8 @@ fn jit_chain_guard(
};
if (asm.ctx.get_chain_depth() as i32) < depth_limit {
- let mut deeper = asm.ctx.clone();
+ // Rewind Context to use the stack_size at the beginning of this instruction.
+ let mut deeper = asm.ctx.with_stack_size(jit.stack_size_for_pc);
deeper.increment_chain_depth();
let bid = BlockId {
iseq: jit.iseq,
@@ -4833,7 +4834,14 @@ fn jit_obj_respond_to(
// This is necessary because we have no guarantee that sym_opnd is a constant
asm.comment("guard known mid");
asm.cmp(sym_opnd, mid_sym.into());
- asm.jne(Target::side_exit(Counter::guard_send_mid_mismatch));
+ jit_chain_guard(
+ JCC_JNE,
+ jit,
+ asm,
+ ocb,
+ SEND_MAX_CHAIN_DEPTH,
+ Counter::guard_send_respond_to_mid_mismatch,
+ );
jit_putobject(asm, result);
diff --git a/yjit/src/stats.rs b/yjit/src/stats.rs
index e3a2911c93..4f3a4e1f47 100644
--- a/yjit/src/stats.rs
+++ b/yjit/src/stats.rs
@@ -310,7 +310,7 @@ make_counters! {
guard_send_interrupted,
guard_send_not_fixnums,
guard_send_not_string,
- guard_send_mid_mismatch,
+ guard_send_respond_to_mid_mismatch,
guard_invokesuper_me_changed,
guard_invokesuper_block_given,