Browse Source

- Functions whose return values aren't used have them freed in DO_FCALL

and don't need a special ZEND_FREE opcode following them anymore
experimetnal/RETURN_REF_PATCH
Andi Gutmans 27 years ago
parent
commit
817a11e7ed
  1. 2
      Zend/zend.h
  2. 9
      Zend/zend_execute.c

2
Zend/zend.h

@ -96,7 +96,7 @@ typedef unsigned char zend_bool;
#include "zend_hash.h"
#include "zend_llist.h"
#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, HashTable *list, HashTable *plist, zval *this_ptr, char return_value_used
#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, HashTable *list, HashTable *plist, zval *this_ptr, int return_value_used
#define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, list, plist, this_ptr, return_value_used
/*

9
Zend/zend_execute.c

@ -1464,17 +1464,15 @@ overloaded_function_call_cont:
do_fcall_common:
{
zval *original_return_value;
int return_value_not_used = (opline->result.u.EA.type & EXT_TYPE_UNUSED);
zend_ptr_stack_push(&EG(argument_stack), (void *) opline->extended_value);
if (function_state.function->type==ZEND_INTERNAL_FUNCTION) {
var_uninit(&Ts[opline->result.u.var].tmp_var);
((zend_internal_function *) function_state.function)->handler(opline->extended_value, &Ts[opline->result.u.var].tmp_var, &EG(regular_list), &EG(persistent_list), object.ptr, (opline->result.u.EA.type ^ EXT_TYPE_UNUSED));
((zend_internal_function *) function_state.function)->handler(opline->extended_value, &Ts[opline->result.u.var].tmp_var, &EG(regular_list), &EG(persistent_list), object.ptr, !return_value_not_used);
if (object.ptr) {
object.ptr->refcount--;
}
if (opline->result.u.EA.type & EXT_TYPE_UNUSED) {
zendi_zval_dtor(Ts[opline->result.u.var].tmp_var);
}
} else if (function_state.function->type==ZEND_USER_FUNCTION) {
HashTable *calling_symbol_table;
@ -1520,6 +1518,9 @@ do_fcall_common:
call_overloaded_function(opline->extended_value, &Ts[opline->result.u.var].tmp_var, &EG(regular_list), &EG(persistent_list) ELS_CC);
efree(fbc);
}
if (return_value_not_used) {
zendi_zval_dtor(Ts[opline->result.u.var].tmp_var);
}
object.ptr = zend_ptr_stack_pop(&EG(arg_types_stack));
if (opline->opcode == ZEND_DO_FCALL_BY_NAME) {
fbc = zend_ptr_stack_pop(&EG(arg_types_stack));

Loading…
Cancel
Save