diff options
author | Dmitry Stogov <dmitry@zend.com> | 2017-10-09 16:57:51 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2017-10-09 16:57:51 +0300 |
commit | 39ded1d5f85ca3358cc8a52bb37e72a5eb5ce0db (patch) | |
tree | a3c1e3905f8a97c3ca0c34d2c944d2b8b8ae37c6 /ext | |
parent | 65f610bd9fdad785aa7fbbc1a325acd329b3240e (diff) | |
download | php-git-39ded1d5f85ca3358cc8a52bb37e72a5eb5ce0db.tar.gz |
Changed zend_ast_ref structure to use only one allocation, removing dichotomy between heap/arena ASTs.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/opcache/zend_file_cache.c | 9 | ||||
-rw-r--r-- | ext/opcache/zend_persist.c | 7 |
2 files changed, 6 insertions, 10 deletions
diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c index 972700d4fe..a7758058de 100644 --- a/ext/opcache/zend_file_cache.c +++ b/ext/opcache/zend_file_cache.c @@ -337,9 +337,7 @@ static void zend_file_cache_serialize_zval(zval *zv, SERIALIZE_PTR(Z_AST_P(zv)); ast = Z_AST_P(zv); UNSERIALIZE_PTR(ast); - if (!IS_SERIALIZED(ast->ast)) { - ast->ast = zend_file_cache_serialize_ast(ast->ast, script, info, buf); - } + zend_file_cache_serialize_ast(Z_ASTVAL_P(zv), script, info, buf); } break; } @@ -950,10 +948,7 @@ static void zend_file_cache_unserialize_zval(zval *zv, zend_ast_ref *ast; UNSERIALIZE_PTR(Z_AST_P(zv)); - ast = Z_AST_P(zv); - if (!IS_UNSERIALIZED(ast->ast)) { - ast->ast = zend_file_cache_unserialize_ast(ast->ast, script, buf); - } + zend_file_cache_unserialize_ast(Z_ASTVAL_P(zv), script, buf); } break; } diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index cd4077279f..c21842b66f 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -273,7 +273,6 @@ static zend_ast *zend_persist_ast(zend_ast *ast) } } - efree(ast); return node; } @@ -323,10 +322,12 @@ static void zend_persist_zval(zval *z) Z_AST_P(z) = new_ptr; Z_TYPE_FLAGS_P(z) = IS_TYPE_CONSTANT | IS_TYPE_COPYABLE; } else { - zend_accel_store(Z_AST_P(z), sizeof(zend_ast_ref)); - Z_ASTVAL_P(z) = zend_persist_ast(Z_ASTVAL_P(z)); + zend_ast_ref *old_ref = Z_AST_P(z); + Z_ARR_P(z) = zend_accel_memdup(Z_AST_P(z), sizeof(zend_ast_ref)); + zend_persist_ast(GC_AST(old_ref)); Z_TYPE_FLAGS_P(z) = IS_TYPE_CONSTANT | IS_TYPE_COPYABLE; GC_REFCOUNT(Z_COUNTED_P(z)) = 2; + efree(old_ref); } break; } |