cvs: ZendEngine2 / zend_execute.c

From: Date: Mon, 02 Aug 2004 02:35:01 +0000
Subject: cvs: ZendEngine2 / zend_execute.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-2831@lists.php.net to get a copy of this message
iliaa Sun Aug 1 22:35:01 2004 EDT Modified files: /ZendEngine2 zend_execute.c Log: A gentler (performance wise) allocation of buffer for temp variables. http://cvs.php.net/diff.php/ZendEngine2/zend_execute.c?r1=1.662&r2=1.663&ty=u Index: ZendEngine2/zend_execute.c diff -u ZendEngine2/zend_execute.c:1.662 ZendEngine2/zend_execute.c:1.663 --- ZendEngine2/zend_execute.c:1.662 Fri Jul 30 17:00:37 2004 +++ ZendEngine2/zend_execute.c Sun Aug 1 22:35:01 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute.c,v 1.662 2004/07/30 21:00:37 andi Exp $ */ +/* $Id: zend_execute.c,v 1.663 2004/08/02 02:35:01 iliaa Exp $ */ #define ZEND_INTENSIVE_DEBUGGING 0 @@ -52,6 +52,7 @@ #define EX_T(offset) (*(temp_variable *)((char *) EX(Ts) + offset)) #define T(offset) (*(temp_variable *)((char *) Ts + offset)) +#define TEMP_VAR_STACK_LIMIT 2000 /* former zend_execute_locks.h */ static inline void zend_pzval_lock_func(zval *z) @@ -1330,7 +1331,11 @@ } #define RETURN_FROM_EXECUTE_LOOP(execute_data) \ - if (EX(Ts)) efree(EX(Ts)); \ + if (EX(op_array)->T < TEMP_VAR_STACK_LIMIT) { \ + free_alloca(EX(Ts)); \ + } else { \ + efree(EX(Ts)); \ + } \ EG(in_execution) = EX(original_in_execution); \ EG(current_execute_data) = EX(prev_execute_data); \ return 1; /* CHECK_ME */ @@ -1349,7 +1354,11 @@ /* Initialize execute_data */ EX(fbc) = NULL; EX(object) = NULL; - EX(Ts) = (temp_variable *) (op_array->T ? safe_emalloc(sizeof(temp_variable), op_array->T, 0) : NULL); + if (op_array->T < TEMP_VAR_STACK_LIMIT) { + EX(Ts) = (temp_variable *) do_alloca(sizeof(temp_variable) * op_array->T); + } else { + EX(Ts) = (temp_variable *) safe_emalloc(sizeof(temp_variable), op_array->T, 0); + } EX(op_array) = op_array; EX(original_in_execution) = EG(in_execution); EX(prev_execute_data) = EG(current_execute_data);

« previous php.zend-engine.cvs (#2831) next »