diff options
author | Dmitry Stogov <dmitry@zend.com> | 2018-10-23 12:46:44 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2018-10-23 12:46:44 +0300 |
commit | 6f91090f6ae42901d3eef48d7405bebeaff2ce21 (patch) | |
tree | 1f9d9db924d363e33fd9cd6467f63262476efc75 /Zend/zend_API.c | |
parent | fd080a06d84d9deb1a6a6be3b1e9a5eeff2fc77b (diff) | |
download | php-git-6f91090f6ae42901d3eef48d7405bebeaff2ce21.tar.gz |
Inlining in the most frequently used code paths
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r-- | Zend/zend_API.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 22ce397bd3..0672ec1510 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -1189,7 +1189,7 @@ ZEND_API int zend_update_class_constants(zend_class_entry *class_type) /* {{{ */ } /* }}} */ -ZEND_API void object_properties_init(zend_object *object, zend_class_entry *class_type) /* {{{ */ +static zend_always_inline void _object_properties_init(zend_object *object, zend_class_entry *class_type) /* {{{ */ { if (class_type->default_properties_count) { zval *src = class_type->default_properties_table; @@ -1209,11 +1209,17 @@ ZEND_API void object_properties_init(zend_object *object, zend_class_entry *clas dst++; } while (src != end); } - object->properties = NULL; } } /* }}} */ +ZEND_API void object_properties_init(zend_object *object, zend_class_entry *class_type) /* {{{ */ +{ + object->properties = NULL; + _object_properties_init(object, class_type); +} +/* }}} */ + ZEND_API void object_properties_init_ex(zend_object *object, HashTable *properties) /* {{{ */ { object->properties = properties; @@ -1298,7 +1304,7 @@ ZEND_API void object_properties_load(zend_object *object, HashTable *properties) * class and all props being public. If only a subset is given or the class * has protected members then you need to merge the properties separately by * calling zend_merge_properties(). */ -ZEND_API int object_and_properties_init(zval *arg, zend_class_entry *class_type, HashTable *properties) /* {{{ */ +static zend_always_inline int _object_and_properties_init(zval *arg, zend_class_entry *class_type, HashTable *properties) /* {{{ */ { if (UNEXPECTED(class_type->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_TRAIT|ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS))) { if (class_type->ce_flags & ZEND_ACC_INTERFACE) { @@ -1322,11 +1328,13 @@ ZEND_API int object_and_properties_init(zval *arg, zend_class_entry *class_type, } if (class_type->create_object == NULL) { - ZVAL_OBJ(arg, zend_objects_new(class_type)); + zend_object *obj = zend_objects_new(class_type); + + ZVAL_OBJ(arg, obj); if (properties) { - object_properties_init_ex(Z_OBJ_P(arg), properties); + object_properties_init_ex(obj, properties); } else { - object_properties_init(Z_OBJ_P(arg), class_type); + _object_properties_init(obj, class_type); } } else { ZVAL_OBJ(arg, class_type->create_object(class_type)); @@ -1335,9 +1343,15 @@ ZEND_API int object_and_properties_init(zval *arg, zend_class_entry *class_type, } /* }}} */ +ZEND_API int object_and_properties_init(zval *arg, zend_class_entry *class_type, HashTable *properties) /* {{{ */ +{ + return _object_and_properties_init(arg, class_type, properties); +} +/* }}} */ + ZEND_API int object_init_ex(zval *arg, zend_class_entry *class_type) /* {{{ */ { - return object_and_properties_init(arg, class_type, 0); + return _object_and_properties_init(arg, class_type, NULL); } /* }}} */ |