On 2005/01/12, at 9:24, Andi Gutmans wrote:
Are you sure this is the right fix? After all, last_op->result.u.var should already have a temporary variable assigned for when the opcode was generated. When exactly did you find this is not the case?
As far as I checked, at least a temporary variable is always allocated per opcode in the ZE1 and pre-VM ZE2.
<?php function op_array() { $a; // 1 $a; // 2 $a = $a + 2; // 3, 4 // ... total 4 temporary variables } ?>
However, it looks like the rule doesn't apply to the current HEAD.
<?php function op_array() { $a; // 1 $a; // 2 $a = $a + 2; // 3, 4 // ... total 4 temporary variables } ?>
Try the attached patch to check what is going on behind the scene.
Index: Zend/zend_execute.c =================================================================== RCS file: /repository/ZendEngine2/zend_execute.c,v retrieving revision 1.687 diff -u -r1.687 zend_execute.c --- Zend/zend_execute.c 27 Dec 2004 13:43:25 -0000 1.687 +++ Zend/zend_execute.c 12 Jan 2005 08:12:09 -0000 @@ -65,8 +65,17 @@ #define RETURN_VALUE_USED(opline) (!((opline)->result.u.EA.type & EXT_TYPE_UNUSED)) -#define EX_T(offset) (*(temp_variable *)((char *) EX(Ts) + offset)) -#define T(offset) (*(temp_variable *)((char *) Ts + offset)) +static inline temp_variable *check_tv_overrun(zend_op_array *op, + temp_variable *Ts, size_t offset) +{ + fprintf(stderr, "Accessing #%d (size=%d)\n", + (int)(offset / sizeof(temp_variable)), op->T); + + return (temp_variable *)((char *)Ts + offset); +} + +#define EX_T(offset) (*check_tv_overrun(EX(op_array), EX(Ts), offset)) +#define T(offset) (*check_tv_overrun(EG(active_op_array), Ts, offset)) #define TEMP_VAR_STACK_LIMIT 2000
Moriyoshi
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php