Skip to content

Commit 0b96cde

Browse files
committed
Remove zend_mm_copy_next_free_slot, rename zend_mm_check_next_free_slot
1 parent 5cbfa37 commit 0b96cde

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

Zend/zend_alloc.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,13 +1341,7 @@ static zend_always_inline void zend_mm_set_next_free_slot(zend_mm_heap *heap, ui
13411341
ZEND_MM_FREE_SLOT_PTR_SHADOW(slot, bin_num) = zend_mm_encode_free_slot(heap, next);
13421342
}
13431343

1344-
static zend_always_inline void zend_mm_copy_next_free_slot(zend_mm_free_slot* dest, uint32_t bin_num, zend_mm_free_slot* from)
1345-
{
1346-
dest->next_free_slot = from->next_free_slot;
1347-
ZEND_MM_FREE_SLOT_PTR_SHADOW(dest, bin_num) = ZEND_MM_FREE_SLOT_PTR_SHADOW(from, bin_num);
1348-
}
1349-
1350-
static zend_always_inline zend_mm_free_slot *zend_mm_check_next_free_slot(zend_mm_heap *heap, uint32_t bin_num, zend_mm_free_slot* slot)
1344+
static zend_always_inline zend_mm_free_slot *zend_mm_get_next_free_slot(zend_mm_heap *heap, uint32_t bin_num, zend_mm_free_slot* slot)
13511345
{
13521346
zend_mm_free_slot *next = slot->next_free_slot;
13531347
if (EXPECTED(next != NULL)) {
@@ -1428,7 +1422,7 @@ static zend_always_inline void *zend_mm_alloc_small(zend_mm_heap *heap, int bin_
14281422

14291423
if (EXPECTED(heap->free_slot[bin_num] != NULL)) {
14301424
zend_mm_free_slot *p = heap->free_slot[bin_num];
1431-
heap->free_slot[bin_num] = zend_mm_check_next_free_slot(heap, bin_num, p);
1425+
heap->free_slot[bin_num] = zend_mm_get_next_free_slot(heap, bin_num, p);
14321426
return p;
14331427
} else {
14341428
return zend_mm_alloc_small_slow(heap, bin_num ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
@@ -2135,7 +2129,7 @@ ZEND_API size_t zend_mm_gc(zend_mm_heap *heap)
21352129
has_free_pages = true;
21362130
}
21372131
chunk->map[page_num] = ZEND_MM_SRUN_EX(i, free_counter);
2138-
p = zend_mm_check_next_free_slot(heap, i, p);
2132+
p = zend_mm_get_next_free_slot(heap, i, p);
21392133
}
21402134

21412135
if (!has_free_pages) {
@@ -2161,18 +2155,18 @@ ZEND_API size_t zend_mm_gc(zend_mm_heap *heap)
21612155
ZEND_ASSERT(ZEND_MM_SRUN_BIN_NUM(info) == i);
21622156
if (ZEND_MM_SRUN_FREE_COUNTER(info) == bin_elements[i]) {
21632157
/* remove from cache */
2158+
p = zend_mm_get_next_free_slot(heap, i, p);
21642159
if (q == (zend_mm_free_slot*)&heap->free_slot[i]) {
2165-
q->next_free_slot = zend_mm_check_next_free_slot(heap, i, p);
2160+
q->next_free_slot = p;
21662161
} else {
2167-
zend_mm_copy_next_free_slot((zend_mm_free_slot*)q, i, p);
2162+
zend_mm_set_next_free_slot(heap, i, q, p);
21682163
}
2169-
p = zend_mm_check_next_free_slot(heap, i, p);
21702164
} else {
21712165
q = p;
21722166
if (q == (zend_mm_free_slot*)&heap->free_slot[i]) {
21732167
p = q->next_free_slot;
21742168
} else {
2175-
p = zend_mm_check_next_free_slot(heap, i, q);
2169+
p = zend_mm_get_next_free_slot(heap, i, q);
21762170
}
21772171
}
21782172
}

0 commit comments

Comments
 (0)