Skip to content

Commit 102063f

Browse files
committed
ZJIT: Fix a splitting condition for LHS
1 parent f30f0f0 commit 102063f

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

test/ruby/test_zjit.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ def test(a, b, c) = a + b + c
8686
}, call_threshold: 2
8787
end
8888

89+
def test_opt_plus_left_imm
90+
assert_compiles '3', %q{
91+
def test(a) = 1 + a
92+
test(1) # profile opt_plus
93+
test(2)
94+
}, call_threshold: 2
95+
end
96+
8997
# Test argument ordering
9098
def test_opt_minus
9199
assert_compiles '2', %q{

zjit/src/backend/x86_64/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ impl Assembler
183183
*left = asm.load(*left);
184184
},
185185
// The first operand can't be an immediate value
186-
(Opnd::Value(_), _) => {
186+
(Opnd::UImm(_), _) => {
187187
*left = asm.load(*left);
188188
}
189189
_ => {}

0 commit comments

Comments
 (0)