summaryrefslogtreecommitdiff
path: root/Zend/zend_execute.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2017-11-22 15:36:09 +0300
committerDmitry Stogov <dmitry@zend.com>2017-11-22 15:36:09 +0300
commit6780c746198e01f52affb86f998108419a8621ed (patch)
treea76aa3813780e6acb9db5022cdc63ce6d5d39917 /Zend/zend_execute.c
parente69fa2865f60810a3ad8cf333628a69a21dbf847 (diff)
downloadphp-git-6780c746198e01f52affb86f998108419a8621ed.tar.gz
Allowed modification of VM stack page size. Exported few functions. Green light for Fibers/Coroutines.
Diffstat (limited to 'Zend/zend_execute.c')
-rw-r--r--Zend/zend_execute.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index b44922f395..51ad74f4f2 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -166,9 +166,6 @@ ZEND_API const zend_internal_function zend_pass_function = {
#define ZEND_VM_STACK_PAGE_SIZE (ZEND_VM_STACK_PAGE_SLOTS * sizeof(zval))
-#define ZEND_VM_STACK_FREE_PAGE_SIZE \
- ((ZEND_VM_STACK_PAGE_SLOTS - ZEND_VM_STACK_HEADER_SLOTS) * sizeof(zval))
-
#define ZEND_VM_STACK_PAGE_ALIGNED_SIZE(size) \
(((size) + ZEND_VM_STACK_HEADER_SLOTS * sizeof(zval) \
+ (ZEND_VM_STACK_PAGE_SIZE - 1)) & ~(ZEND_VM_STACK_PAGE_SIZE - 1))
@@ -184,6 +181,7 @@ 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_page_size) = ZEND_VM_STACK_PAGE_SIZE;
EG(vm_stack) = zend_vm_stack_new_page(ZEND_VM_STACK_PAGE_SIZE, NULL);
EG(vm_stack)->top++;
EG(vm_stack_top) = EG(vm_stack)->top;
@@ -209,8 +207,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 < EG(vm_stack_page_size) - (ZEND_VM_STACK_HEADER_SLOTS * sizeof(zval))) ?
+ EG(vm_stack_page_size) : ZEND_VM_STACK_PAGE_ALIGNED_SIZE(size),
stack);
ptr = stack->top;
EG(vm_stack_top) = (void*)(((char*)ptr) + size);
@@ -2092,7 +2090,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);
}
@@ -2500,7 +2498,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);
}