summaryrefslogtreecommitdiff
path: root/Zend/zend_constants.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2017-03-04 10:39:13 +0100
committerAnatol Belski <ab@php.net>2017-03-04 10:39:13 +0100
commitc6982995504b6e21e8a5ade29cfb16a55196dc43 (patch)
treea196886e83d43fa9ece21e127edde10e3ab57c3e /Zend/zend_constants.c
parenta07272e5b63b404ff7070637137e81634a886bd8 (diff)
downloadphp-git-c6982995504b6e21e8a5ade29cfb16a55196dc43.tar.gz
Interned strings unification for TS/NTS
Hereby, interned strings are supported in thread safe PHP. The patch implements two types of interned strings - interning per process, strings are not freed till process end - interning per request, strings are freed at request end There is no runtime interning. With Opcache, all the permanent iterned strings are copied into SHM on startup, additional copying into SHM might happen on demand.
Diffstat (limited to 'Zend/zend_constants.c')
-rw-r--r--Zend/zend_constants.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c
index 17f80aa19a..14dd08dad0 100644
--- a/Zend/zend_constants.c
+++ b/Zend/zend_constants.c
@@ -489,6 +489,10 @@ ZEND_API int zend_register_constant(zend_constant *c)
printf("Registering constant for module %d\n", c->module_number);
#endif
+ if (c->module_number != PHP_USER_CONSTANT) {
+ c->name = zend_new_interned_string(c->name);
+ }
+
if (!(c->flags & CONST_CS)) {
lowercase_name = zend_string_alloc(ZSTR_LEN(c->name), c->flags & CONST_PERSISTENT);
zend_str_tolower_copy(ZSTR_VAL(lowercase_name), ZSTR_VAL(c->name), ZSTR_LEN(c->name));