summaryrefslogtreecommitdiff
path: root/yjit
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2023-08-18 11:30:52 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2023-08-18 12:17:37 -0400
commit4524aeba2f181df08b68587da140becd2dfa389f (patch)
tree79f6b47af31472d2d82f54157f108dad76672f0e /yjit
parentc8d641998532c29714529e3c2e721bb1499658d5 (diff)
YJIT: Fix return type of Integer#/ with T_FIXNUM inputs
Issue found by running ruby/spec with `--yjit-verify-ctx`. Thanks!
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/8250
Diffstat (limited to 'yjit')
-rw-r--r--yjit/src/codegen.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs
index a5c030bc12..8e83f128af 100644
--- a/yjit/src/codegen.rs
+++ b/yjit/src/codegen.rs
@@ -4531,6 +4531,9 @@ fn jit_rb_int_div(
}
guard_two_fixnums(jit, asm, ocb);
+ // rb_fix_div_fix may GC-allocate for Bignum
+ jit_prepare_routine_call(jit, asm);
+
asm.comment("Integer#/");
let obj = asm.stack_pop(1);
let recv = asm.stack_pop(1);
@@ -4541,7 +4544,7 @@ fn jit_rb_int_div(
let ret = asm.ccall(rb_fix_div_fix as *const u8, vec![recv, obj]);
- let ret_opnd = asm.stack_push(Type::Fixnum);
+ let ret_opnd = asm.stack_push(Type::Unknown);
asm.mov(ret_opnd, ret);
true
}