Skip to content

Commit 6af994d

Browse files
morrisonleviclaude
andcommitted
Remove unused zend_interrupt CALL variant; simplify delayed helpers macro
The CALL variant of zend_interrupt was never called: delayed helpers only exist in TAILCALL builds ($delayed_helpers is only populated when $kind === ZEND_VM_KIND_TAILCALL), so the #elif/#else branches in the ZEND_VM_INTERRUPT macro were dead code, and zend_interrupt itself was compiled but unreferenced — triggering an unused-function warning on macOS ARM64 DEBUG NTS. Remove the CALL case from gen_interrupt_func, drop its forward declaration from the CALL section preamble, and replace the three-way C-level #if in the delayed helpers ZEND_VM_INTERRUPT macro with a single unconditional line (the TAILCALL sentinel path), since that block is only ever emitted for TAILCALL builds. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f9fd505 commit 6af994d

2 files changed

Lines changed: 2 additions & 40 deletions

File tree

Zend/zend_vm_execute.h

Lines changed: 0 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Zend/zend_vm_gen.php

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,23 +1595,10 @@ function gen_halt_handler($f, $kind) {
15951595
}
15961596

15971597
function gen_interrupt_func($f, $kind, $spec) {
1598-
$cconv = $kind === ZEND_VM_KIND_TAILCALL ? 'ZEND_OPCODE_HANDLER_CCONV' : 'ZEND_OPCODE_HANDLER_FUNC_CCONV';
1599-
$variant = $kind === ZEND_VM_KIND_TAILCALL ? '_TAILCALL' : '';
1600-
if ($kind !== ZEND_VM_KIND_TAILCALL) {
1601-
/* Guard: exclude global-reg builds (void return) and TAILCALL builds (have own variant) */
1602-
out($f, "#if !(defined(ZEND_VM_FP_GLOBAL_REG) && defined(ZEND_VM_IP_GLOBAL_REG)) && ZEND_VM_KIND != ZEND_VM_KIND_TAILCALL\n");
1603-
}
1604-
out($f, "static ZEND_COLD zend_never_inline ZEND_OPCODE_HANDLER_RET {$cconv} zend_interrupt{$variant}(ZEND_OPCODE_HANDLER_ARGS) {\n");
1598+
out($f, "static ZEND_COLD zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV zend_interrupt_TAILCALL(ZEND_OPCODE_HANDLER_ARGS) {\n");
16051599
out($f,"\tSAVE_OPLINE();\n");
1606-
if ($kind === ZEND_VM_KIND_TAILCALL) {
1607-
out($f,"\tZEND_VM_TAIL_CALL(zend_interrupt_helper".($spec?"_SPEC":"")."_TAILCALL(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));\n");
1608-
} else {
1609-
out($f, "\treturn zend_interrupt_helper".($spec?"_SPEC":"")."(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n");
1610-
}
1600+
out($f,"\tZEND_VM_TAIL_CALL(zend_interrupt_helper".($spec?"_SPEC":"")."_TAILCALL(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));\n");
16111601
out($f, "}\n");
1612-
if ($kind !== ZEND_VM_KIND_TAILCALL) {
1613-
out($f, "#endif\n");
1614-
}
16151602
}
16161603

16171604
function extra_spec_name($extra_spec) {
@@ -1824,7 +1811,6 @@ function gen_executor_code($f, $spec, $kind, $prolog, &$switch_labels = array())
18241811
switch ($kind) {
18251812
case ZEND_VM_KIND_CALL:
18261813
gen_null_handler($f, $kind);
1827-
gen_interrupt_func($f, $kind, $spec);
18281814
break;
18291815
case ZEND_VM_KIND_TAILCALL:
18301816
gen_null_handler($f, $kind);
@@ -1867,13 +1853,7 @@ function gen_executor_code($f, $spec, $kind, $prolog, &$switch_labels = array())
18671853
out($f, "#pragma push_macro(\"ZEND_VM_INTERRUPT\")\n");
18681854
out($f, "#undef ZEND_VM_INTERRUPT\n");
18691855
out($f, "#define ZEND_VM_CONTINUE(handler) return opline\n");
1870-
out($f, "#if ZEND_VM_KIND == ZEND_VM_KIND_TAILCALL\n");
18711856
out($f, "# define ZEND_VM_INTERRUPT() SAVE_OPLINE(); return &call_interrupt_op;\n");
1872-
out($f, "#elif defined(ZEND_VM_FP_GLOBAL_REG) && defined(ZEND_VM_IP_GLOBAL_REG)\n");
1873-
out($f, "# define ZEND_VM_INTERRUPT() return zend_interrupt_helper".($spec?"_SPEC":"")."(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n");
1874-
out($f, "#else\n");
1875-
out($f, "# define ZEND_VM_INTERRUPT() return zend_interrupt(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n");
1876-
out($f, "#endif\n");
18771857
out($f, $delayed_helpers);
18781858
out($f, "#pragma pop_macro(\"ZEND_VM_INTERRUPT\")\n");
18791859
out($f, "#pragma pop_macro(\"ZEND_VM_CONTINUE\")\n");
@@ -2069,9 +2049,6 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name)
20692049
}
20702050
out($f,"\n");
20712051
out($f,"static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV zend_interrupt_helper".($spec?"_SPEC":"")."(ZEND_OPCODE_HANDLER_ARGS);\n");
2072-
out($f,"#if !(defined(ZEND_VM_FP_GLOBAL_REG) && defined(ZEND_VM_IP_GLOBAL_REG)) && ZEND_VM_KIND != ZEND_VM_KIND_TAILCALL\n");
2073-
out($f,"static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV zend_interrupt(ZEND_OPCODE_HANDLER_ARGS);\n");
2074-
out($f,"#endif\n");
20752052
out($f,"static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_NULL_HANDLER(ZEND_OPCODE_HANDLER_ARGS);\n");
20762053
out($f,"\n");
20772054
break;

0 commit comments

Comments
 (0)