@@ -1044,8 +1044,7 @@ ZEND_API zend_string *zend_type_to_string(zend_type type);
1044
1044
1045
1045
#define ZEND_SEND_BY_VAL 0u
1046
1046
#define ZEND_SEND_BY_REF 1u
1047
- #define ZEND_SEND_PREFER_VAL 2u
1048
- #define ZEND_SEND_PREFER_REF 3u
1047
+ #define ZEND_SEND_PREFER_REF 2u
1049
1048
1050
1049
#define ZEND_THROW_IS_EXPR 1u
1051
1050
@@ -1078,7 +1077,7 @@ ZEND_API zend_string *zend_type_to_string(zend_type type);
1078
1077
#define IS_CONSTANT_CLASS 0x400 /* __CLASS__ in trait */
1079
1078
#define IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE 0x800
1080
1079
1081
- static zend_always_inline bool zend_check_arg_must_be_sent_by_ref (const zend_function * zf , uint32_t arg_num )
1080
+ static zend_always_inline bool zend_check_arg_send_type (const zend_function * zf , uint32_t arg_num , uint32_t mask )
1082
1081
{
1083
1082
arg_num -- ;
1084
1083
if (UNEXPECTED (arg_num >= zf -> common .num_args )) {
@@ -1087,44 +1086,17 @@ static zend_always_inline bool zend_check_arg_must_be_sent_by_ref(const zend_fun
1087
1086
}
1088
1087
arg_num = zf -> common .num_args ;
1089
1088
}
1090
- return ZEND_ARG_SEND_MODE (& zf -> common .arg_info [arg_num ]) == ZEND_SEND_BY_REF ;
1091
- }
1092
-
1093
- static zend_always_inline int zend_check_arg_should_be_sent_by_ref (const zend_function * zf , uint32_t arg_num )
1094
- {
1095
- arg_num -- ;
1096
- if (UNEXPECTED (arg_num >= zf -> common .num_args )) {
1097
- if (EXPECTED ((zf -> common .fn_flags & ZEND_ACC_VARIADIC ) == 0 )) {
1098
- return 0 ;
1099
- }
1100
- arg_num = zf -> common .num_args ;
1101
- }
1102
-
1103
- /* The SEND_BY_REF bit is set for PREFER_REF as well. */
1104
- return (ZEND_ARG_SEND_MODE (& zf -> common .arg_info [arg_num ]) & ZEND_SEND_BY_REF ) != 0 ;
1105
- }
1106
-
1107
- static zend_always_inline int zend_check_arg_may_be_sent_by_ref (const zend_function * zf , uint32_t arg_num )
1108
- {
1109
- arg_num -- ;
1110
- if (UNEXPECTED (arg_num >= zf -> common .num_args )) {
1111
- if (EXPECTED ((zf -> common .fn_flags & ZEND_ACC_VARIADIC ) == 0 )) {
1112
- return 0 ;
1113
- }
1114
- arg_num = zf -> common .num_args ;
1115
- }
1116
-
1117
- return ZEND_ARG_SEND_MODE (& zf -> common .arg_info [arg_num ]) != ZEND_SEND_BY_VAL ;
1089
+ return UNEXPECTED ((ZEND_ARG_SEND_MODE (& zf -> common .arg_info [arg_num ]) & mask ) != 0 );
1118
1090
}
1119
1091
1120
1092
#define ARG_MUST_BE_SENT_BY_REF (zf , arg_num ) \
1121
- zend_check_arg_must_be_sent_by_ref (zf, arg_num)
1093
+ zend_check_arg_send_type (zf, arg_num, ZEND_SEND_BY_REF )
1122
1094
1123
1095
#define ARG_SHOULD_BE_SENT_BY_REF (zf , arg_num ) \
1124
- zend_check_arg_should_be_sent_by_ref (zf, arg_num)
1096
+ zend_check_arg_send_type (zf, arg_num, ZEND_SEND_BY_REF|ZEND_SEND_PREFER_REF )
1125
1097
1126
1098
#define ARG_MAY_BE_SENT_BY_REF (zf , arg_num ) \
1127
- zend_check_arg_may_be_sent_by_ref (zf, arg_num)
1099
+ zend_check_arg_send_type (zf, arg_num, ZEND_SEND_PREFER_REF )
1128
1100
1129
1101
/* Quick API to check first 12 arguments */
1130
1102
#define MAX_ARG_FLAG_NUM 12
@@ -1133,24 +1105,24 @@ static zend_always_inline int zend_check_arg_may_be_sent_by_ref(const zend_funct
1133
1105
# define ZEND_SET_ARG_FLAG (zf , arg_num , mask ) do { \
1134
1106
(zf)->quick_arg_flags |= ((mask) << ((arg_num) - 1) * 2); \
1135
1107
} while (0)
1136
- # define ZEND_GET_ARG_FLAG (zf , arg_num ) \
1137
- (((zf)->quick_arg_flags >> (((arg_num) - 1) * 2)) & 0x3u )
1108
+ # define ZEND_CHECK_ARG_FLAG (zf , arg_num , mask ) \
1109
+ (((zf)->quick_arg_flags >> (((arg_num) - 1) * 2)) & (mask) )
1138
1110
#else
1139
1111
# define ZEND_SET_ARG_FLAG (zf , arg_num , mask ) do { \
1140
1112
(zf)->quick_arg_flags |= (((mask) << 6) << (arg_num) * 2); \
1141
1113
} while (0)
1142
- # define ZEND_GET_ARG_FLAG (zf , arg_num ) \
1143
- (((zf)->quick_arg_flags >> (((arg_num) + 3) * 2)) & 0x3u )
1114
+ # define ZEND_CHECK_ARG_FLAG (zf , arg_num , mask ) \
1115
+ (((zf)->quick_arg_flags >> (((arg_num) + 3) * 2)) & (mask) )
1144
1116
#endif
1145
1117
1146
1118
#define QUICK_ARG_MUST_BE_SENT_BY_REF (zf , arg_num ) \
1147
- (ZEND_GET_ARG_FLAG( zf, arg_num) == ZEND_SEND_BY_REF)
1119
+ ZEND_CHECK_ARG_FLAG( zf, arg_num, ZEND_SEND_BY_REF)
1148
1120
1149
1121
#define QUICK_ARG_SHOULD_BE_SENT_BY_REF (zf , arg_num ) \
1150
- ((ZEND_GET_ARG_FLAG( zf, arg_num) & ZEND_SEND_BY_REF) != 0 )
1122
+ ZEND_CHECK_ARG_FLAG( zf, arg_num, ZEND_SEND_BY_REF|ZEND_SEND_PREFER_REF )
1151
1123
1152
1124
#define QUICK_ARG_MAY_BE_SENT_BY_REF (zf , arg_num ) \
1153
- (ZEND_GET_ARG_FLAG( zf, arg_num) != ZEND_SEND_BY_VAL )
1125
+ ZEND_CHECK_ARG_FLAG( zf, arg_num, ZEND_SEND_PREFER_REF )
1154
1126
1155
1127
#define ZEND_RETURN_VAL 0
1156
1128
#define ZEND_RETURN_REF 1
0 commit comments