summaryrefslogtreecommitdiff
path: root/Zend/zend_execute.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2015-03-17 18:53:19 +0300
committerDmitry Stogov <dmitry@zend.com>2015-03-17 18:53:19 +0300
commit4d4a5336f149fc0d49ac8fa10f0f85fa364366ac (patch)
tree7a496c53ce0989c5aac1d396151713d7d52a80e8 /Zend/zend_execute.c
parentfb4b7069842491eb66272587422a1f61d41eb869 (diff)
downloadphp-git-4d4a5336f149fc0d49ac8fa10f0f85fa364366ac.tar.gz
Embed "fast" operator functions (add, sub, increment, etc) into executor with additional optimizations
Diffstat (limited to 'Zend/zend_execute.c')
-rw-r--r--Zend/zend_execute.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 17e68dc55d..42e9673744 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -53,6 +53,7 @@ typedef int (ZEND_FASTCALL *incdec_t)(zval *);
#define get_zval_ptr(op_type, node, ex, should_free, type) _get_zval_ptr(op_type, node, ex, should_free, type)
#define get_zval_ptr_deref(op_type, node, ex, should_free, type) _get_zval_ptr_deref(op_type, node, ex, should_free, type)
+#define get_zval_ptr_undef(op_type, node, ex, should_free, type) _get_zval_ptr_undef(op_type, node, ex, should_free, type)
#define get_zval_ptr_ptr(op_type, node, ex, should_free, type) _get_zval_ptr_ptr(op_type, node, ex, should_free, type)
#define get_zval_ptr_ptr_undef(op_type, node, ex, should_free, type) _get_zval_ptr_ptr(op_type, node, ex, should_free, type)
#define get_obj_zval_ptr(op_type, node, ex, should_free, type) _get_obj_zval_ptr(op_type, node, ex, should_free, type)
@@ -283,6 +284,11 @@ static zend_always_inline zval *_get_zval_ptr_cv(const zend_execute_data *execut
return ret;
}
+static zend_always_inline zval *_get_zval_ptr_cv_undef(const zend_execute_data *execute_data, uint32_t var)
+{
+ return EX_VAR(var);
+}
+
static zend_always_inline zval *_get_zval_ptr_cv_deref(const zend_execute_data *execute_data, uint32_t var, int type)
{
zval *ret = EX_VAR(var);
@@ -387,6 +393,11 @@ static zend_always_inline zval *_get_zval_ptr_cv_undef_BP_VAR_W(const zend_execu
return EX_VAR(var);
}
+static zend_always_inline zval *_get_zval_ptr_cv_undef_BP_VAR_RW(const zend_execute_data *execute_data, uint32_t var)
+{
+ return EX_VAR(var);
+}
+
static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_W(const zend_execute_data *execute_data, uint32_t var)
{
zval *ret = EX_VAR(var);
@@ -440,6 +451,27 @@ static zend_always_inline zval *_get_zval_ptr_deref(int op_type, znode_op node,
}
}
+static zend_always_inline zval *_get_zval_ptr_undef(int op_type, znode_op node, const zend_execute_data *execute_data, zend_free_op *should_free, int type)
+{
+ if (op_type & (IS_TMP_VAR|IS_VAR)) {
+ if (op_type == IS_TMP_VAR) {
+ return _get_zval_ptr_tmp(node.var, execute_data, should_free);
+ } else {
+ ZEND_ASSERT(op_type == IS_VAR);
+ return _get_zval_ptr_var(node.var, execute_data, should_free);
+ }
+ } else {
+ *should_free = NULL;
+ if (op_type == IS_CONST) {
+ return EX_CONSTANT(node);
+ } else if (op_type == IS_CV) {
+ return _get_zval_ptr_cv_undef(execute_data, node.var);
+ } else {
+ return NULL;
+ }
+ }
+}
+
static zend_always_inline zval *_get_zval_ptr_ptr_var(uint32_t var, const zend_execute_data *execute_data, zend_free_op *should_free)
{
zval *ret = EX_VAR(var);
@@ -2093,6 +2125,11 @@ static zend_always_inline void zend_vm_stack_extend_call_frame(zend_execute_data
# define ZEND_VM_GUARD(name)
#endif
+#define GET_OP1_UNDEF_CV(ptr, type) \
+ _get_zval_cv_lookup_ ## type(ptr, opline->op1.var, execute_data)
+#define GET_OP2_UNDEF_CV(ptr, type) \
+ _get_zval_cv_lookup_ ## type(ptr, opline->op2.var, execute_data)
+
#include "zend_vm_execute.h"
ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode, user_opcode_handler_t handler)