From: Dmitry Stogov Date: Mon, 7 Jul 2014 12:19:24 +0000 (+0400) Subject: Merge branch 'call-frame' into phpng X-Git-Tag: POST_PHPNG_MERGE~90 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7ce2d59ad2e0cac525ad7419e57da68fa2160677;p=php Merge branch 'call-frame' into phpng * call-frame: Simplify call-frame handling Removed EG(active_symbol_table) and use corresponding value from EG(current_execute_data) Use values from current_execute_data instead of globals where possible Removed EG(called_scope) and use corresponding value from EG(current_execute_data) Removed EG(in_execution). If EG(currentent_execute_data) is not NULL we are executing something. Removed EG(opline_ptr) and use corresponding value from EG(current_execute_data) Removed EG(active_op_array) and use corresponding value from EG(current_execute_data) Uinified call frame handling for user and internal functions. Now EG(current_execute_data) always point to the call frame of the currently executed function. Fixed cleanup of incompleytely passed parameters Prohibited parameter redefinition Fixed support for extra arguments in conjunction with variadiv argument. Use compile time flags to check if we call constructor and result of ZEND_NEW is used or not. Fixed uninitialized variables Optimization Changed zend_execute_data layout to reduce memory overhead Help C compilet to do the better job optimizing target code Use fast comparison for (func->type == ZEND_USER_FUNCTION || func->type == ZEND_EVAL_CODE) Keep extra args in the same VM stack segment (after all CV and TMP vars) Refactoring: merge call_frame and end_execute_data into single data structure. Keep only single copy of each argument on VM stack (previously ZE kept two copies of each arguments for user functions) Refactoring: use call_frames instead of call_slots Conflicts: Zend/zend_vm_def.h Zend/zend_vm_execute.h --- 7ce2d59ad2e0cac525ad7419e57da68fa2160677 diff --cc Zend/zend_vm_def.h index 50f0e53e14,e65483468e..89668bd3b5 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@@ -2689,16 -2680,13 +2680,15 @@@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_GENERATOR) != 0)) { if (RETURN_VALUE_USED(opline)) { - zend_generator_create_zval(&fbc->op_array, EX_VAR(opline->result.var) TSRMLS_CC); + zend_generator_create_zval(call, &fbc->op_array, EX_VAR(opline->result.var) TSRMLS_CC); + } else { + zend_vm_stack_free_args(call TSRMLS_CC); } - EX(call) = call->prev_nested_call; zend_vm_stack_free_call_frame(call TSRMLS_CC); } else { - call->prev_execute_data = EG(current_execute_data); - i_init_execute_data(call, &fbc->op_array, return_value, VM_FRAME_NESTED_FUNCTION TSRMLS_CC); + call->prev_execute_data = execute_data; + i_init_func_execute_data(call, &fbc->op_array, return_value, VM_FRAME_NESTED_FUNCTION TSRMLS_CC); if (EXPECTED(zend_execute_ex == execute_ex)) { ZEND_VM_ENTER(); diff --cc Zend/zend_vm_execute.h index 31f1b9d4ae,b069ead63f..dcaa1657c6 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@@ -641,16 -628,13 +628,15 @@@ static int ZEND_FASTCALL ZEND_DO_FCALL if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_GENERATOR) != 0)) { if (RETURN_VALUE_USED(opline)) { - zend_generator_create_zval(&fbc->op_array, EX_VAR(opline->result.var) TSRMLS_CC); + zend_generator_create_zval(call, &fbc->op_array, EX_VAR(opline->result.var) TSRMLS_CC); + } else { + zend_vm_stack_free_args(call TSRMLS_CC); } - EX(call) = call->prev_nested_call; zend_vm_stack_free_call_frame(call TSRMLS_CC); } else { - call->prev_execute_data = EG(current_execute_data); - i_init_execute_data(call, &fbc->op_array, return_value, VM_FRAME_NESTED_FUNCTION TSRMLS_CC); + call->prev_execute_data = execute_data; + i_init_func_execute_data(call, &fbc->op_array, return_value, VM_FRAME_NESTED_FUNCTION TSRMLS_CC); if (EXPECTED(zend_execute_ex == execute_ex)) { ZEND_VM_ENTER();