cvs: ZendEngine2(PHP_5_0) / zend_execute.c

From: Date: Mon, 02 Aug 2004 02:35:03 +0000
Subject: cvs: ZendEngine2(PHP_5_0) / zend_execute.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-2832@lists.php.net to get a copy of this message
iliaa Sun Aug 1 22:35:03 2004 EDT Modified files: (Branch: PHP_5_0) /ZendEngine2 zend_execute.c Log: MFH: A gentler (performance wise) allocation of buffer for temp variables. http://cvs.php.net/diff.php/ZendEngine2/zend_execute.c?r1=1.652.2.2&r2=1.652.2.3&ty=u Index: ZendEngine2/zend_execute.c diff -u ZendEngine2/zend_execute.c:1.652.2.2 ZendEngine2/zend_execute.c:1.652.2.3 --- ZendEngine2/zend_execute.c:1.652.2.2 Sun Jul 25 13:37:55 2004 +++ ZendEngine2/zend_execute.c Sun Aug 1 22:35:03 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute.c,v 1.652.2.2 2004/07/25 17:37:55 helly Exp $ */ +/* $Id: zend_execute.c,v 1.652.2.3 2004/08/02 02:35:03 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) \ - 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 *) safe_emalloc(sizeof(temp_variable), op_array->T, 0); + 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 (#2832) next »