From 97e7521e494ea7f8e75298882a8b391df31e426d Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 10 Oct 2017 15:45:03 +0300 Subject: [PATCH] AST don't have to be COPYABLE anymore. --- Zend/zend_types.h | 2 +- Zend/zend_variables.c | 2 -- ext/opcache/zend_persist.c | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Zend/zend_types.h b/Zend/zend_types.h index ce7ebaca69..4f073d4719 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 d7fd5239d7..97a2ea474c 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 8fb7f41e3e..dd68305dbd 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); } -- 2.50.1