mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
Get rid of EX(scope). In most cases we use EG(scope) anyway. EX(scope) was used to switch EG(scope) back after call, but it's possibleto use EX(func)->common.scope instead.
This commit is contained in:
parent
4dcc8a6371
commit
9a36cb1a07
@ -375,7 +375,6 @@ struct _zend_execute_data {
|
||||
uint32_t frame_info;
|
||||
uint32_t num_args;
|
||||
zval *return_value;
|
||||
zend_class_entry *scope; /* function scope (self) */
|
||||
zend_array *symbol_table;
|
||||
};
|
||||
|
||||
|
@ -1484,7 +1484,6 @@ static zend_always_inline void i_init_func_execute_data(zend_execute_data *execu
|
||||
{
|
||||
uint32_t first_extra_arg, num_args;
|
||||
ZEND_ASSERT(EX(func) == (zend_function*)op_array);
|
||||
ZEND_ASSERT(EX(scope) == EG(scope));
|
||||
|
||||
EX(opline) = op_array->opcodes;
|
||||
EX(call) = NULL;
|
||||
@ -1553,7 +1552,6 @@ static zend_always_inline void i_init_code_execute_data(zend_execute_data *execu
|
||||
EX(opline) = op_array->opcodes;
|
||||
EX(call) = NULL;
|
||||
EX(return_value) = return_value;
|
||||
EX(scope) = EG(scope);
|
||||
|
||||
zend_attach_symbol_table(execute_data);
|
||||
|
||||
@ -1578,7 +1576,6 @@ static zend_always_inline void i_init_execute_data(zend_execute_data *execute_da
|
||||
EX(opline) = op_array->opcodes;
|
||||
EX(call) = NULL;
|
||||
EX(return_value) = return_value;
|
||||
EX(scope) = EG(scope);
|
||||
|
||||
if (UNEXPECTED(EX(symbol_table) != NULL)) {
|
||||
zend_attach_symbol_table(execute_data);
|
||||
@ -1690,7 +1687,6 @@ ZEND_API zend_execute_data *zend_create_generator_execute_data(zend_execute_data
|
||||
}
|
||||
|
||||
EX(symbol_table) = NULL;
|
||||
EX(scope) = EG(scope);
|
||||
|
||||
i_init_func_execute_data(execute_data, op_array, return_value TSRMLS_CC);
|
||||
|
||||
|
@ -306,7 +306,7 @@ ZEND_API void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{
|
||||
original_stack->top = EG(vm_stack_top);
|
||||
/* Set executor globals */
|
||||
EG(current_execute_data) = generator->execute_data;
|
||||
EG(scope) = generator->execute_data->scope;
|
||||
EG(scope) = generator->execute_data->func->common.scope;
|
||||
EG(vm_stack_top) = generator->stack->top;
|
||||
EG(vm_stack_end) = generator->stack->end;
|
||||
EG(vm_stack) = generator->stack;
|
||||
|
@ -1766,7 +1766,7 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
|
||||
}
|
||||
OBJ_RELEASE(object);
|
||||
}
|
||||
EG(scope) = EX(scope);
|
||||
EG(scope) = EX(func)->op_array.scope;
|
||||
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
const zend_op *opline = EX(opline);
|
||||
@ -2717,7 +2717,7 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY, ANY)
|
||||
ZEND_VM_C_GOTO(fcall_end);
|
||||
}
|
||||
} else if (EXPECTED(fbc->type == ZEND_USER_FUNCTION)) {
|
||||
call->scope = EG(scope) = fbc->common.scope;
|
||||
EG(scope) = fbc->common.scope;
|
||||
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_GENERATOR) != 0)) {
|
||||
if (RETURN_VALUE_USED(opline)) {
|
||||
zend_generator_create_zval(call, &fbc->op_array, EX_VAR(opline->result.var) TSRMLS_CC);
|
||||
@ -2794,7 +2794,7 @@ ZEND_VM_C_LABEL(fcall_end_change_scope):
|
||||
}
|
||||
OBJ_RELEASE(object);
|
||||
}
|
||||
EG(scope) = EX(scope);
|
||||
EG(scope) = EX(func)->op_array.scope;
|
||||
|
||||
ZEND_VM_C_LABEL(fcall_end):
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
@ -3773,14 +3773,14 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMP|VAR|UNUSED|CV, ANY)
|
||||
if (clone->op_array.fn_flags & ZEND_ACC_PRIVATE) {
|
||||
/* Ensure that if we're calling a private function, we're allowed to do so.
|
||||
*/
|
||||
if (UNEXPECTED(ce != EX(scope))) {
|
||||
zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name->val, EX(scope) ? EX(scope)->name->val : "");
|
||||
if (UNEXPECTED(ce != EG(scope))) {
|
||||
zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : "");
|
||||
}
|
||||
} else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
|
||||
/* Ensure that if we're calling a protected function, we're allowed to do so.
|
||||
*/
|
||||
if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EX(scope)))) {
|
||||
zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name->val, EX(scope) ? EX(scope)->name->val : "");
|
||||
if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) {
|
||||
zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3874,7 +3874,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
|
||||
if (Z_CONSTANT_P(value)) {
|
||||
EG(scope) = ce;
|
||||
zval_update_constant(value, 1 TSRMLS_CC);
|
||||
EG(scope) = EX(scope);
|
||||
EG(scope) = EX(func)->op_array.scope;
|
||||
}
|
||||
if (OP1_TYPE == IS_CONST) {
|
||||
CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), value);
|
||||
@ -4208,6 +4208,8 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
|
||||
return_value = EX_VAR(opline->result.var);
|
||||
}
|
||||
|
||||
new_op_array->scope = EG(scope); /* ??? */
|
||||
|
||||
call = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_CODE,
|
||||
(zend_function*)new_op_array, 0, EX(called_scope), Z_OBJ(EX(This)), NULL TSRMLS_CC);
|
||||
|
||||
@ -5657,7 +5659,7 @@ ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED)
|
||||
if (closure_is_static || closure_is_being_defined_inside_static_context) {
|
||||
zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EX(called_scope), NULL TSRMLS_CC);
|
||||
} else {
|
||||
zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EX(scope), Z_OBJ(EX(This)) ? &EX(This) : NULL TSRMLS_CC);
|
||||
zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EG(scope), Z_OBJ(EX(This)) ? &EX(This) : NULL TSRMLS_CC);
|
||||
}
|
||||
|
||||
CHECK_EXCEPTION();
|
||||
|
@ -413,7 +413,7 @@ static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
|
||||
}
|
||||
OBJ_RELEASE(object);
|
||||
}
|
||||
EG(scope) = EX(scope);
|
||||
EG(scope) = EX(func)->op_array.scope;
|
||||
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
const zend_op *opline = EX(opline);
|
||||
@ -580,7 +580,7 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
goto fcall_end;
|
||||
}
|
||||
} else if (EXPECTED(fbc->type == ZEND_USER_FUNCTION)) {
|
||||
call->scope = EG(scope) = fbc->common.scope;
|
||||
EG(scope) = fbc->common.scope;
|
||||
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_GENERATOR) != 0)) {
|
||||
if (RETURN_VALUE_USED(opline)) {
|
||||
zend_generator_create_zval(call, &fbc->op_array, EX_VAR(opline->result.var) TSRMLS_CC);
|
||||
@ -657,7 +657,7 @@ fcall_end_change_scope:
|
||||
}
|
||||
OBJ_RELEASE(object);
|
||||
}
|
||||
EG(scope) = EX(scope);
|
||||
EG(scope) = EX(func)->op_array.scope;
|
||||
|
||||
fcall_end:
|
||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||
@ -2835,14 +2835,14 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS
|
||||
if (clone->op_array.fn_flags & ZEND_ACC_PRIVATE) {
|
||||
/* Ensure that if we're calling a private function, we're allowed to do so.
|
||||
*/
|
||||
if (UNEXPECTED(ce != EX(scope))) {
|
||||
zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name->val, EX(scope) ? EX(scope)->name->val : "");
|
||||
if (UNEXPECTED(ce != EG(scope))) {
|
||||
zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : "");
|
||||
}
|
||||
} else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
|
||||
/* Ensure that if we're calling a protected function, we're allowed to do so.
|
||||
*/
|
||||
if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EX(scope)))) {
|
||||
zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name->val, EX(scope) ? EX(scope)->name->val : "");
|
||||
if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) {
|
||||
zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3051,6 +3051,8 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA
|
||||
return_value = EX_VAR(opline->result.var);
|
||||
}
|
||||
|
||||
new_op_array->scope = EG(scope); /* ??? */
|
||||
|
||||
call = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_CODE,
|
||||
(zend_function*)new_op_array, 0, EX(called_scope), Z_OBJ(EX(This)), NULL TSRMLS_CC);
|
||||
|
||||
@ -4422,7 +4424,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
|
||||
if (Z_CONSTANT_P(value)) {
|
||||
EG(scope) = ce;
|
||||
zval_update_constant(value, 1 TSRMLS_CC);
|
||||
EG(scope) = EX(scope);
|
||||
EG(scope) = EX(func)->op_array.scope;
|
||||
}
|
||||
if (IS_CONST == IS_CONST) {
|
||||
CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), value);
|
||||
@ -8094,7 +8096,7 @@ static int ZEND_FASTCALL ZEND_DECLARE_LAMBDA_FUNCTION_SPEC_CONST_UNUSED_HANDLER
|
||||
if (closure_is_static || closure_is_being_defined_inside_static_context) {
|
||||
zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EX(called_scope), NULL TSRMLS_CC);
|
||||
} else {
|
||||
zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EX(scope), Z_OBJ(EX(This)) ? &EX(This) : NULL TSRMLS_CC);
|
||||
zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EG(scope), Z_OBJ(EX(This)) ? &EX(This) : NULL TSRMLS_CC);
|
||||
}
|
||||
|
||||
CHECK_EXCEPTION();
|
||||
@ -9799,14 +9801,14 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
if (clone->op_array.fn_flags & ZEND_ACC_PRIVATE) {
|
||||
/* Ensure that if we're calling a private function, we're allowed to do so.
|
||||
*/
|
||||
if (UNEXPECTED(ce != EX(scope))) {
|
||||
zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name->val, EX(scope) ? EX(scope)->name->val : "");
|
||||
if (UNEXPECTED(ce != EG(scope))) {
|
||||
zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : "");
|
||||
}
|
||||
} else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
|
||||
/* Ensure that if we're calling a protected function, we're allowed to do so.
|
||||
*/
|
||||
if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EX(scope)))) {
|
||||
zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name->val, EX(scope) ? EX(scope)->name->val : "");
|
||||
if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) {
|
||||
zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10016,6 +10018,8 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND
|
||||
return_value = EX_VAR(opline->result.var);
|
||||
}
|
||||
|
||||
new_op_array->scope = EG(scope); /* ??? */
|
||||
|
||||
call = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_CODE,
|
||||
(zend_function*)new_op_array, 0, EX(called_scope), Z_OBJ(EX(This)), NULL TSRMLS_CC);
|
||||
|
||||
@ -16785,14 +16789,14 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
if (clone->op_array.fn_flags & ZEND_ACC_PRIVATE) {
|
||||
/* Ensure that if we're calling a private function, we're allowed to do so.
|
||||
*/
|
||||
if (UNEXPECTED(ce != EX(scope))) {
|
||||
zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name->val, EX(scope) ? EX(scope)->name->val : "");
|
||||
if (UNEXPECTED(ce != EG(scope))) {
|
||||
zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : "");
|
||||
}
|
||||
} else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
|
||||
/* Ensure that if we're calling a protected function, we're allowed to do so.
|
||||
*/
|
||||
if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EX(scope)))) {
|
||||
zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name->val, EX(scope) ? EX(scope)->name->val : "");
|
||||
if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) {
|
||||
zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -17003,6 +17007,8 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
|
||||
return_value = EX_VAR(opline->result.var);
|
||||
}
|
||||
|
||||
new_op_array->scope = EG(scope); /* ??? */
|
||||
|
||||
call = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_CODE,
|
||||
(zend_function*)new_op_array, 0, EX(called_scope), Z_OBJ(EX(This)), NULL TSRMLS_CC);
|
||||
|
||||
@ -19421,7 +19427,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE
|
||||
if (Z_CONSTANT_P(value)) {
|
||||
EG(scope) = ce;
|
||||
zval_update_constant(value, 1 TSRMLS_CC);
|
||||
EG(scope) = EX(scope);
|
||||
EG(scope) = EX(func)->op_array.scope;
|
||||
}
|
||||
if (IS_VAR == IS_CONST) {
|
||||
CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), value);
|
||||
@ -27885,14 +27891,14 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARG
|
||||
if (clone->op_array.fn_flags & ZEND_ACC_PRIVATE) {
|
||||
/* Ensure that if we're calling a private function, we're allowed to do so.
|
||||
*/
|
||||
if (UNEXPECTED(ce != EX(scope))) {
|
||||
zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name->val, EX(scope) ? EX(scope)->name->val : "");
|
||||
if (UNEXPECTED(ce != EG(scope))) {
|
||||
zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : "");
|
||||
}
|
||||
} else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
|
||||
/* Ensure that if we're calling a protected function, we're allowed to do so.
|
||||
*/
|
||||
if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EX(scope)))) {
|
||||
zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name->val, EX(scope) ? EX(scope)->name->val : "");
|
||||
if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) {
|
||||
zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -28886,7 +28892,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC
|
||||
if (Z_CONSTANT_P(value)) {
|
||||
EG(scope) = ce;
|
||||
zval_update_constant(value, 1 TSRMLS_CC);
|
||||
EG(scope) = EX(scope);
|
||||
EG(scope) = EX(func)->op_array.scope;
|
||||
}
|
||||
if (IS_UNUSED == IS_CONST) {
|
||||
CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), value);
|
||||
@ -34507,14 +34513,14 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
if (clone->op_array.fn_flags & ZEND_ACC_PRIVATE) {
|
||||
/* Ensure that if we're calling a private function, we're allowed to do so.
|
||||
*/
|
||||
if (UNEXPECTED(ce != EX(scope))) {
|
||||
zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name->val, EX(scope) ? EX(scope)->name->val : "");
|
||||
if (UNEXPECTED(ce != EG(scope))) {
|
||||
zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : "");
|
||||
}
|
||||
} else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
|
||||
/* Ensure that if we're calling a protected function, we're allowed to do so.
|
||||
*/
|
||||
if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EX(scope)))) {
|
||||
zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name->val, EX(scope) ? EX(scope)->name->val : "");
|
||||
if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) {
|
||||
zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -34723,6 +34729,8 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
|
||||
return_value = EX_VAR(opline->result.var);
|
||||
}
|
||||
|
||||
new_op_array->scope = EG(scope); /* ??? */
|
||||
|
||||
call = zend_vm_stack_push_call_frame(VM_FRAME_NESTED_CODE,
|
||||
(zend_function*)new_op_array, 0, EX(called_scope), Z_OBJ(EX(This)), NULL TSRMLS_CC);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user