summaryrefslogtreecommitdiff
path: root/Zend/zend_compile.h
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2004-10-05 18:36:46 +0000
committerMarcus Boerger <helly@php.net>2004-10-05 18:36:46 +0000
commitf916d603efc4749895c49e1c3d6c9cc05044d1b8 (patch)
tree9bd9f0dea1edc6f606c0b828eb20e3b9dd75485a /Zend/zend_compile.h
parentfb6072e10dac347cdcdeae3827cbcd46bd0b642a (diff)
downloadphp-git-f916d603efc4749895c49e1c3d6c9cc05044d1b8.tar.gz
- 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.
Diffstat (limited to 'Zend/zend_compile.h')
-rw-r--r--Zend/zend_compile.h14
1 files changed, 12 insertions, 2 deletions
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