diff options
| author | Randy Stauner <randy@r4s6.net> | 2025-11-05 12:08:28 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-05 19:08:28 +0000 |
| commit | 4f56abbb0a3e25972b246fa516718520e5cd27e9 (patch) | |
| tree | 0f80601b387aa98e1ead816b761d2dc82757d361 | |
| parent | bf0331b907ae7f25b9464081682218ab74e3ccb6 (diff) | |
ZJIT: Don't side-exit on VM_CALL_KWARG just SendWithoutBlock (#15065)
| -rw-r--r-- | zjit/src/hir.rs | 6 | ||||
| -rw-r--r-- | zjit/src/hir/opt_tests.rs | 10 | ||||
| -rw-r--r-- | zjit/src/hir/tests.rs | 4 |
3 files changed, 14 insertions, 6 deletions
diff --git a/zjit/src/hir.rs b/zjit/src/hir.rs index b26d2ffa04..9762a87dd4 100644 --- a/zjit/src/hir.rs +++ b/zjit/src/hir.rs @@ -2286,7 +2286,7 @@ impl Function { }; let ci = unsafe { get_call_data_ci(cd) }; // info about the call site - // If the call site info indicates that the `Function` has `VM_CALL_ARGS_SPLAT` set, then + // If the call site info indicates that the `Function` has overly complex arguments, then // do not optimize into a `SendWithoutBlockDirect`. let flags = unsafe { rb_vm_ci_flag(ci) }; if unspecializable_call_type(flags) { @@ -4265,13 +4265,13 @@ fn num_locals(iseq: *const rb_iseq_t) -> usize { /// If we can't handle the type of send (yet), bail out. fn unhandled_call_type(flags: u32) -> Result<(), CallType> { - if (flags & VM_CALL_KWARG) != 0 { return Err(CallType::Kwarg); } if (flags & VM_CALL_TAILCALL) != 0 { return Err(CallType::Tailcall); } Ok(()) } -/// If a given call uses splatting or block arguments, then we won't specialize. +/// If a given call uses overly complex arguments, then we won't specialize. fn unspecializable_call_type(flags: u32) -> bool { + ((flags & VM_CALL_KWARG) != 0) || ((flags & VM_CALL_ARGS_SPLAT) != 0) || ((flags & VM_CALL_ARGS_BLOCKARG) != 0) } diff --git a/zjit/src/hir/opt_tests.rs b/zjit/src/hir/opt_tests.rs index 6fc890f385..f824351eca 100644 --- a/zjit/src/hir/opt_tests.rs +++ b/zjit/src/hir/opt_tests.rs @@ -2659,7 +2659,10 @@ mod hir_opt_tests { Jump bb2(v4) bb2(v6:BasicObject): v10:Fixnum[1] = Const Value(1) - SideExit UnhandledCallType(Kwarg) + IncrCounter complex_arg_pass_caller_kwarg + v12:BasicObject = SendWithoutBlock v6, :foo, v10 + CheckInterrupts + Return v12 "); } @@ -2682,7 +2685,10 @@ mod hir_opt_tests { Jump bb2(v4) bb2(v6:BasicObject): v10:Fixnum[1] = Const Value(1) - SideExit UnhandledCallType(Kwarg) + IncrCounter complex_arg_pass_caller_kwarg + v12:BasicObject = SendWithoutBlock v6, :foo, v10 + CheckInterrupts + Return v12 "); } diff --git a/zjit/src/hir/tests.rs b/zjit/src/hir/tests.rs index fe67779d85..a8738a0715 100644 --- a/zjit/src/hir/tests.rs +++ b/zjit/src/hir/tests.rs @@ -1572,7 +1572,9 @@ pub mod hir_build_tests { Jump bb2(v5, v6) bb2(v8:BasicObject, v9:BasicObject): v13:Fixnum[1] = Const Value(1) - SideExit UnhandledCallType(Kwarg) + v15:BasicObject = SendWithoutBlock v8, :foo, v13 + CheckInterrupts + Return v15 "); } |
