diff options
| author | Takashi Kokubun <takashikkbn@gmail.com> | 2026-03-27 12:45:00 -0700 |
|---|---|---|
| committer | Takashi Kokubun <takashikkbn@gmail.com> | 2026-03-27 14:21:22 -0700 |
| commit | 6322acbd025c30004797163da1949819b9b281b1 (patch) | |
| tree | f5c48bc10a63fb201ef9613d2156d769eaa42014 /zjit | |
| parent | 324ba0831375a643e843be30fd6a3b6b0917a50c (diff) | |
ZJIT: Set fallback reasons at HIR construction instead of type_specialize
Move the InvokeBlockNotSpecialized, SendForwardNotSpecialized, and
InvokeSuperForwardNotSpecialized reasons from type_specialize match
arms to HIR construction, since type_specialize doesn't attempt to
specialize these instructions anyway.
Diffstat (limited to 'zjit')
| -rw-r--r-- | zjit/src/hir.rs | 18 | ||||
| -rw-r--r-- | zjit/src/hir/tests.rs | 18 |
2 files changed, 12 insertions, 24 deletions
diff --git a/zjit/src/hir.rs b/zjit/src/hir.rs index cd00750344..824d89b565 100644 --- a/zjit/src/hir.rs +++ b/zjit/src/hir.rs @@ -4250,18 +4250,6 @@ impl Function { continue; } } - Insn::InvokeBlock { .. } => { - self.set_dynamic_send_reason(insn_id, InvokeBlockNotSpecialized); - self.push_insn_id(block, insn_id); - } - Insn::SendForward { .. } => { - self.set_dynamic_send_reason(insn_id, SendForwardNotSpecialized); - self.push_insn_id(block, insn_id); - } - Insn::InvokeSuperForward { .. } => { - self.set_dynamic_send_reason(insn_id, InvokeSuperForwardNotSpecialized); - self.push_insn_id(block, insn_id); - } _ => { self.push_insn_id(block, insn_id); } } } @@ -8016,7 +8004,7 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> { let args = state.stack_pop_n(argc as usize + usize::from(forwarding))?; let recv = state.stack_pop()?; - let send_forward = fun.push_insn(block, Insn::SendForward { recv, cd, blockiseq, args, state: exit_id, reason: Uncategorized(opcode) }); + let send_forward = fun.push_insn(block, Insn::SendForward { recv, cd, blockiseq, args, state: exit_id, reason: SendForwardNotSpecialized }); state.stack_push(send_forward); if !blockiseq.is_null() { @@ -8088,7 +8076,7 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> { let argc = unsafe { vm_ci_argc((*cd).ci) }; let args = state.stack_pop_n(argc as usize + usize::from(forwarding))?; let recv = state.stack_pop()?; - let result = fun.push_insn(block, Insn::InvokeSuperForward { recv, cd, blockiseq, args, state: exit_id, reason: Uncategorized(opcode) }); + let result = fun.push_insn(block, Insn::InvokeSuperForward { recv, cd, blockiseq, args, state: exit_id, reason: InvokeSuperForwardNotSpecialized }); state.stack_push(result); if !blockiseq.is_null() { @@ -8123,7 +8111,7 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> { let argc = unsafe { vm_ci_argc((*cd).ci) }; let block_arg = (flags & VM_CALL_ARGS_BLOCKARG) != 0; let args = state.stack_pop_n(argc as usize + usize::from(block_arg))?; - let result = fun.push_insn(block, Insn::InvokeBlock { cd, args, state: exit_id, reason: Uncategorized(opcode) }); + let result = fun.push_insn(block, Insn::InvokeBlock { cd, args, state: exit_id, reason: InvokeBlockNotSpecialized }); state.stack_push(result); } YARVINSN_getglobal => { diff --git a/zjit/src/hir/tests.rs b/zjit/src/hir/tests.rs index 606df902f2..72012b7eba 100644 --- a/zjit/src/hir/tests.rs +++ b/zjit/src/hir/tests.rs @@ -2240,7 +2240,7 @@ pub mod hir_build_tests { v7:BasicObject = LoadArg :...@1 Jump bb3(v6, v7) bb3(v9:BasicObject, v10:BasicObject): - v16:BasicObject = InvokeSuperForward v9, 0x1008, v10 # SendFallbackReason: Uncategorized(invokesuperforward) + v16:BasicObject = InvokeSuperForward v9, 0x1008, v10 # SendFallbackReason: InvokeSuperForward: not yet specialized CheckInterrupts Return v16 "); @@ -2265,7 +2265,7 @@ pub mod hir_build_tests { v7:BasicObject = LoadArg :...@1 Jump bb3(v6, v7) bb3(v9:BasicObject, v10:BasicObject): - v16:BasicObject = InvokeSuperForward v9, 0x1008, v10 # SendFallbackReason: Uncategorized(invokesuperforward) + v16:BasicObject = InvokeSuperForward v9, 0x1008, v10 # SendFallbackReason: InvokeSuperForward: not yet specialized v17:CPtr = GetEP 0 v18:BasicObject = LoadField v17, :...@0x1010 CheckInterrupts @@ -2292,7 +2292,7 @@ pub mod hir_build_tests { v7:BasicObject = LoadArg :...@1 Jump bb3(v6, v7) bb3(v9:BasicObject, v10:BasicObject): - v16:BasicObject = InvokeSuperForward v9, 0x1008, v10 # SendFallbackReason: Uncategorized(invokesuperforward) + v16:BasicObject = InvokeSuperForward v9, 0x1008, v10 # SendFallbackReason: InvokeSuperForward: not yet specialized v18:Fixnum[1] = Const Value(1) v21:BasicObject = Send v16, :+, v18 # SendFallbackReason: Uncategorized(opt_plus) CheckInterrupts @@ -2320,7 +2320,7 @@ pub mod hir_build_tests { Jump bb3(v6, v7) bb3(v9:BasicObject, v10:BasicObject): v15:Fixnum[1] = Const Value(1) - v18:BasicObject = InvokeSuperForward v9, 0x1008, v15, v10 # SendFallbackReason: Uncategorized(invokesuperforward) + v18:BasicObject = InvokeSuperForward v9, 0x1008, v15, v10 # SendFallbackReason: InvokeSuperForward: not yet specialized CheckInterrupts Return v18 "); @@ -2431,7 +2431,7 @@ pub mod hir_build_tests { v7:BasicObject = LoadArg :...@1 Jump bb3(v6, v7) bb3(v9:BasicObject, v10:BasicObject): - v16:BasicObject = SendForward v9, 0x1008, :foo, v10 # SendFallbackReason: Uncategorized(sendforward) + v16:BasicObject = SendForward v9, 0x1008, :foo, v10 # SendFallbackReason: SendForward: not yet specialized CheckInterrupts Return v16 "); @@ -4369,7 +4369,7 @@ pub mod hir_build_tests { v42 = RefineType v38, Falsy IfFalse v41, bb4(v18, v19, v20, v21, v22, v27) v44:ObjectSubclass[BlockParamProxy] = RefineType v38, Truthy - v48:BasicObject = InvokeBlock, v27 # SendFallbackReason: Uncategorized(invokeblock) + v48:BasicObject = InvokeBlock, v27 # SendFallbackReason: InvokeBlock: not yet specialized v51:BasicObject = InvokeBuiltin dir_s_close, v18, v27 CheckInterrupts Return v48 @@ -4723,7 +4723,7 @@ pub mod hir_build_tests { v4:BasicObject = LoadArg :self@0 Jump bb3(v4) bb3(v6:BasicObject): - v10:BasicObject = InvokeBlock # SendFallbackReason: Uncategorized(invokeblock) + v10:BasicObject = InvokeBlock # SendFallbackReason: InvokeBlock: not yet specialized CheckInterrupts Return v10 "); @@ -4752,7 +4752,7 @@ pub mod hir_build_tests { v9:BasicObject = LoadArg :y@2 Jump bb3(v7, v8, v9) bb3(v11:BasicObject, v12:BasicObject, v13:BasicObject): - v19:BasicObject = InvokeBlock, v12, v13 # SendFallbackReason: Uncategorized(invokeblock) + v19:BasicObject = InvokeBlock, v12, v13 # SendFallbackReason: InvokeBlock: not yet specialized CheckInterrupts Return v19 "); @@ -5038,7 +5038,7 @@ pub mod hir_build_tests { Return v48 bb7(v67:BasicObject, v68:Fixnum): v72:BasicObject = InvokeBuiltin rb_jit_ary_at, v67, v68 - v74:BasicObject = InvokeBlock, v72 # SendFallbackReason: Uncategorized(invokeblock) + v74:BasicObject = InvokeBlock, v72 # SendFallbackReason: InvokeBlock: not yet specialized v78:Fixnum = InvokeBuiltin rb_jit_fixnum_inc, v67, v68 PatchPoint NoEPEscape(each) Jump bb8(v67, v78) |
