Browse Source

- Add support for used_return_value passed to internal functions.

experimetnal/RETURN_REF_PATCH
Andi Gutmans 27 years ago
parent
commit
dbb67ab9dc
  1. 4
      Zend/zend.h
  2. 14
      Zend/zend_compile.c
  3. 4
      Zend/zend_execute.c

4
Zend/zend.h

@ -96,8 +96,8 @@ 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
#define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, list, plist, this_ptr
#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, HashTable *list, HashTable *plist, zval *this_ptr, char used_return_value
#define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, list, plist, this_ptr, used_return_value
/*
* zval

14
Zend/zend_compile.c

@ -622,11 +622,17 @@ void do_add_variable(znode *result, znode *op1, znode *op2 CLS_DC)
void do_free(znode *op1 CLS_DC)
{
if (op1->op_type==IS_TMP_VAR) {
zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
zend_op *opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1];
opline->opcode = ZEND_FREE;
opline->op1 = *op1;
SET_UNUSED(opline->op2);
if ((opline->opcode == ZEND_DO_FCALL) || (opline->opcode == ZEND_DO_FCALL_BY_NAME)) {
opline->result.u.EA.type |= EXT_TYPE_UNUSED;
} else {
zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
opline->opcode = ZEND_FREE;
opline->op1 = *op1;
SET_UNUSED(opline->op2);
}
} else if (op1->op_type==IS_VAR) {
zend_op *opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1];

4
Zend/zend_execute.c

@ -882,7 +882,7 @@ static void call_overloaded_function(int arg_count, zval *return_value, HashTabl
zend_property_reference *property_reference;
zend_stack_top(&EG(overloaded_objects_stack), (void **) &property_reference);
(property_reference->object)->value.obj.ce->handle_function_call(arg_count, return_value, list, plist, property_reference->object, property_reference);
(property_reference->object)->value.obj.ce->handle_function_call(arg_count, return_value, list, plist, property_reference->object, 0, property_reference);
zend_llist_destroy(&property_reference->elements_list);
zend_stack_del_top(&EG(overloaded_objects_stack));
@ -1468,7 +1468,7 @@ do_fcall_common:
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);
((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));
if (object.ptr) {
object.ptr->refcount--;
}

Loading…
Cancel
Save