Php/docs/migration55.internals
来自菜鸟教程
PHP 内部的变化
- Extensions cannot override zend_execute() any more and should override zend_execute_ex() instead.
EG(current_execute_data)
is already initialized in zend_execute_ex(), so for compatibility extensions may need to useEG(current_execute_data)->prev_execute_data
instead. - 移除
EG(arg_types_stack)
、EX(fbc)
、EX(called_scope)
以及EX(current_object)
。 - Added
op_array->nested_calls
, which is calculated at compile time. - Added
EX(call_slots)
, which is an array to store information about syntaticaly nested calls (e.g.foo(bar())
) and is preallocated together withexecute_data
. - Added
EX(call)
, which is a pointer to a current calling function, and is an element ofEX(call_slots)
. - Opcodes INIT_METHOD_CALL, ZEND_INIT_STATIC_METHOD_CALL, ZEND_INIT_FCALL_BY_NAME and ZEND_INIT_NS_FCALL_BY_NAME use
result.num
as an index inEX(call_slots)
. - Opcode ZEND_NEW uses
extended_value
as an index inEX(call_slots)
. - Opcodes ZEND_DO_FCALL and ZEND_DO_FCALL_BY_NAME use
op2.num
as an index inEX(call_slots)
. - Added
op_array->used_stack
, which is calculated at compile time; the corresponding stack space is preallocated together withexecute_data
. As a result, the ZEND_SEND* and ZEND_DO_FCALL* opcodes no longer need to check for stack overflow. - Removed
execute_data->Ts
field. The VM temporary variables are always allocated immediately before theexecute_data
structure, and are now accessed by their offset from theexecute_data
base pointer instead of viaexecute_data->Ts
. The compiler stores new offsets inop_array->opcodes[*].op?.num
. The EX_TMP_VAR() and EX_TMP_VAR_NUM() macros can be used to access temporary variables by offset or number. You can convert the number to an offset using EX_TMP_VAR_NUM(0, num) or offset to number using (EX_TMP_VAR_NUM(0,0)-EX_TMP_VAR(0,offset)). - 移除
execute_data->CVs
字段。The VM compiled variables are always allocated immediately after theexecute_data
structure, and are now accessed by the offset from theexecute_data
base pointer instead of viaexecute_data->CVs
. You can use the EX_CV_NUM() macro to access compiled variables by