diff options
Diffstat (limited to 'ext/opcache/ZendAccelerator.c')
-rw-r--r-- | ext/opcache/ZendAccelerator.c | 192 |
1 files changed, 0 insertions, 192 deletions
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index e6dc4ce684..7e375e8289 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -2250,192 +2250,6 @@ static void accel_activate(void) } } -#if !ZEND_DEBUG - -/* Fast Request Shutdown - * ===================== - * Zend Memory Manager frees memory by its own. We don't have to free each - * allocated block separately, but we like to call all the destructors and - * callbacks in exactly the same order. - */ -static void accel_fast_hash_destroy(HashTable *ht); - -static void accel_fast_zval_dtor(zval *zvalue) -{ -tail_call: - switch (Z_TYPE_P(zvalue)) { - case IS_ARRAY: - GC_REMOVE_FROM_BUFFER(Z_ARR_P(zvalue)); - if (Z_ARR_P(zvalue) != &EG(symbol_table)) { - /* break possible cycles */ - ZVAL_NULL(zvalue); - accel_fast_hash_destroy(Z_ARRVAL_P(zvalue)); - } - break; - case IS_OBJECT: - OBJ_RELEASE(Z_OBJ_P(zvalue)); - break; - case IS_RESOURCE: - zend_list_delete(Z_RES_P(zvalue)); - break; - case IS_REFERENCE: { - zend_reference *ref = Z_REF_P(zvalue); - - if (--GC_REFCOUNT(ref) == 0) { - if (Z_REFCOUNTED(ref->val) && Z_DELREF(ref->val) == 0) { - zvalue = &ref->val; - goto tail_call; - } - } - } - break; - } -} - -static void accel_fast_hash_destroy(HashTable *ht) -{ - Bucket *p = ht->arData; - Bucket *end = p + ht->nNumUsed; - - while (p != end) { - if (Z_REFCOUNTED(p->val) && Z_DELREF(p->val) == 0) { - accel_fast_zval_dtor(&p->val); - } - p++; - } -} - -static inline void zend_accel_fast_del_bucket(HashTable *ht, uint32_t idx, Bucket *p) -{ - uint32_t nIndex = p->h | ht->nTableMask; - uint32_t i = HT_HASH(ht, nIndex); - - ht->nNumOfElements--; - if (idx != i) { - Bucket *prev = HT_HASH_TO_BUCKET(ht, i); - while (Z_NEXT(prev->val) != idx) { - i = Z_NEXT(prev->val); - prev = HT_HASH_TO_BUCKET(ht, i); - } - Z_NEXT(prev->val) = Z_NEXT(p->val); - } else { - HT_HASH(ht, p->h | ht->nTableMask) = Z_NEXT(p->val); - } -} - -static void zend_accel_fast_shutdown(void) -{ - if (EG(full_tables_cleanup)) { - return; - } - - if (EG(objects_store).top > 1 || zend_hash_num_elements(&EG(regular_list)) > 0) { - /* We don't have to destroy all zvals if they cannot call any destructors */ - zend_try { - ZEND_HASH_REVERSE_FOREACH(&EG(symbol_table), 0) { - if (Z_REFCOUNTED(_p->val) && Z_DELREF(_p->val) == 0) { - accel_fast_zval_dtor(&_p->val); - } - zend_accel_fast_del_bucket(&EG(symbol_table), HT_IDX_TO_HASH(_idx-1), _p); - } ZEND_HASH_FOREACH_END(); - } zend_end_try(); - zend_hash_init(&EG(symbol_table), 8, NULL, NULL, 0); - - ZEND_HASH_REVERSE_FOREACH(EG(function_table), 0) { - zend_function *func = Z_PTR(_p->val); - - if (func->type == ZEND_INTERNAL_FUNCTION) { - break; - } else { - if (func->op_array.static_variables) { - if (!(GC_FLAGS(func->op_array.static_variables) & IS_ARRAY_IMMUTABLE)) { - if (--GC_REFCOUNT(func->op_array.static_variables) == 0) { - accel_fast_hash_destroy(func->op_array.static_variables); - } - } - } - zend_accel_fast_del_bucket(EG(function_table), HT_IDX_TO_HASH(_idx-1), _p); - } - } ZEND_HASH_FOREACH_END(); - - ZEND_HASH_REVERSE_FOREACH(EG(class_table), 0) { - zend_class_entry *ce = Z_PTR(_p->val); - - if (ce->type == ZEND_INTERNAL_CLASS) { - break; - } else { - if (ce->ce_flags & ZEND_HAS_STATIC_IN_METHODS) { - zend_function *func; - - ZEND_HASH_FOREACH_PTR(&ce->function_table, func) { - if (func->type == ZEND_USER_FUNCTION) { - if (func->op_array.static_variables) { - if (!(GC_FLAGS(func->op_array.static_variables) & IS_ARRAY_IMMUTABLE)) { - if (--GC_REFCOUNT(func->op_array.static_variables) == 0) { - accel_fast_hash_destroy(func->op_array.static_variables); - } - } - func->op_array.static_variables = NULL; - } - } - } ZEND_HASH_FOREACH_END(); - } - if (ce->static_members_table) { - int i; - - for (i = 0; i < ce->default_static_members_count; i++) { - zval *zv = &ce->static_members_table[i]; - ZVAL_UNDEF(&ce->static_members_table[i]); - if (Z_REFCOUNTED_P(zv) && Z_DELREF_P(zv) == 0) { - accel_fast_zval_dtor(zv); - } - } - ce->static_members_table = NULL; - } - zend_accel_fast_del_bucket(EG(class_table), HT_IDX_TO_HASH(_idx-1), _p); - } - } ZEND_HASH_FOREACH_END(); - - } else { - - zend_hash_init(&EG(symbol_table), 8, NULL, NULL, 0); - - ZEND_HASH_REVERSE_FOREACH(EG(function_table), 0) { - zend_function *func = Z_PTR(_p->val); - - if (func->type == ZEND_INTERNAL_FUNCTION) { - break; - } else { - zend_accel_fast_del_bucket(EG(function_table), HT_IDX_TO_HASH(_idx-1), _p); - } - } ZEND_HASH_FOREACH_END(); - - ZEND_HASH_REVERSE_FOREACH(EG(class_table), 0) { - zend_class_entry *ce = Z_PTR(_p->val); - - if (ce->type == ZEND_INTERNAL_CLASS) { - break; - } else { - zend_accel_fast_del_bucket(EG(class_table), HT_IDX_TO_HASH(_idx-1), _p); - } - } ZEND_HASH_FOREACH_END(); - } - - ZEND_HASH_REVERSE_FOREACH(EG(zend_constants), 0) { - zend_constant *c = Z_PTR(_p->val); - - if (c->flags & CONST_PERSISTENT) { - break; - } else { - zend_accel_fast_del_bucket(EG(zend_constants), HT_IDX_TO_HASH(_idx-1), _p); - } - } ZEND_HASH_FOREACH_END(); - EG(function_table)->nNumUsed = EG(function_table)->nNumOfElements; - EG(class_table)->nNumUsed = EG(class_table)->nNumOfElements; - EG(zend_constants)->nNumUsed = EG(zend_constants)->nNumOfElements; -} -#endif - int accel_post_deactivate(void) { if (!ZCG(enabled) || !accel_startup_ok) { @@ -2464,12 +2278,6 @@ static void accel_deactivate(void) if (!ZCG(enabled) || !accel_startup_ok) { return; } - -#if !ZEND_DEBUG - if (ZCG(accel_directives).fast_shutdown && is_zend_mm()) { - zend_accel_fast_shutdown(); - } -#endif } static int accelerator_remove_cb(zend_extension *element1, zend_extension *element2) |