@@ -334,6 +334,7 @@ typedef struct _zend_internal_function_info {
334
334
struct _zend_op_array {
335
335
/* Common elements */
336
336
zend_uchar type ;
337
+ zend_uchar arg_flags [3 ]; /* bitset of arg_info.pass_by_reference */
337
338
uint32_t fn_flags ;
338
339
zend_string * function_name ;
339
340
zend_class_entry * scope ;
@@ -384,6 +385,7 @@ struct _zend_op_array {
384
385
typedef struct _zend_internal_function {
385
386
/* Common elements */
386
387
zend_uchar type ;
388
+ zend_uchar arg_flags [3 ]; /* bitset of arg_info.pass_by_reference */
387
389
uint32_t fn_flags ;
388
390
zend_string * function_name ;
389
391
zend_class_entry * scope ;
@@ -404,6 +406,7 @@ union _zend_function {
404
406
405
407
struct {
406
408
zend_uchar type ; /* never used */
409
+ zend_uchar arg_flags [3 ]; /* bitset of arg_info.pass_by_reference */
407
410
uint32_t fn_flags ;
408
411
zend_string * function_name ;
409
412
zend_class_entry * scope ;
@@ -776,6 +779,7 @@ ZEND_API void zend_activate_auto_globals(void);
776
779
ZEND_API zend_bool zend_is_auto_global (zend_string * name );
777
780
ZEND_API zend_bool zend_is_auto_global_str (char * name , size_t len );
778
781
ZEND_API size_t zend_dirname (char * path , size_t len );
782
+ ZEND_API int zend_set_function_arg_flags (zend_function * func );
779
783
780
784
int zendlex (zend_parser_stack_elem * elem );
781
785
@@ -910,6 +914,32 @@ static zend_always_inline int zend_check_arg_send_type(const zend_function *zf,
910
914
#define ARG_MAY_BE_SENT_BY_REF (zf , arg_num ) \
911
915
zend_check_arg_send_type(zf, arg_num, ZEND_SEND_PREFER_REF)
912
916
917
+ /* Quick API to check firat 12 arguments */
918
+ #define MAX_ARG_FLAG_NUM 12
919
+
920
+ #ifdef WORDS_BIGENDIAN
921
+ # define ZEND_SET_ARG_FLAG (zf , arg_num , mask ) do { \
922
+ *(uint32_t*)&(zf)->type |= ((mask) << ((arg_num) - 1) * 2); \
923
+ } while (0)
924
+ # define ZEND_CHECK_ARG_FLAG (zf , arg_num , mask ) \
925
+ (((*((uint32_t*)&((zf)->type))) >> (((arg_num) - 1) * 2)) & (mask))
926
+ #else
927
+ # define ZEND_SET_ARG_FLAG (zf , arg_num , mask ) do { \
928
+ *(uint32_t*)&(zf)->type |= (((mask) << 6) << (arg_num) * 2); \
929
+ } while (0)
930
+ # define ZEND_CHECK_ARG_FLAG (zf , arg_num , mask ) \
931
+ (((*(uint32_t*)&(zf)->type) >> (((arg_num) + 3) * 2)) & (mask))
932
+ #endif
933
+
934
+ #define QUICK_ARG_MUST_BE_SENT_BY_REF (zf , arg_num ) \
935
+ ZEND_CHECK_ARG_FLAG(zf, arg_num, ZEND_SEND_BY_REF)
936
+
937
+ #define QUICK_ARG_SHOULD_BE_SENT_BY_REF (zf , arg_num ) \
938
+ ZEND_CHECK_ARG_FLAG(zf, arg_num, ZEND_SEND_BY_REF|ZEND_SEND_PREFER_REF)
939
+
940
+ #define QUICK_ARG_MAY_BE_SENT_BY_REF (zf , arg_num ) \
941
+ ZEND_CHECK_ARG_FLAG(zf, arg_num, ZEND_SEND_PREFER_REF)
942
+
913
943
#define ZEND_RETURN_VAL 0
914
944
#define ZEND_RETURN_REF 1
915
945
0 commit comments