diff options
author | Anatol Belski <ab@php.net> | 2017-03-04 10:39:13 +0100 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2017-03-04 10:39:13 +0100 |
commit | c6982995504b6e21e8a5ade29cfb16a55196dc43 (patch) | |
tree | a196886e83d43fa9ece21e127edde10e3ab57c3e /Zend/zend_execute.c | |
parent | a07272e5b63b404ff7070637137e81634a886bd8 (diff) | |
download | php-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_execute.c')
-rw-r--r-- | Zend/zend_execute.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 68f5b3ce6c..451185969c 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1264,11 +1264,7 @@ static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim, if (result) { /* Return the new character */ - if (CG(one_char_string)[c]) { - ZVAL_INTERNED_STR(result, CG(one_char_string)[c]); - } else { - ZVAL_NEW_STR(result, zend_string_init(Z_STRVAL_P(str) + offset, 1, 0)); - } + ZVAL_INTERNED_STR(result, ZSTR_CHAR(c)); } } @@ -1781,11 +1777,7 @@ try_string_offset: ? (zend_long)Z_STRLEN_P(container) + offset : offset; c = (zend_uchar)Z_STRVAL_P(container)[real_offset]; - if (CG(one_char_string)[c]) { - ZVAL_INTERNED_STR(result, CG(one_char_string)[c]); - } else { - ZVAL_NEW_STR(result, zend_string_init(Z_STRVAL_P(container) + real_offset, 1, 0)); - } + ZVAL_INTERNED_STR(result, ZSTR_CHAR(c)); } } else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) { if (/*dim_type == IS_CV &&*/ UNEXPECTED(Z_TYPE_P(dim) == IS_UNDEF)) { |