Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Zend/zend_vm_gen.php
Original file line number Diff line number Diff line change
Expand Up @@ -2523,7 +2523,7 @@ function gen_vm_opcodes_header(
$str .= "# define ZEND_VM_KIND\t\tZEND_VM_KIND_HYBRID\n";
}
if ($GLOBALS["vm_kind_name"][ZEND_VM_GEN_KIND] === "ZEND_VM_KIND_HYBRID" || $GLOBALS["vm_kind_name"][ZEND_VM_GEN_KIND] === "ZEND_VM_KIND_CALL") {
$str .= "#elif defined(HAVE_MUSTTAIL) && defined(HAVE_PRESERVE_NONE) && (defined(__x86_64__) || defined(__aarch64__)) && defined(__clang__)\n";
$str .= "#elif defined(HAVE_MUSTTAIL) && defined(HAVE_PRESERVE_NONE) && (defined(__x86_64__) || defined(__aarch64__))\n";
$str .= "# define ZEND_VM_KIND\t\tZEND_VM_KIND_TAILCALL\n";
$str .= "#else\n";
$str .= "# define ZEND_VM_KIND\t\tZEND_VM_KIND_CALL\n";
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_vm_opcodes.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions ext/opcache/jit/zend_jit.c
Original file line number Diff line number Diff line change
Expand Up @@ -3099,6 +3099,12 @@ static int zend_real_jit_func(zend_op_array *op_array, zend_script *script, cons
return FAILURE;
}

#if defined(__GNUC__) && !defined(__clang__) && ZEND_VM_KIND == ZEND_VM_KIND_TAILCALL
/* GCC cannot tail-call from a function that uses setjmp. */
static zend_never_inline void zend_runtime_jit_compile(zend_op_array *op_array)
{
const zend_op *opline = op_array->opcodes;
#else
/* Run-time JIT handler */
#if ZEND_VM_KIND == ZEND_VM_KIND_CALL || ZEND_VM_KIND == ZEND_VM_KIND_TAILCALL
static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV zend_runtime_jit(ZEND_OPCODE_HANDLER_ARGS)
Expand All @@ -3116,6 +3122,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV zend_runtime_jit(Z
execute_data = EG(current_execute_data);
zend_op_array *op_array = &EX(func)->op_array;
opline = op_array->opcodes;
#endif
zend_jit_op_array_extension *jit_extension;
bool do_bailout = 0;

Expand Down Expand Up @@ -3154,6 +3161,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV zend_runtime_jit(Z
zend_bailout();
}

#if defined(__GNUC__) && !defined(__clang__) && ZEND_VM_KIND == ZEND_VM_KIND_TAILCALL
}

static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV zend_runtime_jit(ZEND_OPCODE_HANDLER_ARGS)
{
const zend_op *orig_opline = opline;
execute_data = EG(current_execute_data);
zend_runtime_jit_compile(&EX(func)->op_array);
#endif

/* JIT-ed code is going to be called by VM */
#if GCC_GLOBAL_REGS
return; // ZEND_VM_CONTINUE
Expand Down
Loading