com php-src: Remove HashTable holes in functions and class tables.: ext/opcache/zend_accelerator_util_funcs.c ext/opcache /zend_persist_calc.c

From: Date: Wed, 10 Jan 2018 07:15:55 +0000
Subject: com php-src: Remove HashTable holes in functions and class tables.: ext/opcache/zend_accelerator_util_funcs.c ext/opcache /zend_persist_calc.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-100824@lists.php.net to get a copy of this message
Commit: d89c8dd8b8a680815e677294328c8081a862d485 Author: Dmitry Stogov <dmitry@zend.com> Wed, 10 Jan 2018 10:15:55 +0300 Parents: 94508cdc3f95e50a3fe7d9d17db7d776fe550c04 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d89c8dd8b8a680815e677294328c8081a862d485 Log: Remove HashTable holes in functions and class tables. Changed paths: M ext/opcache/zend_accelerator_util_funcs.c M ext/opcache/zend_persist_calc.c Diff: diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c index b0db208..ce0c8f4 100644 --- a/ext/opcache/zend_accelerator_util_funcs.c +++ b/ext/opcache/zend_accelerator_util_funcs.c @@ -195,7 +195,7 @@ static void zend_hash_clone_constants(HashTable *ht, HashTable *source) p = source->arData; end = p + source->nNumUsed; for (; p != end; p++) { - if (UNEXPECTED(Z_TYPE(p->val) == IS_UNDEF)) continue; + ZEND_ASSERT(Z_TYPE(p->val) != IS_UNDEF); nIndex = p->h | ht->nTableMask; /* Insert into hash collision list */ @@ -246,7 +246,7 @@ static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class p = source->arData; end = p + source->nNumUsed; for (; p != end; p++) { - if (UNEXPECTED(Z_TYPE(p->val) == IS_UNDEF)) continue; + ZEND_ASSERT(Z_TYPE(p->val) != IS_UNDEF); nIndex = p->h | ht->nTableMask; @@ -304,7 +304,7 @@ static void zend_hash_clone_prop_info(HashTable *ht, HashTable *source, zend_cla p = source->arData; end = p + source->nNumUsed; for (; p != end; p++) { - if (UNEXPECTED(Z_TYPE(p->val) == IS_UNDEF)) continue; + ZEND_ASSERT(Z_TYPE(p->val) != IS_UNDEF); nIndex = p->h | ht->nTableMask; @@ -478,7 +478,7 @@ static void zend_accel_function_hash_copy(HashTable *target, HashTable *source) p = source->arData; end = p + source->nNumUsed; for (; p != end; p++) { - if (UNEXPECTED(Z_TYPE(p->val) == IS_UNDEF)) continue; + ZEND_ASSERT(Z_TYPE(p->val) != IS_UNDEF); ZEND_ASSERT(p->key); t = zend_hash_find_ex(target, p->key, 1); if (UNEXPECTED(t != NULL)) { @@ -522,7 +522,7 @@ static void zend_accel_function_hash_copy_from_shm(HashTable *target, HashTable p = source->arData; end = p + source->nNumUsed; for (; p != end; p++) { - if (UNEXPECTED(Z_TYPE(p->val) == IS_UNDEF)) continue; + ZEND_ASSERT(Z_TYPE(p->val) != IS_UNDEF); ZEND_ASSERT(p->key); t = zend_hash_find_ex(target, p->key, 1); if (UNEXPECTED(t != NULL)) { @@ -565,7 +565,7 @@ static void zend_accel_class_hash_copy(HashTable *target, HashTable *source, uni p = source->arData; end = p + source->nNumUsed; for (; p != end; p++) { - if (UNEXPECTED(Z_TYPE(p->val) == IS_UNDEF)) continue; + ZEND_ASSERT(Z_TYPE(p->val) != IS_UNDEF); ZEND_ASSERT(p->key); t = zend_hash_find_ex(target, p->key, 1); if (UNEXPECTED(t != NULL)) { diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c index 02e5978..abf17b7 100644 --- a/ext/opcache/zend_persist_calc.c +++ b/ext/opcache/zend_persist_calc.c @@ -419,7 +419,13 @@ uint32_t zend_accel_script_persist_calc(zend_persistent_script *new_persistent_s new_persistent_script->size = (new_persistent_script->size + 63) & ~63; #endif + if (new_persistent_script->script.class_table.nNumUsed != new_persistent_script->script.class_table.nNumOfElements) { + zend_hash_rehash(&new_persistent_script->script.class_table); + } zend_accel_persist_class_table_calc(&new_persistent_script->script.class_table); + if (new_persistent_script->script.function_table.nNumUsed != new_persistent_script->script.function_table.nNumOfElements) { + zend_hash_rehash(&new_persistent_script->script.function_table); + } zend_hash_persist_calc(&new_persistent_script->script.function_table, zend_persist_op_array_calc); zend_persist_op_array_calc_ex(&new_persistent_script->script.main_op_array);

« previous php.cvs (#100824) next »