diff options
author | Dmitry Stogov <dmitry@zend.com> | 2018-01-10 10:15:55 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2018-01-10 10:15:55 +0300 |
commit | d89c8dd8b8a680815e677294328c8081a862d485 (patch) | |
tree | 067d6eb88e8443d87026f15251cb7f45972d9697 | |
parent | 94508cdc3f95e50a3fe7d9d17db7d776fe550c04 (diff) | |
download | php-git-d89c8dd8b8a680815e677294328c8081a862d485.tar.gz |
Remove HashTable holes in functions and class tables.
-rw-r--r-- | ext/opcache/zend_accelerator_util_funcs.c | 12 | ||||
-rw-r--r-- | ext/opcache/zend_persist_calc.c | 6 |
2 files changed, 12 insertions, 6 deletions
diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c index b0db2085f9..ce0c8f4ada 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 02e5978fb2..abf17b7e91 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); |