com php-src: Fixed store of "shared" zend_strings: ext/op cache/zend_persist.c ext/opcache/zend_shared_alloc. c
| From: | Dmitry Stogov | Date: | Wed, 09 Apr 2014 05:43:42 +0000 |
| Subject: | com php-src: Fixed store of "shared" zend_strings: ext/op cache/zend_persist.c ext/opcache/zend_shared_alloc. c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-77477@lists.php.net to get a copy of this message | ||
Commit: 479f520d14ed221765af3ff5a3eb77dc54e1defa
Author: Dmitry Stogov <dmitry@zend.com> Wed, 9 Apr 2014 09:43:42 +0400
Parents: 7402af380b3a700dda0e89470770fde15bd56204
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=479f520d14ed221765af3ff5a3eb77dc54e1defa
Log:
Fixed store of "shared" zend_strings
Changed paths:
M ext/opcache/zend_persist.c
M ext/opcache/zend_shared_alloc.c
Diff:
diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c
index 20f5752..776359e 100644
--- a/ext/opcache/zend_persist.c
+++ b/ext/opcache/zend_persist.c
@@ -34,12 +34,23 @@
_zend_shared_memdup((void*)p, size, 0 TSRMLS_CC)
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
-# define zend_accel_store_string(str) \
- zend_accel_store(str, sizeof(zend_string) + (str)->len)
+# define zend_accel_store_string(str) do { \
+ zend_string *new_str = zend_shared_alloc_get_xlat_entry(str); \
+ if (new_str) { \
+ str = new_str; \
+ } else { \
+ new_str = _zend_shared_memdup((void*)str, sizeof(zend_string) + (str)->len, 0 TSRMLS_CC);
\
+ efree(str); \
+ str = new_str; \
+ } \
+ } while (0)
# define zend_accel_memdup_string(str) \
zend_accel_memdup(str, sizeof(zend_string) + (str)->len)
-# define zend_accel_store_interned_string(str) \
- (IS_ACCEL_INTERNED(str) ? str : zend_accel_store_string(str))
+# define zend_accel_store_interned_string(str) do { \
+ if (!IS_ACCEL_INTERNED(str)) { \
+ zend_accel_store_string(str); \
+ } \
+ } while (0)
# define zend_accel_memdup_interned_string(str) \
(IS_ACCEL_INTERNED(str) ? str : zend_accel_memdup_string(str))
#else
diff --git a/ext/opcache/zend_shared_alloc.c b/ext/opcache/zend_shared_alloc.c
index 73f331d..4a31d3d 100644
--- a/ext/opcache/zend_shared_alloc.c
+++ b/ext/opcache/zend_shared_alloc.c
@@ -348,7 +348,6 @@ void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source TSRML
memcpy(retval, source, size);
if (free_source) {
efree(source);
-//??? interned_efree((char*)source);
}
zend_shared_alloc_register_xlat_entry(source, retval);
return retval;