Lines Matching refs:chunk
319 #define ZEND_MM_PAGE_ADDR(chunk, page_num) \ argument
320 ((void*)(((zend_mm_page*)(chunk)) + (page_num)))
813 static zend_always_inline void zend_mm_chunk_init(zend_mm_heap *heap, zend_mm_chunk *chunk) argument
815 chunk->heap = heap;
816 chunk->next = heap->main_chunk;
817 chunk->prev = heap->main_chunk->prev;
818 chunk->prev->next = chunk;
819 chunk->next->prev = chunk;
821 chunk->free_pages = ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE;
822 chunk->free_tail = ZEND_MM_FIRST_PAGE;
824 chunk->num = chunk->prev->num + 1;
826 chunk->free_map[0] = (1L << ZEND_MM_FIRST_PAGE) - 1;
827 chunk->map[0] = ZEND_MM_LRUN(ZEND_MM_FIRST_PAGE);
854 zend_mm_chunk *chunk = heap->main_chunk; local
859 if (UNEXPECTED(chunk->free_pages < pages_count)) {
862 } else if (UNEXPECTED(chunk->free_pages + chunk->free_tail == ZEND_MM_PAGES)) {
863 if (UNEXPECTED(ZEND_MM_PAGES - chunk->free_tail < pages_count)) {
866 page_num = chunk->free_tail;
871 int free_tail = chunk->free_tail;
872 zend_mm_bitset *bitset = chunk->free_map;
913 uint32_t free_tail = chunk->free_tail;
914 zend_mm_bitset *bitset = chunk->free_map;
942 chunk->free_tail = page_num + pages_count;
946 chunk->free_tail = page_num;
973 if (chunk->next == heap->main_chunk) {
977 chunk = heap->cached_chunks;
978 heap->cached_chunks = chunk->next;
994 chunk = (zend_mm_chunk*)zend_mm_chunk_alloc(heap, ZEND_MM_CHUNK_SIZE, ZEND_MM_CHUNK_SIZE);
995 if (UNEXPECTED(chunk == NULL)) {
998 …(chunk = (zend_mm_chunk*)zend_mm_chunk_alloc(heap, ZEND_MM_CHUNK_SIZE, ZEND_MM_CHUNK_SIZE)) != NUL…
1027 zend_mm_chunk_init(heap, chunk);
1032 chunk = chunk->next;
1040 chunk->prev->next = chunk->next;
1041 chunk->next->prev = chunk->prev;
1042 chunk->next = heap->main_chunk->next;
1043 chunk->prev = heap->main_chunk;
1044 chunk->prev->next = chunk;
1045 chunk->next->prev = chunk;
1048 chunk->free_pages -= pages_count;
1049 zend_mm_bitset_set_range(chunk->free_map, page_num, pages_count);
1050 chunk->map[page_num] = ZEND_MM_LRUN(pages_count);
1051 if (page_num == chunk->free_tail) {
1052 chunk->free_tail = page_num + pages_count;
1054 return ZEND_MM_PAGE_ADDR(chunk, page_num);
1076 static zend_always_inline void zend_mm_delete_chunk(zend_mm_heap *heap, zend_mm_chunk *chunk) argument
1078 chunk->next->prev = chunk->prev;
1079 chunk->prev->next = chunk->next;
1086 chunk->next = heap->cached_chunks;
1087 heap->cached_chunks = chunk;
1100 if (!heap->cached_chunks || chunk->num > heap->cached_chunks->num) {
1101 zend_mm_chunk_free(heap, chunk, ZEND_MM_CHUNK_SIZE);
1104 chunk->next = heap->cached_chunks->next;
1106 heap->cached_chunks = chunk;
1111 static zend_always_inline void zend_mm_free_pages_ex(zend_mm_heap *heap, zend_mm_chunk *chunk, uint… argument
1113 chunk->free_pages += pages_count;
1114 zend_mm_bitset_reset_range(chunk->free_map, page_num, pages_count);
1115 chunk->map[page_num] = 0;
1116 if (chunk->free_tail == page_num + pages_count) {
1118 chunk->free_tail = page_num;
1120 if (free_chunk && chunk->free_pages == ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE) {
1121 zend_mm_delete_chunk(heap, chunk);
1125 static void zend_mm_free_pages(zend_mm_heap *heap, zend_mm_chunk *chunk, int page_num, int pages_co… argument
1127 zend_mm_free_pages_ex(heap, chunk, page_num, pages_count, 1);
1130 static zend_always_inline void zend_mm_free_large(zend_mm_heap *heap, zend_mm_chunk *chunk, int pag… argument
1135 zend_mm_free_pages(heap, chunk, page_num, pages_count);
1206 zend_mm_chunk *chunk; local
1221 chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(bin, ZEND_MM_CHUNK_SIZE);
1223 chunk->map[page_num] = ZEND_MM_SRUN(bin_num);
1228 chunk->map[page_num+i] = ZEND_MM_NRUN(bin_num, i);
1308 zend_mm_chunk *chunk; local
1313 chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE);
1315 info = chunk->map[page_num];
1316 ZEND_MM_CHECK(chunk->heap == heap, "zend_mm_heap corrupted");
1382 zend_mm_chunk *chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE); local
1384 zend_mm_page_info info = chunk->map[page_num];
1386 ZEND_MM_CHECK(chunk->heap == heap, "zend_mm_heap corrupted");
1393 zend_mm_free_large(heap, chunk, page_num, pages_count);
1405 zend_mm_chunk *chunk; local
1413 chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE);
1415 info = chunk->map[page_num];
1416 ZEND_MM_CHECK(chunk->heap == heap, "zend_mm_heap corrupted");
1518 zend_mm_chunk *chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE); local
1520 zend_mm_page_info info = chunk->map[page_num];
1527 ZEND_MM_CHECK(chunk->heap == heap, "zend_mm_heap corrupted");
1568 chunk->map[page_num] = ZEND_MM_LRUN(new_pages_count);
1569 chunk->free_pages += rest_pages_count;
1570 zend_mm_bitset_reset_range(chunk->free_map, page_num + new_pages_count, rest_pages_count);
1586 …zend_mm_bitset_is_free_range(chunk->free_map, page_num + old_pages_count, new_pages_count - old_pa…
1595 chunk->free_pages -= new_pages_count - old_pages_count;
1596 …zend_mm_bitset_set_range(chunk->free_map, page_num + old_pages_count, new_pages_count - old_pages_…
1597 chunk->map[page_num] = ZEND_MM_LRUN(new_pages_count);
1806 …zend_mm_chunk *chunk = (zend_mm_chunk*)zend_mm_chunk_alloc_int(ZEND_MM_CHUNK_SIZE, ZEND_MM_CHUNK_S… local
1809 if (UNEXPECTED(chunk == NULL)) {
1819 heap = &chunk->heap_slot;
1820 chunk->heap = heap;
1821 chunk->next = chunk;
1822 chunk->prev = chunk;
1823 chunk->free_pages = ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE;
1824 chunk->free_tail = ZEND_MM_FIRST_PAGE;
1825 chunk->num = 0;
1826 chunk->free_map[0] = (Z_L(1) << ZEND_MM_FIRST_PAGE) - 1;
1827 chunk->map[0] = ZEND_MM_LRUN(ZEND_MM_FIRST_PAGE);
1828 heap->main_chunk = chunk;
1861 zend_mm_chunk *chunk; local
1879 chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(p, ZEND_MM_CHUNK_SIZE);
1880 ZEND_MM_CHECK(chunk->heap == heap, "zend_mm_heap corrupted");
1884 info = chunk->map[page_num];
1888 info = chunk->map[page_num];
1897 chunk->map[page_num] = ZEND_MM_SRUN_EX(i, free_counter);;
1908 chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(p, ZEND_MM_CHUNK_SIZE);
1909 ZEND_MM_CHECK(chunk->heap == heap, "zend_mm_heap corrupted");
1913 info = chunk->map[page_num];
1917 info = chunk->map[page_num];
1933 chunk = heap->main_chunk;
1936 while (i < chunk->free_tail) {
1937 if (zend_mm_bitset_is_set(chunk->free_map, i)) {
1938 info = chunk->map[i];
1945 zend_mm_free_pages_ex(heap, chunk, i, pages_count, 0);
1949 chunk->map[i] = ZEND_MM_SRUN(bin_num);
1959 if (chunk->free_pages == ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE) {
1960 zend_mm_chunk *next_chunk = chunk->next;
1962 zend_mm_delete_chunk(heap, chunk);
1963 chunk = next_chunk;
1965 chunk = chunk->next;
1967 } while (chunk != heap->main_chunk);
2374 zend_mm_chunk *chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE); \
2376 ZEND_MM_CHECK(chunk->heap == AG(mm_heap), "zend_mm_heap corrupted"); \
2377 ZEND_ASSERT(chunk->map[page_num] & ZEND_MM_IS_SRUN); \
2378 ZEND_ASSERT(ZEND_MM_SRUN_BIN_NUM(chunk->map[page_num]) == _num); \
2387 zend_mm_chunk *chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE); \
2388 ZEND_MM_CHECK(chunk->heap == AG(mm_heap), "zend_mm_heap corrupted"); \
2402 zend_mm_chunk *chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE); local
2406 …ZEND_MM_CHECK(chunk->heap == AG(mm_heap) && ZEND_MM_ALIGNED_OFFSET(page_offset, ZEND_MM_PAGE_SIZE)…
2407 ZEND_ASSERT(chunk->map[page_num] & ZEND_MM_IS_LRUN);
2408 ZEND_ASSERT(ZEND_MM_LRUN_PAGES(chunk->map[page_num]) == pages_count);
2409 zend_mm_free_large(AG(mm_heap), chunk, page_num, pages_count);
2755 zend_mm_chunk *chunk; local
2760 …chunk = (zend_mm_chunk*)handlers->chunk_alloc(&tmp_storage, ZEND_MM_CHUNK_SIZE, ZEND_MM_CHUNK_SIZE…
2761 if (UNEXPECTED(chunk == NULL)) {
2771 heap = &chunk->heap_slot;
2772 chunk->heap = heap;
2773 chunk->next = chunk;
2774 chunk->prev = chunk;
2775 chunk->free_pages = ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE;
2776 chunk->free_tail = ZEND_MM_FIRST_PAGE;
2777 chunk->num = 0;
2778 chunk->free_map[0] = (Z_L(1) << ZEND_MM_FIRST_PAGE) - 1;
2779 chunk->map[0] = ZEND_MM_LRUN(ZEND_MM_FIRST_PAGE);
2780 heap->main_chunk = chunk;
2808 handlers->chunk_free(&tmp_storage, chunk, ZEND_MM_CHUNK_SIZE);