From f916d603efc4749895c49e1c3d6c9cc05044d1b8 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Tue, 5 Oct 2004 18:36:46 +0000 Subject: - Add arginfo ZEND_ARG_SEND_AUTOMATIC which lets the compiler automatically determine whether pass by ref is possible or pass by value is needed. # This is usefull when functions take array or string parameters as # expressions. In such a case force by ref is not applicable and the # executor would copy the variable unnecessarily as soon as it is at least # once referenced. --- Zend/zend_compile.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'Zend/zend_compile.h') diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 3fab70f746..e99c866ffe 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -812,6 +812,7 @@ int zendlex(znode *zendlval TSRMLS_DC); #define ZEND_ARG_SEND_BY_REF (1<<0) #define ZEND_ARG_COMPILE_TIME_BOUND (1<<1) +#define ZEND_ARG_SEND_AUTOMATIC (1<<2) /* Lost In Stupid Parentheses */ #define ARG_SHOULD_BE_SENT_BY_REF(zf, arg_num) \ @@ -822,15 +823,24 @@ int zendlex(znode *zendlval TSRMLS_DC); ( \ ( \ arg_num<=((zend_function *) zf)->common.num_args \ - && ((zend_function *) zf)->common.arg_info[arg_num-1].pass_by_reference \ + && ((zend_function *) zf)->common.arg_info[arg_num-1].pass_by_reference == ZEND_ARG_SEND_BY_REF \ ) \ || ( \ arg_num>((zend_function *) zf)->common.num_args \ - && ((zend_function *) zf)->common.pass_rest_by_reference \ + && ((zend_function *) zf)->common.pass_rest_by_reference == ZEND_ARG_SEND_BY_REF \ ) \ ) \ ) +#define ARG_SEND_TYPE(zf, arg_num) \ + ( \ + !zf || !((zend_function *) zf)->common.arg_info \ + ? 0 \ + : ( arg_num<=((zend_function *) zf)->common.num_args \ + ? ((zend_function *) zf)->common.arg_info[arg_num-1].pass_by_reference \ + : ((zend_function *) zf)->common.pass_rest_by_reference \ + ) \ + ) #define ZEND_RETURN_VAL 0 #define ZEND_RETURN_REF 1 -- cgit v1.2.1