com php-src: Use interned strings for function names: ext/opcache/Optimizer/zend_func_info.c
| From: | Dmitry Stogov | Date: | Wed, 29 Nov 2017 23:06:52 +0000 |
| Subject: | com php-src: Use interned strings for function names: ext/opcache/Optimizer/zend_func_info.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-100444@lists.php.net to get a copy of this message | ||
Commit: eccdc48c565e5147133c67e05e0c81a81326e83f
Author: Dmitry Stogov <dmitry@zend.com> Thu, 30 Nov 2017 02:06:52 +0300
Parents: 3f86f43e5110f0ec96ce79a75331ad6b0d106843
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=eccdc48c565e5147133c67e05e0c81a81326e83f
Log:
Use interned strings for function names
Changed paths:
M ext/opcache/Optimizer/zend_func_info.c
Diff:
diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c
index 957d538..8b4f128 100644
--- a/ext/opcache/Optimizer/zend_func_info.c
+++ b/ext/opcache/Optimizer/zend_func_info.c
@@ -1691,9 +1691,12 @@ uint32_t zend_get_func_info(const zend_call_info *call_info, const zend_ssa
*ssa
uint32_t ret = 0;
if (call_info->callee_func->type == ZEND_INTERNAL_FUNCTION) {
+ zval *zv;
func_info_t *info;
- if ((info = zend_hash_find_ptr(&func_info,
Z_STR_P(CRT_CONSTANT_EX(call_info->caller_op_array, call_info->caller_init_opline,
call_info->caller_init_opline->op2, ssa->rt_constants)))) != NULL) {
+ zv = zend_hash_find_ex(&func_info, Z_STR_P(CRT_CONSTANT_EX(call_info->caller_op_array,
call_info->caller_init_opline, call_info->caller_init_opline->op2, ssa->rt_constants)),
1);
+ if (zv) {
+ info = Z_PTR_P(zv);
if (UNEXPECTED(zend_optimizer_is_disabled_func(info->name, info->name_len))) {
ret = MAY_BE_NULL;
} else if (info->info_func) {
@@ -1750,9 +1753,12 @@ int zend_func_info_startup(void)
zend_hash_init(&func_info, sizeof(func_infos)/sizeof(func_info_t), NULL, NULL, 1);
for (i = 0; i < sizeof(func_infos)/sizeof(func_info_t); i++) {
- if (zend_hash_str_add_ptr(&func_info, func_infos[i].name, func_infos[i].name_len,
(void**)&func_infos[i]) == NULL) {
+ zend_string *key = zend_string_init_interned(func_infos[i].name, func_infos[i].name_len, 1);
+
+ if (zend_hash_add_ptr(&func_info, key, (void**)&func_infos[i]) == NULL) {
fprintf(stderr, "ERROR: Duplicate function info for \"%s\"\n",
func_infos[i].name);
}
+ zend_string_release(key);
}
}