Skip to content

Commit e1f60aa

Browse files
rwstaunerjacob-shops
authored andcommitted
ZJIT: Don't side-exit on VM_CALL_KWARG just SendWithoutBlock (ruby#15065)
1 parent 61ed7bb commit e1f60aa

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

zjit/src/hir.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2286,7 +2286,7 @@ impl Function {
22862286
};
22872287
let ci = unsafe { get_call_data_ci(cd) }; // info about the call site
22882288

2289-
// If the call site info indicates that the `Function` has `VM_CALL_ARGS_SPLAT` set, then
2289+
// If the call site info indicates that the `Function` has overly complex arguments, then
22902290
// do not optimize into a `SendWithoutBlockDirect`.
22912291
let flags = unsafe { rb_vm_ci_flag(ci) };
22922292
if unspecializable_call_type(flags) {
@@ -4265,13 +4265,13 @@ fn num_locals(iseq: *const rb_iseq_t) -> usize {
42654265

42664266
/// If we can't handle the type of send (yet), bail out.
42674267
fn unhandled_call_type(flags: u32) -> Result<(), CallType> {
4268-
if (flags & VM_CALL_KWARG) != 0 { return Err(CallType::Kwarg); }
42694268
if (flags & VM_CALL_TAILCALL) != 0 { return Err(CallType::Tailcall); }
42704269
Ok(())
42714270
}
42724271

4273-
/// If a given call uses splatting or block arguments, then we won't specialize.
4272+
/// If a given call uses overly complex arguments, then we won't specialize.
42744273
fn unspecializable_call_type(flags: u32) -> bool {
4274+
((flags & VM_CALL_KWARG) != 0) ||
42754275
((flags & VM_CALL_ARGS_SPLAT) != 0) ||
42764276
((flags & VM_CALL_ARGS_BLOCKARG) != 0)
42774277
}

zjit/src/hir/opt_tests.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2659,7 +2659,10 @@ mod hir_opt_tests {
26592659
Jump bb2(v4)
26602660
bb2(v6:BasicObject):
26612661
v10:Fixnum[1] = Const Value(1)
2662-
SideExit UnhandledCallType(Kwarg)
2662+
IncrCounter complex_arg_pass_caller_kwarg
2663+
v12:BasicObject = SendWithoutBlock v6, :foo, v10
2664+
CheckInterrupts
2665+
Return v12
26632666
");
26642667
}
26652668

@@ -2682,7 +2685,10 @@ mod hir_opt_tests {
26822685
Jump bb2(v4)
26832686
bb2(v6:BasicObject):
26842687
v10:Fixnum[1] = Const Value(1)
2685-
SideExit UnhandledCallType(Kwarg)
2688+
IncrCounter complex_arg_pass_caller_kwarg
2689+
v12:BasicObject = SendWithoutBlock v6, :foo, v10
2690+
CheckInterrupts
2691+
Return v12
26862692
");
26872693
}
26882694

zjit/src/hir/tests.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1572,7 +1572,9 @@ pub mod hir_build_tests {
15721572
Jump bb2(v5, v6)
15731573
bb2(v8:BasicObject, v9:BasicObject):
15741574
v13:Fixnum[1] = Const Value(1)
1575-
SideExit UnhandledCallType(Kwarg)
1575+
v15:BasicObject = SendWithoutBlock v8, :foo, v13
1576+
CheckInterrupts
1577+
Return v15
15761578
");
15771579
}
15781580

0 commit comments

Comments
 (0)