Skip to content

Commit ae85ede

Browse files
committed
Fix test failures
1 parent 787ad83 commit ae85ede

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

Zend/zend_hash.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,10 +1169,7 @@ static void ZEND_FASTCALL zend_hash_do_resize(HashTable *ht)
11691169
zend_hash_rehash(ht);
11701170
} else if (EXPECTED(ht->nTableSize < HT_MAX_SIZE)) { /* Let's double the table size */
11711171
void *new_data, *old_data = HT_GET_DATA_ADDR(ht);
1172-
uint32_t nSize = ht->nTableSize + ht->nTableSize;
1173-
if (nSize < HT_MIN_SIZE_UNPACKED) {
1174-
nSize = HT_MIN_SIZE_UNPACKED;
1175-
}
1172+
uint32_t nSize = zend_hash_check_size(ht->nTableSize + ht->nTableSize);
11761173
Bucket *old_buckets = ht->arData;
11771174

11781175
ht->nTableSize = nSize;

Zend/zend_types.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ struct _zend_array {
331331
HT_HASH_EX((ht)->arData, idx)
332332

333333
#define HT_SIZE_TO_MASK(nTableSize) \
334-
(nTableSize <= 8 ? ((uint32_t)(-16)) : (uint32_t)(-((nTableSize) + (nTableSize))))
334+
(uint32_t)(-(zend_hash_check_size((nTableSize) + (nTableSize))))
335335
#define HT_HASH_SIZE(nTableMask) \
336336
(((size_t)(uint32_t)-(int32_t)(nTableMask)) * sizeof(uint32_t))
337337
#define HT_DATA_SIZE(nTableSize) \
@@ -348,7 +348,15 @@ struct _zend_array {
348348
size_t size = HT_HASH_SIZE((ht)->nTableMask); \
349349
__m128i xmm0 = _mm_setzero_si128(); \
350350
xmm0 = _mm_cmpeq_epi8(xmm0, xmm0); \
351-
ZEND_ASSERT(size >= 64 && ((size & 0x3f) == 0)); \
351+
if (size < 64) { \
352+
ZEND_ASSERT(size == 16 || size == 32); \
353+
_mm_storeu_si128((__m128i*)p, xmm0); \
354+
if (size >= 32) { \
355+
_mm_storeu_si128((__m128i*)(p+16), xmm0); \
356+
} \
357+
break; \
358+
} \
359+
ZEND_ASSERT(((size & 0x3f) == 0)); \
352360
do { \
353361
_mm_storeu_si128((__m128i*)p, xmm0); \
354362
_mm_storeu_si128((__m128i*)(p+16), xmm0); \

0 commit comments

Comments
 (0)