diff options
author | Dmitry Stogov <dmitry@zend.com> | 2015-02-20 14:59:30 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2015-02-20 14:59:30 +0300 |
commit | 5f76eed14e7981a5e4361364dd0fdd2bf9d531a8 (patch) | |
tree | be7c826d5b28f65f77500c5027e3d68653891f18 /ext/opcache | |
parent | 04836f0e55f7155ce00abfb4a295fd981df9f81e (diff) | |
download | php-git-5f76eed14e7981a5e4361364dd0fdd2bf9d531a8.tar.gz |
don't count op_arrays stored in opcache SHM
Diffstat (limited to 'ext/opcache')
-rw-r--r-- | ext/opcache/zend_accelerator_util_funcs.c | 18 | ||||
-rw-r--r-- | ext/opcache/zend_persist.c | 2 |
2 files changed, 2 insertions, 18 deletions
diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c index f3c6824667..afe3c4e421 100644 --- a/ext/opcache/zend_accelerator_util_funcs.c +++ b/ext/opcache/zend_accelerator_util_funcs.c @@ -25,10 +25,6 @@ #include "zend_persist.h" #include "zend_shared_alloc.h" -#define ZEND_PROTECTED_REFCOUNT (1<<30) - -static uint32_t zend_accel_refcount = ZEND_PROTECTED_REFCOUNT; - #if SIZEOF_SIZE_T <= SIZEOF_ZEND_LONG /* If sizeof(void*) == sizeof(ulong) we can use zend_hash index functions */ # define accel_xlat_set(old, new) zend_hash_index_update_ptr(&ZCG(bind_hash), (zend_ulong)(zend_uintptr_t)(old), (new)) @@ -369,14 +365,6 @@ static void zend_hash_clone_zval(HashTable *ht, HashTable *source, int bind) } } -/* protects reference count, creates copy of statics */ -static zend_always_inline void zend_prepare_function_for_execution(zend_op_array *op_array) -{ - /* protect reference count */ - op_array->refcount = &zend_accel_refcount; - (*op_array->refcount) = ZEND_PROTECTED_REFCOUNT; -} - static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class_entry *old_ce, zend_class_entry *ce) { uint idx; @@ -429,10 +417,9 @@ static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class /* we use refcount to show that op_array is referenced from several places */ if (new_entry->refcount != NULL) { accel_xlat_set(Z_PTR(p->val), new_entry); + new_entry->refcount = NULL; } - zend_prepare_function_for_execution(new_entry); - if (old_ce == new_entry->scope) { new_entry->scope = ce; } else { @@ -765,7 +752,6 @@ static void zend_accel_function_hash_copy_from_shm(HashTable *target, HashTable } } Z_PTR_P(t) = ARENA_REALLOC(Z_PTR(p->val)); - zend_prepare_function_for_execution((zend_op_array*)Z_PTR_P(t)); } target->nInternalPointer = target->nNumOfElements ? 0 : INVALID_IDX; return; @@ -850,8 +836,6 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script, zend_accel_function_hash_copy_from_shm(CG(function_table), &persistent_script->function_table); } - zend_prepare_function_for_execution(op_array); - /* Register __COMPILER_HALT_OFFSET__ constant */ if (persistent_script->compiler_halt_offset != 0 && persistent_script->full_path) { diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index 634dbda4f5..5fb5ab2d36 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -297,7 +297,7 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc return; } - if (--(*op_array->refcount) == 0) { + if (op_array->refcount && --(*op_array->refcount) == 0) { efree(op_array->refcount); } op_array->refcount = NULL; |