Skip to content

Commit 2516abc

Browse files
committed
Use zend_always_inline instead of simple inline
1 parent 1591295 commit 2516abc

File tree

7 files changed

+60
-62
lines changed

7 files changed

+60
-62
lines changed

Zend/zend_API.h

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ ZEND_API zend_result zend_get_parameters_array_ex(uint32_t param_count, zval *ar
334334
/* internal function to efficiently copy parameters when executing __call() */
335335
ZEND_API zend_result zend_copy_parameters_array(uint32_t param_count, zval *argument_array);
336336

337-
// TODO Replace _ex version with zend_get_parameters_array()
338337
#define zend_get_parameters_array(ht, param_count, argument_array) \
339338
zend_get_parameters_array_ex(param_count, argument_array)
340339
#define zend_parse_parameters_none() \
@@ -381,7 +380,7 @@ ZEND_API void zend_class_implements(zend_class_entry *class_entry, int num_inter
381380

382381
ZEND_API zend_result zend_register_class_alias_ex(const char *name, size_t name_len, zend_class_entry *ce, bool persistent);
383382

384-
static inline zend_result zend_register_class_alias(const char *name, zend_class_entry *ce) {
383+
static zend_always_inline zend_result zend_register_class_alias(const char *name, zend_class_entry *ce) {
385384
return zend_register_class_alias_ex(name, strlen(name), ce, 1);
386385
}
387386
#define zend_register_ns_class_alias(ns, name, ce) \
@@ -540,40 +539,40 @@ ZEND_API void add_assoc_object_ex(zval *arg, const char *key, size_t key_len, ze
540539
ZEND_API void add_assoc_reference_ex(zval *arg, const char *key, size_t key_len, zend_reference *ref);
541540
ZEND_API void add_assoc_zval_ex(zval *arg, const char *key, size_t key_len, zval *value);
542541

543-
static inline void add_assoc_long(zval *arg, const char *key, zend_long n) {
542+
static zend_always_inline void add_assoc_long(zval *arg, const char *key, zend_long n) {
544543
add_assoc_long_ex(arg, key, strlen(key), n);
545544
}
546-
static inline void add_assoc_null(zval *arg, const char *key) {
545+
static zend_always_inline void add_assoc_null(zval *arg, const char *key) {
547546
add_assoc_null_ex(arg, key, strlen(key));
548547
}
549-
static inline void add_assoc_bool(zval *arg, const char *key, bool b) {
548+
static zend_always_inline void add_assoc_bool(zval *arg, const char *key, bool b) {
550549
add_assoc_bool_ex(arg, key, strlen(key), b);
551550
}
552-
static inline void add_assoc_resource(zval *arg, const char *key, zend_resource *r) {
551+
static zend_always_inline void add_assoc_resource(zval *arg, const char *key, zend_resource *r) {
553552
add_assoc_resource_ex(arg, key, strlen(key), r);
554553
}
555-
static inline void add_assoc_double(zval *arg, const char *key, double d) {
554+
static zend_always_inline void add_assoc_double(zval *arg, const char *key, double d) {
556555
add_assoc_double_ex(arg, key, strlen(key), d);
557556
}
558-
static inline void add_assoc_str(zval *arg, const char *key, zend_string *str) {
557+
static zend_always_inline void add_assoc_str(zval *arg, const char *key, zend_string *str) {
559558
add_assoc_str_ex(arg, key, strlen(key), str);
560559
}
561-
static inline void add_assoc_string(zval *arg, const char *key, const char *str) {
560+
static zend_always_inline void add_assoc_string(zval *arg, const char *key, const char *str) {
562561
add_assoc_string_ex(arg, key, strlen(key), str);
563562
}
564-
static inline void add_assoc_stringl(zval *arg, const char *key, const char *str, size_t length) {
563+
static zend_always_inline void add_assoc_stringl(zval *arg, const char *key, const char *str, size_t length) {
565564
add_assoc_stringl_ex(arg, key, strlen(key), str, length);
566565
}
567-
static inline void add_assoc_array(zval *arg, const char *key, zend_array *arr) {
566+
static zend_always_inline void add_assoc_array(zval *arg, const char *key, zend_array *arr) {
568567
add_assoc_array_ex(arg, key, strlen(key), arr);
569568
}
570-
static inline void add_assoc_object(zval *arg, const char *key, zend_object *obj) {
569+
static zend_always_inline void add_assoc_object(zval *arg, const char *key, zend_object *obj) {
571570
add_assoc_object_ex(arg, key, strlen(key), obj);
572571
}
573-
static inline void add_assoc_reference(zval *arg, const char *key, zend_reference *ref) {
572+
static zend_always_inline void add_assoc_reference(zval *arg, const char *key, zend_reference *ref) {
574573
add_assoc_reference_ex(arg, key, strlen(key), ref);
575574
}
576-
static inline void add_assoc_zval(zval *arg, const char *key, zval *value) {
575+
static zend_always_inline void add_assoc_zval(zval *arg, const char *key, zval *value) {
577576
add_assoc_zval_ex(arg, key, strlen(key), value);
578577
}
579578

@@ -626,44 +625,43 @@ ZEND_API void add_property_object_ex(zval *arg, const char *key, size_t key_len,
626625
ZEND_API void add_property_reference_ex(zval *arg, const char *key, size_t key_len, zend_reference *ref);
627626
ZEND_API void add_property_zval_ex(zval *arg, const char *key, size_t key_len, zval *value);
628627

629-
static inline void add_property_long(zval *arg, const char *key, zend_long n) {
628+
static zend_always_inline void add_property_long(zval *arg, const char *key, zend_long n) {
630629
add_property_long_ex(arg, key, strlen(key), n);
631630
}
632-
static inline void add_property_null(zval *arg, const char *key) {
631+
static zend_always_inline void add_property_null(zval *arg, const char *key) {
633632
add_property_null_ex(arg, key, strlen(key));
634633
}
635-
static inline void add_property_bool(zval *arg, const char *key, bool b) {
634+
static zend_always_inline void add_property_bool(zval *arg, const char *key, bool b) {
636635
add_property_bool_ex(arg, key, strlen(key), b);
637636
}
638-
static inline void add_property_resource(zval *arg, const char *key, zend_resource *r) {
637+
static zend_always_inline void add_property_resource(zval *arg, const char *key, zend_resource *r) {
639638
add_property_resource_ex(arg, key, strlen(key), r);
640639
}
641-
static inline void add_property_double(zval *arg, const char *key, double d) {
640+
static zend_always_inline void add_property_double(zval *arg, const char *key, double d) {
642641
add_property_double_ex(arg, key, strlen(key), d);
643642
}
644-
static inline void add_property_str(zval *arg, const char *key, zend_string *str) {
643+
static zend_always_inline void add_property_str(zval *arg, const char *key, zend_string *str) {
645644
add_property_str_ex(arg, key, strlen(key), str);
646645
}
647-
static inline void add_property_string(zval *arg, const char *key, const char *str) {
646+
static zend_always_inline void add_property_string(zval *arg, const char *key, const char *str) {
648647
add_property_string_ex(arg, key, strlen(key), str);
649648
}
650-
static inline void add_property_stringl(zval *arg, const char *key, const char *str, size_t length) {
649+
static zend_always_inline void add_property_stringl(zval *arg, const char *key, const char *str, size_t length) {
651650
add_property_stringl_ex(arg, key, strlen(key), str, length);
652651
}
653-
static inline void add_property_array(zval *arg, const char *key, zend_array *arr) {
652+
static zend_always_inline void add_property_array(zval *arg, const char *key, zend_array *arr) {
654653
add_property_array_ex(arg, key, strlen(key), arr);
655654
}
656-
static inline void add_property_object(zval *arg, const char *key, zend_object *obj) {
655+
static zend_always_inline void add_property_object(zval *arg, const char *key, zend_object *obj) {
657656
add_property_object_ex(arg, key, strlen(key), obj);
658657
}
659-
static inline void add_property_reference(zval *arg, const char *key, zend_reference *ref) {
658+
static zend_always_inline void add_property_reference(zval *arg, const char *key, zend_reference *ref) {
660659
add_property_reference_ex(arg, key, strlen(key), ref);
661660
}
662-
static inline void add_property_zval(zval *arg, const char *key, zval *value) {
661+
static zend_always_inline void add_property_zval(zval *arg, const char *key, zval *value) {
663662
add_property_zval_ex(arg, key, strlen(key), value);
664663
}
665664

666-
// TODO Drop function_table argument?
667665
ZEND_API zend_result _call_user_function_impl(zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[], HashTable *named_params);
668666

669667
#define call_user_function(function_table, object, function_name, retval_ptr, param_count, params) \

Zend/zend_hash.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -257,31 +257,31 @@ ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_end_ex(HashTable *ht, Ha
257257
static zend_always_inline zend_result zend_hash_has_more_elements_ex(HashTable *ht, HashPosition *pos) {
258258
return (zend_hash_get_current_key_type_ex(ht, pos) == HASH_KEY_NON_EXISTENT ? FAILURE : SUCCESS);
259259
}
260-
static inline zend_result zend_hash_has_more_elements(HashTable *ht) {
260+
static zend_always_inline zend_result zend_hash_has_more_elements(HashTable *ht) {
261261
return zend_hash_has_more_elements_ex(ht, &ht->nInternalPointer);
262262
}
263-
static inline zend_result zend_hash_move_forward(HashTable *ht) {
263+
static zend_always_inline zend_result zend_hash_move_forward(HashTable *ht) {
264264
return zend_hash_move_forward_ex(ht, &ht->nInternalPointer);
265265
}
266-
static inline zend_result zend_hash_move_backwards(HashTable *ht) {
266+
static zend_always_inline zend_result zend_hash_move_backwards(HashTable *ht) {
267267
return zend_hash_move_backwards_ex(ht, &ht->nInternalPointer);
268268
}
269-
static inline int zend_hash_get_current_key(const HashTable *ht, zend_string **str_index, zend_ulong *num_index) {
269+
static zend_always_inline int zend_hash_get_current_key(const HashTable *ht, zend_string **str_index, zend_ulong *num_index) {
270270
return zend_hash_get_current_key_ex(ht, str_index, num_index, &ht->nInternalPointer);
271271
}
272-
static inline void zend_hash_get_current_key_zval(const HashTable *ht, zval *key) {
272+
static zend_always_inline void zend_hash_get_current_key_zval(const HashTable *ht, zval *key) {
273273
zend_hash_get_current_key_zval_ex(ht, key, &ht->nInternalPointer);
274274
}
275-
static inline int zend_hash_get_current_key_type(HashTable *ht) {
275+
static zend_always_inline int zend_hash_get_current_key_type(HashTable *ht) {
276276
return zend_hash_get_current_key_type_ex(ht, &ht->nInternalPointer);
277277
}
278-
static inline zval* zend_hash_get_current_data(HashTable *ht) {
278+
static zend_always_inline zval* zend_hash_get_current_data(HashTable *ht) {
279279
return zend_hash_get_current_data_ex(ht, &ht->nInternalPointer);
280280
}
281-
static inline void zend_hash_internal_pointer_reset(HashTable *ht) {
281+
static zend_always_inline void zend_hash_internal_pointer_reset(HashTable *ht) {
282282
zend_hash_internal_pointer_reset_ex(ht, &ht->nInternalPointer);
283283
}
284-
static inline void zend_hash_internal_pointer_end(HashTable *ht) {
284+
static zend_always_inline void zend_hash_internal_pointer_end(HashTable *ht) {
285285
zend_hash_internal_pointer_end_ex(ht, &ht->nInternalPointer);
286286
}
287287

@@ -298,15 +298,15 @@ ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t
298298
ZEND_API void ZEND_FASTCALL zend_hash_sort_ex(HashTable *ht, sort_func_t sort_func, bucket_compare_func_t compare_func, bool renumber);
299299
ZEND_API zval* ZEND_FASTCALL zend_hash_minmax(const HashTable *ht, compare_func_t compar, uint32_t flag);
300300

301-
static inline void ZEND_FASTCALL zend_hash_sort(HashTable *ht, bucket_compare_func_t compare_func, zend_bool renumber) {
301+
static zend_always_inline void ZEND_FASTCALL zend_hash_sort(HashTable *ht, bucket_compare_func_t compare_func, zend_bool renumber) {
302302
zend_hash_sort_ex(ht, zend_sort, compare_func, renumber);
303303
}
304304

305-
static inline uint32_t zend_hash_num_elements(const HashTable *ht) {
305+
static zend_always_inline uint32_t zend_hash_num_elements(const HashTable *ht) {
306306
return ht->nNumOfElements;
307307
}
308308

309-
static inline zend_long zend_hash_next_free_element(const HashTable *ht) {
309+
static zend_always_inline zend_long zend_hash_next_free_element(const HashTable *ht) {
310310
return ht->nNextFreeElement;
311311
}
312312

Zend/zend_inheritance.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ BEGIN_EXTERN_C()
2727
ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry *iface);
2828
ZEND_API void zend_do_inheritance_ex(zend_class_entry *ce, zend_class_entry *parent_ce, bool checked);
2929

30-
static inline void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce) {
30+
static zend_always_inline void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce) {
3131
zend_do_inheritance_ex(ce, parent_ce, 0);
3232
}
3333

Zend/zend_interfaces.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,19 @@ typedef struct _zend_user_iterator {
4040

4141
ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, size_t function_name_len, zval *retval, uint32_t param_count, zval* arg1, zval* arg2);
4242

43-
static inline zval* zend_call_method_with_0_params(zend_object *object, zend_class_entry *obj_ce,
43+
static zend_always_inline zval* zend_call_method_with_0_params(zend_object *object, zend_class_entry *obj_ce,
4444
zend_function **fn_proxy, const char *function_name, zval *retval)
4545
{
4646
return zend_call_method(object, obj_ce, fn_proxy, function_name, strlen(function_name), retval, 0, NULL, NULL);
4747
}
4848

49-
static inline zval* zend_call_method_with_1_params(zend_object *object, zend_class_entry *obj_ce,
49+
static zend_always_inline zval* zend_call_method_with_1_params(zend_object *object, zend_class_entry *obj_ce,
5050
zend_function **fn_proxy, const char *function_name, zval *retval, zval* arg1)
5151
{
5252
return zend_call_method(object, obj_ce, fn_proxy, function_name, strlen(function_name), retval, 1, arg1, NULL);
5353
}
5454

55-
static inline zval* zend_call_method_with_2_params(zend_object *object, zend_class_entry *obj_ce,
55+
static zend_always_inline zval* zend_call_method_with_2_params(zend_object *object, zend_class_entry *obj_ce,
5656
zend_function **fn_proxy, const char *function_name, zval *retval, zval* arg1, zval* arg2)
5757
{
5858
return zend_call_method(object, obj_ce, fn_proxy, function_name, strlen(function_name), retval, 2, arg1, arg2);

Zend/zend_llist.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,22 @@ ZEND_API void *zend_llist_get_last_ex(zend_llist *l, zend_llist_position *pos);
6666
ZEND_API void *zend_llist_get_next_ex(zend_llist *l, zend_llist_position *pos);
6767
ZEND_API void *zend_llist_get_prev_ex(zend_llist *l, zend_llist_position *pos);
6868

69-
static inline void *zend_llist_get_first(zend_llist *l)
69+
static zend_always_inline void *zend_llist_get_first(zend_llist *l)
7070
{
7171
return zend_llist_get_first_ex(l, NULL);
7272
}
7373

74-
static inline void *zend_llist_get_last(zend_llist *l)
74+
static zend_always_inline void *zend_llist_get_last(zend_llist *l)
7575
{
7676
return zend_llist_get_last_ex(l, NULL);
7777
}
7878

79-
static inline void *zend_llist_get_next(zend_llist *l)
79+
static zend_always_inline void *zend_llist_get_next(zend_llist *l)
8080
{
8181
return zend_llist_get_next_ex(l, NULL);
8282
}
8383

84-
static inline void *zend_llist_get_prev(zend_llist *l)
84+
static zend_always_inline void *zend_llist_get_prev(zend_llist *l)
8585
{
8686
return zend_llist_get_prev_ex(l, NULL);
8787
}

Zend/zend_operators.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,10 +450,10 @@ ZEND_API char* ZEND_FASTCALL zend_str_toupper_dup_ex(const char *source,
450450
ZEND_API zend_string* ZEND_FASTCALL zend_string_tolower_ex(zend_string *str, bool persistent);
451451
ZEND_API zend_string* ZEND_FASTCALL zend_string_toupper_ex(zend_string *str, bool persistent);
452452

453-
static inline zend_string* zend_string_tolower(zend_string *str) {
453+
static zend_always_inline zend_string* zend_string_tolower(zend_string *str) {
454454
return zend_string_tolower_ex(str, false);
455455
}
456-
static inline zend_string* zend_string_toupper(zend_string *str) {
456+
static zend_always_inline zend_string* zend_string_toupper(zend_string *str) {
457457
return zend_string_toupper_ex(str, false);
458458
}
459459

Zend/zend_smart_str.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static zend_always_inline char* smart_str_extend_ex(smart_str *dest, size_t len,
6060
return ret;
6161
}
6262

63-
static inline char* smart_str_extend(smart_str *dest, size_t length)
63+
static zend_always_inline char* smart_str_extend(smart_str *dest, size_t length)
6464
{
6565
return smart_str_extend_ex(dest, length, false);
6666
}
@@ -73,7 +73,7 @@ static zend_always_inline void smart_str_free_ex(smart_str *str, bool persistent
7373
str->a = 0;
7474
}
7575

76-
static inline void smart_str_free(smart_str *str)
76+
static zend_always_inline void smart_str_free(smart_str *str)
7777
{
7878
smart_str_free_ex(str, false);
7979
}
@@ -96,7 +96,7 @@ static zend_always_inline void smart_str_trim_to_size_ex(smart_str *str, bool pe
9696
}
9797
}
9898

99-
static inline void smart_str_trim_to_size(smart_str *dest)
99+
static zend_always_inline void smart_str_trim_to_size(smart_str *dest)
100100
{
101101
smart_str_trim_to_size_ex(dest, false);
102102
}
@@ -114,7 +114,7 @@ static zend_always_inline zend_string *smart_str_extract_ex(smart_str *str, bool
114114
}
115115
}
116116

117-
static inline zend_string *smart_str_extract(smart_str *dest)
117+
static zend_always_inline zend_string *smart_str_extract(smart_str *dest)
118118
{
119119
return smart_str_extract_ex(dest, false);
120120
}
@@ -147,7 +147,7 @@ static zend_always_inline void smart_str_append_long_ex(smart_str *dest, zend_lo
147147
smart_str_appendl_ex(dest, result, buf + sizeof(buf) - 1 - result, persistent);
148148
}
149149

150-
static inline void smart_str_append_long(smart_str *dest, zend_long num)
150+
static zend_always_inline void smart_str_append_long(smart_str *dest, zend_long num)
151151
{
152152
smart_str_append_long_ex(dest, num, false);
153153
}
@@ -158,32 +158,32 @@ static zend_always_inline void smart_str_append_unsigned_ex(smart_str *dest, zen
158158
smart_str_appendl_ex(dest, result, buf + sizeof(buf) - 1 - result, persistent);
159159
}
160160

161-
static inline void smart_str_append_unsigned(smart_str *dest, zend_ulong num)
161+
static zend_always_inline void smart_str_append_unsigned(smart_str *dest, zend_ulong num)
162162
{
163163
smart_str_append_unsigned_ex(dest, num, false);
164164
}
165165

166-
static inline void smart_str_appendl(smart_str *dest, const char *src, size_t length)
166+
static zend_always_inline void smart_str_appendl(smart_str *dest, const char *src, size_t length)
167167
{
168168
smart_str_appendl_ex(dest, src, length, false);
169169
}
170-
static inline void smart_str_appends_ex(smart_str *dest, const char *src, bool persistent)
170+
static zend_always_inline void smart_str_appends_ex(smart_str *dest, const char *src, bool persistent)
171171
{
172172
smart_str_appendl_ex(dest, src, strlen(src), persistent);
173173
}
174-
static inline void smart_str_appends(smart_str *dest, const char *src)
174+
static zend_always_inline void smart_str_appends(smart_str *dest, const char *src)
175175
{
176176
smart_str_appendl_ex(dest, src, strlen(src), false);
177177
}
178-
static inline void smart_str_append(smart_str *dest, const zend_string *src)
178+
static zend_always_inline void smart_str_append(smart_str *dest, const zend_string *src)
179179
{
180180
smart_str_append_ex(dest, src, false);
181181
}
182-
static inline void smart_str_appendc(smart_str *dest, char ch)
182+
static zend_always_inline void smart_str_appendc(smart_str *dest, char ch)
183183
{
184184
smart_str_appendc_ex(dest, ch, false);
185185
}
186-
static inline void smart_str_append_smart_str(smart_str *dest, const smart_str *src)
186+
static zend_always_inline void smart_str_append_smart_str(smart_str *dest, const smart_str *src)
187187
{
188188
smart_str_append_smart_str_ex(dest, src, false);
189189
}
@@ -193,7 +193,7 @@ static zend_always_inline void smart_str_setl(smart_str *dest, const char *src,
193193
smart_str_appendl(dest, src, len);
194194
}
195195

196-
static inline void smart_str_sets(smart_str *dest, const char *src)
196+
static zend_always_inline void smart_str_sets(smart_str *dest, const char *src)
197197
{
198198
smart_str_setl(dest, src, strlen(src));
199199
}

0 commit comments

Comments
 (0)