com php-src: AST don't have to be COPYABLE anymore.: Zend/zend_types.h Zend/zend_variables.c ext/opcache /zend_persist.c
| From: | Dmitry Stogov | Date: | Tue, 10 Oct 2017 12:45:03 +0000 |
| Subject: | com php-src: AST don't have to be COPYABLE anymore.: Zend/zend_types.h Zend/zend_variables.c ext/opcache /zend_persist.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-99686@lists.php.net to get a copy of this message | ||
Commit: 97e7521e494ea7f8e75298882a8b391df31e426d
Author: Dmitry Stogov <dmitry@zend.com> Tue, 10 Oct 2017 15:45:03 +0300
Parents: 05b9f967a9fafd1e9c77f4fba1025be1b0035b40
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=97e7521e494ea7f8e75298882a8b391df31e426d
Log:
AST don't have to be COPYABLE anymore.
Changed paths:
M Zend/zend_types.h
M Zend/zend_variables.c
M ext/opcache/zend_persist.c
Diff:
diff --git a/Zend/zend_types.h b/Zend/zend_types.h
index ce7ebac..4f073d4 100644
--- a/Zend/zend_types.h
+++ b/Zend/zend_types.h
@@ -475,7 +475,7 @@ static zend_always_inline zend_uchar zval_get_type(const zval* pz) {
#define IS_RESOURCE_EX (IS_RESOURCE | ((IS_TYPE_REFCOUNTED ) <<
Z_TYPE_FLAGS_SHIFT))
#define IS_REFERENCE_EX (IS_REFERENCE | ((IS_TYPE_REFCOUNTED ) <<
Z_TYPE_FLAGS_SHIFT))
-#define IS_CONSTANT_AST_EX (IS_CONSTANT_AST | ((IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE) <<
Z_TYPE_FLAGS_SHIFT))
+#define IS_CONSTANT_AST_EX (IS_CONSTANT_AST | ((IS_TYPE_REFCOUNTED ) <<
Z_TYPE_FLAGS_SHIFT))
#define IS_CONSTANT_VISITED(p) (Z_TYPE_FLAGS_P(p) & IS_CONSTANT_VISITED_MARK)
#define MARK_CONSTANT_VISITED(p) Z_TYPE_FLAGS_P(p) |= IS_CONSTANT_VISITED_MARK
diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c
index d7fd523..97a2ea4 100644
--- a/Zend/zend_variables.c
+++ b/Zend/zend_variables.c
@@ -167,8 +167,6 @@ ZEND_API void ZEND_FASTCALL _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC)
} else if (EXPECTED(Z_TYPE_P(zvalue) == IS_STRING)) {
CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue));
ZVAL_NEW_STR(zvalue, zend_string_dup(Z_STR_P(zvalue), 0));
- } else if (EXPECTED(Z_TYPE_P(zvalue) == IS_CONSTANT_AST)) {
- ZVAL_AST(zvalue, zend_ast_copy(Z_ASTVAL_P(zvalue)));
}
}
diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c
index 8fb7f41..dd68305 100644
--- a/ext/opcache/zend_persist.c
+++ b/ext/opcache/zend_persist.c
@@ -319,12 +319,12 @@ static void zend_persist_zval(zval *z)
new_ptr = zend_shared_alloc_get_xlat_entry(Z_AST_P(z));
if (new_ptr) {
Z_AST_P(z) = new_ptr;
- Z_TYPE_FLAGS_P(z) = IS_TYPE_COPYABLE;
+ Z_TYPE_FLAGS_P(z) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
} else {
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_COPYABLE;
+ Z_TYPE_FLAGS_P(z) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
GC_REFCOUNT(Z_COUNTED_P(z)) = 2;
efree(old_ref);
}