Skip to content

Commit ad7d2aa

Browse files
committed
Tail call VM
1 parent 4a98b36 commit ad7d2aa

13 files changed

+60664
-1772
lines changed

‎Zend/zend_compile.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "zend_types.h"
2525
#include "zend_map_ptr.h"
2626
#include "zend_alloc.h"
27+
#include "zend_vm_opcodes.h"
2728

2829
#include <stdarg.h>
2930
#include <stdint.h>
@@ -135,7 +136,7 @@ void zend_const_expr_to_zval(zval *result, zend_ast **ast_ptr, bool allow_dynami
135136
typedef int (*user_opcode_handler_t) (zend_execute_data *execute_data);
136137

137138
struct _zend_op {
138-
const void *handler;
139+
zend_vm_opcode_handler_t handler;
139140
znode_op op1;
140141
znode_op op2;
141142
znode_op result;

‎Zend/zend_portability.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,24 @@ char *alloca();
318318
# define ZEND_FASTCALL
319319
#endif
320320

321+
/* Compilers may report to have preserve_none, while supporting it only on some architectures */
322+
#if __has_attribute(preserve_none) && (defined(__x86_64__) || defined(__aarch64__))
323+
# define HAVE_PRESERVE_NONE
324+
# define ZEND_PRESERVE_NONE __attribute__((preserve_none))
325+
#else
326+
# define ZEND_PRESERVE_NONE
327+
#endif
328+
329+
#if __has_attribute(musttail)
330+
# define HAVE_MUSTTAIL
331+
# define ZEND_MUSTTAIL __attribute__((musttail))
332+
#endif
333+
334+
#if __has_attribute(sysv_abi)
335+
# define HAVE_SYSV_ABI
336+
# define ZEND_SYSV_ABI __attribute__((sysv_abi))
337+
#endif
338+
321339
#if (defined(__GNUC__) && __GNUC__ >= 3 && !defined(__INTEL_COMPILER) && !defined(__APPLE__) && !defined(__hpux) && !defined(_AIX) && !defined(__osf__)) || __has_attribute(noreturn)
322340
# define HAVE_NORETURN
323341
# define ZEND_NORETURN __attribute__((noreturn))

‎Zend/zend_vm_def.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4917,7 +4917,7 @@ ZEND_VM_HOT_SEND_HANDLER(116, ZEND_SEND_VAL_EX, CONST|TMP, CONST|UNUSED|NUM, SPE
49174917
ZEND_VM_C_GOTO(send_val_by_ref);
49184918
}
49194919
} else if (ARG_MUST_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
4920-
ZEND_VM_C_LABEL(send_val_by_ref):
4920+
ZEND_VM_C_LABEL(send_val_by_ref):;
49214921
ZEND_VM_DISPATCH_TO_HELPER(zend_cannot_pass_by_ref_helper, _arg_num, arg_num, _arg, arg);
49224922
}
49234923
value = GET_OP1_ZVAL_PTR(BP_VAR_R);
@@ -8231,9 +8231,9 @@ ZEND_VM_HANDLER(150, ZEND_USER_OPCODE, ANY, ANY)
82318231
case ZEND_USER_OPCODE_LEAVE:
82328232
ZEND_VM_LEAVE();
82338233
case ZEND_USER_OPCODE_DISPATCH:
8234-
ZEND_VM_DISPATCH(opline->opcode, opline);
8234+
ZEND_VM_DISPATCH_OPCODE(opline->opcode, opline);
82358235
default:
8236-
ZEND_VM_DISPATCH((uint8_t)(ret & 0xff), opline);
8236+
ZEND_VM_DISPATCH_OPCODE((uint8_t)(ret & 0xff), opline);
82378237
}
82388238
}
82398239

0 commit comments

Comments
 (0)