Skip to content
Closed
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
16 changes: 11 additions & 5 deletions Zend/zend_execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,13 @@ static zend_always_inline zend_vm_stack zend_vm_stack_new_page(size_t size, zend

ZEND_API void zend_vm_stack_init(void)
{
EG(vm_stack) = zend_vm_stack_new_page(ZEND_VM_STACK_PAGE_SIZE, NULL);
zend_vm_stack_init_ex(ZEND_VM_STACK_PAGE_SIZE);
}

ZEND_API void zend_vm_stack_init_ex(size_t size)
{
EG(vm_stack) = zend_vm_stack_new_page(ZEND_VM_STACK_PAGE_ALIGNED_SIZE(size), NULL);
EG(vm_stack)->frame_size = size;
EG(vm_stack)->top++;
EG(vm_stack_top) = EG(vm_stack)->top;
EG(vm_stack_end) = EG(vm_stack)->end;
Expand All @@ -209,8 +215,8 @@ ZEND_API void* zend_vm_stack_extend(size_t size)
stack = EG(vm_stack);
stack->top = EG(vm_stack_top);
EG(vm_stack) = stack = zend_vm_stack_new_page(
EXPECTED(size < ZEND_VM_STACK_FREE_PAGE_SIZE) ?
ZEND_VM_STACK_PAGE_SIZE : ZEND_VM_STACK_PAGE_ALIGNED_SIZE(size),
EXPECTED(size < stack->frame_size) ?
ZEND_VM_STACK_PAGE_ALIGNED_SIZE(stack->frame_size) : ZEND_VM_STACK_PAGE_ALIGNED_SIZE(size),
stack);
ptr = stack->top;
EG(vm_stack_top) = (void*)(((char*)ptr) + size);
Expand Down Expand Up @@ -2092,7 +2098,7 @@ static zend_always_inline void i_free_compiled_variables(zend_execute_data *exec
}
/* }}} */

void zend_free_compiled_variables(zend_execute_data *execute_data) /* {{{ */
ZEND_API void zend_free_compiled_variables(zend_execute_data *execute_data) /* {{{ */
{
i_free_compiled_variables(execute_data);
}
Expand Down Expand Up @@ -2500,7 +2506,7 @@ static void cleanup_live_vars(zend_execute_data *execute_data, uint32_t op_num,
}
/* }}} */

void zend_cleanup_unfinished_execution(zend_execute_data *execute_data, uint32_t op_num, uint32_t catch_op_num) {
ZEND_API void zend_cleanup_unfinished_execution(zend_execute_data *execute_data, uint32_t op_num, uint32_t catch_op_num) {
cleanup_unfinished_calls(execute_data, op_num);
cleanup_live_vars(execute_data, op_num, catch_op_num);
}
Expand Down
6 changes: 4 additions & 2 deletions Zend/zend_execute.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ struct _zend_vm_stack {
zval *top;
zval *end;
zend_vm_stack prev;
size_t frame_size;
};

#define ZEND_VM_STACK_HEADER_SLOTS \
Expand All @@ -162,6 +163,7 @@ struct _zend_vm_stack {
#endif

ZEND_API void zend_vm_stack_init(void);
ZEND_API void zend_vm_stack_init_ex(size_t size);
ZEND_API void zend_vm_stack_destroy(void);
ZEND_API void* zend_vm_stack_extend(size_t size);

Expand Down Expand Up @@ -322,8 +324,8 @@ typedef zval* zend_free_op;
ZEND_API zval *zend_get_zval_ptr(const zend_op *opline, int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type);

ZEND_API void zend_clean_and_cache_symbol_table(zend_array *symbol_table);
void zend_free_compiled_variables(zend_execute_data *execute_data);
void zend_cleanup_unfinished_execution(zend_execute_data *execute_data, uint32_t op_num, uint32_t catch_op_num);
ZEND_API void zend_free_compiled_variables(zend_execute_data *execute_data);
ZEND_API void zend_cleanup_unfinished_execution(zend_execute_data *execute_data, uint32_t op_num, uint32_t catch_op_num);

ZEND_API int ZEND_FASTCALL zend_do_fcall_overloaded(zend_execute_data *call, zval *ret);

Expand Down