From: Dmitry Stogov Date: Wed, 22 Aug 2018 07:43:51 +0000 (+0300) Subject: Stop using zend_function->reserved[] space. X-Git-Tag: php-7.3.0beta3~20 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8d95f561e45b5aee5398c772284bdeff03fbb475;p=php Stop using zend_function->reserved[] space. --- diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 494c889221..56808e2496 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -234,7 +234,8 @@ static ZEND_NAMED_FUNCTION(zend_closure_call_magic) /* {{{ */ { fci.size = sizeof(zend_fcall_info); fci.retval = return_value; - fcc.function_handler = (zend_function *) EX(func)->internal_function.reserved[0]; + fcc.function_handler = (EX(func)->internal_function.fn_flags & ZEND_ACC_STATIC) ? + EX(func)->internal_function.scope->__callstatic : EX(func)->internal_function.scope->__call; fci.params = params; fci.param_count = 2; ZVAL_STR(&fci.params[0], EX(func)->common.function_name); @@ -270,9 +271,9 @@ static int zend_create_closure_from_callable(zval *return_value, zval *callable, memset(&call, 0, sizeof(zend_internal_function)); call.type = ZEND_INTERNAL_FUNCTION; + call.fn_flags = mptr->common.fn_flags & ZEND_ACC_STATIC; call.handler = zend_closure_call_magic; call.function_name = mptr->common.function_name; - call.reserved[0] = mptr->op_array.reserved[0]; call.scope = mptr->common.scope; zend_free_trampoline(mptr); diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index ab7c06859e..fde7b1204c 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -1161,7 +1161,6 @@ ZEND_API zend_function *zend_get_call_trampoline_func(zend_class_entry *ce, zend } func->opcodes = &EG(call_trampoline_op); func->run_time_cache = (void*)(intptr_t)-1; - func->reserved[0] = fbc; func->scope = fbc->common.scope; /* reserve space for arguments, local and temorary variables */ func->T = (fbc->type == ZEND_USER_FUNCTION)? MAX(fbc->op_array.last_var + fbc->op_array.T, 2) : 2; diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 9711665ec9..fd250cb8cb 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -7725,7 +7725,7 @@ ZEND_VM_HANDLER(158, ZEND_CALL_TRAMPOLINE, ANY, ANY) call = execute_data; execute_data = EG(current_execute_data) = EX(prev_execute_data); - call->func = fbc->op_array.reserved[0]; + call->func = (fbc->op_array.fn_flags & ZEND_ACC_STATIC) ? fbc->op_array.scope->__callstatic : fbc->op_array.scope->__call; ZEND_ASSERT(zend_vm_calc_used_stack(2, call->func) <= (size_t)(((char*)EG(vm_stack_end)) - (char*)call)); ZEND_CALL_NUM_ARGS(call) = 2; diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 0b390b8126..35ab7dda5c 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1942,7 +1942,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CALL_TRAMPOLINE_SPEC_HANDLER(Z call = execute_data; execute_data = EG(current_execute_data) = EX(prev_execute_data); - call->func = fbc->op_array.reserved[0]; + call->func = (fbc->op_array.fn_flags & ZEND_ACC_STATIC) ? fbc->op_array.scope->__callstatic : fbc->op_array.scope->__call; ZEND_ASSERT(zend_vm_calc_used_stack(2, call->func) <= (size_t)(((char*)EG(vm_stack_end)) - (char*)call)); ZEND_CALL_NUM_ARGS(call) = 2;