Skip to content

Commit 48ea1a4

Browse files
committed
ZJIT: Add hir test for ArgcParamMismatch send fallback reason
1 parent 11edc28 commit 48ea1a4

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

zjit/src/hir/opt_tests.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,47 @@ mod hir_opt_tests {
10581058
");
10591059
}
10601060

1061+
#[test]
1062+
fn test_call_with_correct_and_too_many_args_for_method() {
1063+
eval("
1064+
def target(a = 1, b = 2, c = 3, d = 4) = [a, b, c, d]
1065+
def test = [target(), target(10, 20, 30), begin; target(10, 20, 30, 40, 50) rescue ArgumentError; end]
1066+
test
1067+
test
1068+
");
1069+
assert_snapshot!(hir_string("test"), @r"
1070+
fn test@<compiled>:3:
1071+
bb0():
1072+
EntryPoint interpreter
1073+
v1:BasicObject = LoadSelf
1074+
Jump bb2(v1)
1075+
bb1(v4:BasicObject):
1076+
EntryPoint JIT(0)
1077+
Jump bb2(v4)
1078+
bb2(v6:BasicObject):
1079+
PatchPoint NoSingletonClass(Object@0x1000)
1080+
PatchPoint MethodRedefined(Object@0x1000, target@0x1008, cme:0x1010)
1081+
v44:HeapObject[class_exact*:Object@VALUE(0x1000)] = GuardType v6, HeapObject[class_exact*:Object@VALUE(0x1000)]
1082+
v45:BasicObject = SendWithoutBlockDirect v44, :target (0x1038)
1083+
v14:Fixnum[10] = Const Value(10)
1084+
v16:Fixnum[20] = Const Value(20)
1085+
v18:Fixnum[30] = Const Value(30)
1086+
PatchPoint NoSingletonClass(Object@0x1000)
1087+
PatchPoint MethodRedefined(Object@0x1000, target@0x1008, cme:0x1010)
1088+
v48:HeapObject[class_exact*:Object@VALUE(0x1000)] = GuardType v6, HeapObject[class_exact*:Object@VALUE(0x1000)]
1089+
v49:BasicObject = SendWithoutBlockDirect v48, :target (0x1038), v14, v16, v18
1090+
v24:Fixnum[10] = Const Value(10)
1091+
v26:Fixnum[20] = Const Value(20)
1092+
v28:Fixnum[30] = Const Value(30)
1093+
v30:Fixnum[40] = Const Value(40)
1094+
v32:Fixnum[50] = Const Value(50)
1095+
v34:BasicObject = SendWithoutBlock v6, :target, v24, v26, v28, v30, v32 # SendFallbackReason: Argument count does not match parameter count
1096+
v37:ArrayExact = NewArray v45, v49, v34
1097+
CheckInterrupts
1098+
Return v37
1099+
");
1100+
}
1101+
10611102
#[test]
10621103
fn test_optimize_variadic_ccall() {
10631104
eval("

0 commit comments

Comments
 (0)