mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fast Class Cache
This is generalization of idea, that was previously usesd for caching resolution of class_entries in zend_type. Now very similar mechanizm is used for general zend_string into zend_class_entry resolution. Interned zend_string with IS_STR_CLASS_NAME_MAP_PTR GC_FLAG uses its refcount to adress corresponding zend_class_entry cache slot. The refcount keeps an offset to this slot from CG(map_ptr_base). Flag may be checked by ZSTR_HAS_CE_CACHE(str), cache slot may be read by ZSTR_GET_CE_CACHE(str) and set by ZSTR_SET_CE_CACHE(str, ce).
This commit is contained in:
parent
ad4b928750
commit
d8e4fbae62
16 changed files with 216 additions and 135 deletions
|
@ -2682,6 +2682,9 @@ ZEND_API zend_class_entry *zend_do_link_class(zend_class_entry *ce, zend_string
|
|||
}
|
||||
zv = zend_hash_find_ex(CG(class_table), key, 1);
|
||||
Z_CE_P(zv) = ret;
|
||||
if (ZSTR_HAS_CE_CACHE(ret->name)) {
|
||||
ZSTR_SET_CE_CACHE(ret->name, ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
|
@ -2803,6 +2806,10 @@ ZEND_API zend_class_entry *zend_do_link_class(zend_class_entry *ce, zend_string
|
|||
free_alloca(traits_and_interfaces, use_heap);
|
||||
}
|
||||
|
||||
if (ZSTR_HAS_CE_CACHE(ce->name)) {
|
||||
ZSTR_SET_CE_CACHE(ce->name, ce);
|
||||
}
|
||||
|
||||
return ce;
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -2875,6 +2882,9 @@ zend_class_entry *zend_try_early_bind(zend_class_entry *ce, zend_class_entry *pa
|
|||
return NULL;
|
||||
}
|
||||
}
|
||||
if (ZSTR_HAS_CE_CACHE(ret->name)) {
|
||||
ZSTR_SET_CE_CACHE(ret->name, ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
|
@ -2942,6 +2952,10 @@ zend_class_entry *zend_try_early_bind(zend_class_entry *ce, zend_class_entry *pa
|
|||
}
|
||||
}
|
||||
|
||||
if (ZSTR_HAS_CE_CACHE(ce->name)) {
|
||||
ZSTR_SET_CE_CACHE(ce->name, ce);
|
||||
}
|
||||
|
||||
return ce;
|
||||
}
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue