diff options
| author | Dmitry Stogov <dmitry@zend.com> | 2017-10-27 01:28:58 +0300 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@zend.com> | 2017-10-27 01:28:58 +0300 |
| commit | 49ea143bbd8d0bfcd393d0b5308a5d7833fc087c (patch) | |
| tree | 071b08e8067e5a6a1e9726e3d76dfe81cc42d6b0 /ext/opcache/zend_persist.c | |
| parent | 1ab0d820dabc612b7d371d6ed524f60f68101d0f (diff) | |
| download | php-git-49ea143bbd8d0bfcd393d0b5308a5d7833fc087c.tar.gz | |
Encapsulate reference-counting primitives.
Prohibit direct update of GC_REFCOUNT(), GC_SET_REFCOUNT(), GC_ADDREF() and GC_DELREF() shoukf be instead.
Added mactros to validate reference-counting (disabled for now).
These macros are going to be used to eliminate race-condintions during reference-counting on data shared between threads.
Diffstat (limited to 'ext/opcache/zend_persist.c')
| -rw-r--r-- | ext/opcache/zend_persist.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index d2d943ddbb..a6792aa1ff 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -300,7 +300,7 @@ static void zend_persist_zval(zval *z) zend_hash_persist(Z_ARRVAL_P(z), zend_persist_zval); /* make immutable array */ Z_TYPE_FLAGS_P(z) = IS_TYPE_COPYABLE; - GC_REFCOUNT(Z_COUNTED_P(z)) = 2; + GC_SET_REFCOUNT(Z_COUNTED_P(z), 2); GC_FLAGS(Z_COUNTED_P(z)) |= IS_ARRAY_IMMUTABLE; Z_ARRVAL_P(z)->u.flags |= HASH_FLAG_STATIC_KEYS; } @@ -325,7 +325,7 @@ static void zend_persist_zval(zval *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_REFCOUNTED | IS_TYPE_COPYABLE); - GC_REFCOUNT(Z_COUNTED_P(z)) = 2; + GC_SET_REFCOUNT(Z_COUNTED_P(z), 2); efree(old_ref); } break; @@ -370,7 +370,7 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc zend_hash_persist(op_array->static_variables, zend_persist_zval); zend_accel_store(op_array->static_variables, sizeof(HashTable)); /* make immutable array */ - GC_REFCOUNT(op_array->static_variables) = 2; + GC_SET_REFCOUNT(op_array->static_variables, 2); GC_TYPE_INFO(op_array->static_variables) = IS_ARRAY | (IS_ARRAY_IMMUTABLE << 8); op_array->static_variables->u.flags |= HASH_FLAG_STATIC_KEYS; } |
