8000 Merge pull request #93 from Shopify/genchecktype-bug · eileencodes/ruby@465611c · GitHub
[go: up one dir, main page]

Skip to content

Commit 465611c

Browse files
authored
Merge pull request ruby#93 from Shopify/genchecktype-bug
Fix bug in generic case for gen_checktype
2 parents 6698e43 + 0c65a4d commit 465611c

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

bootstraptest/test_yjit.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,6 +1154,26 @@ def foo(foo, bar)
11541154
foo(5,2)
11551155
}
11561156

1157+
# test pattern matching
1158+
assert_equal '[:ok, :ok]', %q{
1159+
class C
1160+
def destructure_keys
1161+
{}
1162+
end
1163+
end
1164+
1165+
pattern_match = ->(i) do
1166+
case i
1167+
in a: 0
1168+
:ng
1169+
else
1170+
:ok
1171+
end
1172+
end
1173+
1174+
[{}, C.new].map(&pattern_match)
1175+
}
1176+
11571177
# Call to object with singleton
11581178
assert_equal '123', %q{
11591179
obj = Object.new

yjit_codegen.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,6 +1419,7 @@ gen_checktype(jitstate_t* jit, ctx_t* ctx)
14191419
mov(cb, REG0, mem_opnd(64, REG0, offsetof(struct RBasic, flags)));
14201420
and(cb, REG0, imm_opnd(RUBY_T_MASK));
14211421
cmp(cb, REG0, imm_opnd(type_val));
1422+
mov(cb, REG0, imm_opnd(Qtrue));
14221423
mov(cb, REG1, imm_opnd(Qfalse));
14231424
cmovne(cb, REG0, REG1);
14241425

0 commit comments

Comments
 (0)
0