mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Improved GENERATOR_CREATE opcode handler.
This commit is contained in:
parent
c2f25bd188
commit
9a159f37e1
3 changed files with 17 additions and 4 deletions
1
NEWS
1
NEWS
|
@ -3,6 +3,7 @@ PHP NEWS
|
|||
?? ??? 2017, PHP 7.1.2
|
||||
|
||||
- Core:
|
||||
. Improved GENERATOR_CREATE opcode handler. (Bob, Dmitry)
|
||||
. Fixed bug #73877 (readlink() returns garbage for UTF-8 paths). (Anatol)
|
||||
. Fixed bug #73876 (Crash when exporting **= in expansion of assign op).
|
||||
(Sara)
|
||||
|
|
|
@ -4093,8 +4093,14 @@ ZEND_VM_HANDLER(41, ZEND_GENERATOR_CREATE, ANY, ANY)
|
|||
* is allocated on heap.
|
||||
*/
|
||||
num_args = EX_NUM_ARGS();
|
||||
used_stack = (ZEND_CALL_FRAME_SLOT + num_args + EX(func)->op_array.last_var + EX(func)->op_array.T - MIN(EX(func)->op_array.num_args, num_args)) * sizeof(zval);
|
||||
gen_execute_data = (zend_execute_data*)emalloc(used_stack);
|
||||
if (EXPECTED(num_args <= EX(func)->op_array.last_var)) {
|
||||
used_stack = (ZEND_CALL_FRAME_SLOT + EX(func)->op_array.last_var + EX(func)->op_array.T) * sizeof(zval);
|
||||
gen_execute_data = (zend_execute_data*)emalloc(used_stack);
|
||||
used_stack = (ZEND_CALL_FRAME_SLOT + EX(func)->op_array.last_var) * sizeof(zval);
|
||||
} else {
|
||||
used_stack = (ZEND_CALL_FRAME_SLOT + num_args + EX(func)->op_array.last_var + EX(func)->op_array.T - EX(func)->op_array.num_args) * sizeof(zval);
|
||||
gen_execute_data = (zend_execute_data*)emalloc(used_stack);
|
||||
}
|
||||
memcpy(gen_execute_data, execute_data, used_stack);
|
||||
|
||||
/* Save execution context in generator object. */
|
||||
|
|
|
@ -1179,8 +1179,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GENERATOR_CREATE_SPEC_HANDLER(
|
|||
* is allocated on heap.
|
||||
*/
|
||||
num_args = EX_NUM_ARGS();
|
||||
used_stack = (ZEND_CALL_FRAME_SLOT + num_args + EX(func)->op_array.last_var + EX(func)->op_array.T - MIN(EX(func)->op_array.num_args, num_args)) * sizeof(zval);
|
||||
gen_execute_data = (zend_execute_data*)emalloc(used_stack);
|
||||
if (EXPECTED(num_args <= EX(func)->op_array.last_var)) {
|
||||
used_stack = (ZEND_CALL_FRAME_SLOT + EX(func)->op_array.last_var + EX(func)->op_array.T) * sizeof(zval);
|
||||
gen_execute_data = (zend_execute_data*)emalloc(used_stack);
|
||||
used_stack = (ZEND_CALL_FRAME_SLOT + EX(func)->op_array.last_var) * sizeof(zval);
|
||||
} else {
|
||||
used_stack = (ZEND_CALL_FRAME_SLOT + num_args + EX(func)->op_array.last_var + EX(func)->op_array.T - EX(func)->op_array.num_args) * sizeof(zval);
|
||||
gen_execute_data = (zend_execute_data*)emalloc(used_stack);
|
||||
}
|
||||
memcpy(gen_execute_data, execute_data, used_stack);
|
||||
|
||||
/* Save execution context in generator object. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue