From c6982995504b6e21e8a5ade29cfb16a55196dc43 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sat, 4 Mar 2017 10:39:13 +0100 Subject: 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. --- Zend/zend_constants.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Zend/zend_constants.c') 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)); -- cgit v1.2.1