summaryrefslogtreecommitdiff
path: root/Zend/zend_execute.h
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2019-04-11 02:08:32 +0300
committerDmitry Stogov <dmitry@zend.com>2019-04-11 02:08:32 +0300
commitcc900edd775dc87e74b5412e7cea324a60a01e74 (patch)
tree9c234bf2bf89d1ac88eccbd6f4cda1b292aa0e3a /Zend/zend_execute.h
parent0d91b046a39d44fff3446bdfd5bfd76a1e17e641 (diff)
downloadphp-git-cc900edd775dc87e74b5412e7cea324a60a01e74.tar.gz
Simplify call frame initialization
Diffstat (limited to 'Zend/zend_execute.h')
-rw-r--r--Zend/zend_execute.h21
1 files changed, 8 insertions, 13 deletions
diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
index 78b33171df..4abdaca9fd 100644
--- a/Zend/zend_execute.h
+++ b/Zend/zend_execute.h
@@ -206,20 +206,15 @@ ZEND_API void zend_vm_stack_init_ex(size_t page_size);
ZEND_API void zend_vm_stack_destroy(void);
ZEND_API void* zend_vm_stack_extend(size_t size);
-static zend_always_inline void zend_vm_init_call_frame(zend_execute_data *call, uint32_t call_info, zend_function *func, uint32_t num_args, zend_class_entry *called_scope, zend_object *object)
+static zend_always_inline void zend_vm_init_call_frame(zend_execute_data *call, uint32_t call_info, zend_function *func, uint32_t num_args, void *object_or_called_scope)
{
call->func = func;
- if (object) {
- Z_OBJ(call->This) = object;
- ZEND_SET_CALL_INFO(call, 1, call_info);
- } else {
- Z_CE(call->This) = called_scope;
- ZEND_SET_CALL_INFO(call, 0, call_info);
- }
+ Z_PTR(call->This) = object_or_called_scope;
+ ZEND_CALL_INFO(call) = call_info;
ZEND_CALL_NUM_ARGS(call) = num_args;
}
-static zend_always_inline zend_execute_data *zend_vm_stack_push_call_frame_ex(uint32_t used_stack, uint32_t call_info, zend_function *func, uint32_t num_args, zend_class_entry *called_scope, zend_object *object)
+static zend_always_inline zend_execute_data *zend_vm_stack_push_call_frame_ex(uint32_t used_stack, uint32_t call_info, zend_function *func, uint32_t num_args, void *object_or_called_scope)
{
zend_execute_data *call = (zend_execute_data*)EG(vm_stack_top);
@@ -228,11 +223,11 @@ static zend_always_inline zend_execute_data *zend_vm_stack_push_call_frame_ex(ui
if (UNEXPECTED(used_stack > (size_t)(((char*)EG(vm_stack_end)) - (char*)call))) {
call = (zend_execute_data*)zend_vm_stack_extend(used_stack);
ZEND_ASSERT_VM_STACK_GLOBAL;
- zend_vm_init_call_frame(call, call_info | ZEND_CALL_ALLOCATED, func, num_args, called_scope, object);
+ zend_vm_init_call_frame(call, call_info | ZEND_CALL_ALLOCATED, func, num_args, object_or_called_scope);
return call;
} else {
EG(vm_stack_top) = (zval*)((char*)call + used_stack);
- zend_vm_init_call_frame(call, call_info, func, num_args, called_scope, object);
+ zend_vm_init_call_frame(call, call_info, func, num_args, object_or_called_scope);
return call;
}
}
@@ -247,12 +242,12 @@ static zend_always_inline uint32_t zend_vm_calc_used_stack(uint32_t num_args, ze
return used_stack * sizeof(zval);
}
-static zend_always_inline zend_execute_data *zend_vm_stack_push_call_frame(uint32_t call_info, zend_function *func, uint32_t num_args, zend_class_entry *called_scope, zend_object *object)
+static zend_always_inline zend_execute_data *zend_vm_stack_push_call_frame(uint32_t call_info, zend_function *func, uint32_t num_args, void *object_or_called_scope)
{
uint32_t used_stack = zend_vm_calc_used_stack(num_args, func);
return zend_vm_stack_push_call_frame_ex(used_stack, call_info,
- func, num_args, called_scope, object);
+ func, num_args, object_or_called_scope);
}
static zend_always_inline void zend_vm_stack_free_extra_args_ex(uint32_t call_info, zend_execute_data *call)