Skip to content

Commit bd15f0b

Browse files
committed
.
1 parent 719dcb5 commit bd15f0b

1 file changed

Lines changed: 4 additions & 15 deletions

File tree

zjit/mini_zjit.rb

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -665,21 +665,10 @@ def compile(iseq)
665665
next unless left && right
666666
snap = fun.push_insn(current_block, Snapshot.new(locals.dup, stack.dup))
667667

668-
if left.type.fixnum? && right.type.fixnum?
669-
gl = fun.push_insn(current_block, GuardType.new(left, Types::Fixnum, snap))
670-
gr = fun.push_insn(current_block, GuardType.new(right, Types::Fixnum, snap))
671-
result = case op
672-
when :opt_plus then fun.push_insn(current_block, FixnumAdd.new(gl, gr, snap))
673-
when :opt_minus then fun.push_insn(current_block, FixnumSub.new(gl, gr, snap))
674-
when :opt_mult then fun.push_insn(current_block, FixnumMult.new(gl, gr, snap))
675-
when :opt_lt then fun.push_insn(current_block, FixnumLt.new(gl, gr))
676-
when :opt_eq then fun.push_insn(current_block, FixnumEq.new(gl, gr))
677-
when :opt_gt then fun.push_insn(current_block, FixnumGt.new(gl, gr))
678-
end
679-
else
680-
method = { opt_plus: :+, opt_minus: :-, opt_mult: :*, opt_lt: :<, opt_eq: :==, opt_gt: :> }[op]
681-
result = fun.push_insn(current_block, Send.new(left, method, [right], snap))
682-
end
668+
# Always emit a generic Send. type_specialize will lower it to
669+
# Fixnum ops if the types are known — just like real ZJIT.
670+
method = { opt_plus: :+, opt_minus: :-, opt_mult: :*, opt_lt: :<, opt_eq: :==, opt_gt: :> }[op]
671+
result = fun.push_insn(current_block, Send.new(left, method, [right], snap))
683672
stack.push(result)
684673

685674
when :opt_length, :opt_size, :opt_not, :opt_succ, :opt_empty_p

0 commit comments

Comments
 (0)