Lines Matching refs:chunk

317 #define ZEND_MM_PAGE_ADDR(chunk, page_num) \  argument
318 ((void*)(((zend_mm_page*)(chunk)) + (page_num)))
815 static zend_always_inline void zend_mm_chunk_init(zend_mm_heap *heap, zend_mm_chunk *chunk) argument
817 chunk->heap = heap;
818 chunk->next = heap->main_chunk;
819 chunk->prev = heap->main_chunk->prev;
820 chunk->prev->next = chunk;
821 chunk->next->prev = chunk;
823 chunk->free_pages = ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE;
824 chunk->free_tail = ZEND_MM_FIRST_PAGE;
826 chunk->num = chunk->prev->num + 1;
828 chunk->free_map[0] = (1L << ZEND_MM_FIRST_PAGE) - 1;
829 chunk->map[0] = ZEND_MM_LRUN(ZEND_MM_FIRST_PAGE);
856 zend_mm_chunk *chunk = heap->main_chunk; local
861 if (UNEXPECTED(chunk->free_pages < pages_count)) {
864 } else if (UNEXPECTED(chunk->free_pages + chunk->free_tail == ZEND_MM_PAGES)) {
865 if (UNEXPECTED(ZEND_MM_PAGES - chunk->free_tail < pages_count)) {
868 page_num = chunk->free_tail;
873 int free_tail = chunk->free_tail;
874 zend_mm_bitset *bitset = chunk->free_map;
915 uint32_t free_tail = chunk->free_tail;
916 zend_mm_bitset *bitset = chunk->free_map;
944 chunk->free_tail = page_num + pages_count;
948 chunk->free_tail = page_num;
975 if (chunk->next == heap->main_chunk) {
979 chunk = heap->cached_chunks;
980 heap->cached_chunks = chunk->next;
996 chunk = (zend_mm_chunk*)zend_mm_chunk_alloc(heap, ZEND_MM_CHUNK_SIZE, ZEND_MM_CHUNK_SIZE);
997 if (UNEXPECTED(chunk == NULL)) {
1000 …(chunk = (zend_mm_chunk*)zend_mm_chunk_alloc(heap, ZEND_MM_CHUNK_SIZE, ZEND_MM_CHUNK_SIZE)) != NUL…
1029 zend_mm_chunk_init(heap, chunk);
1034 chunk = chunk->next;
1042 chunk->prev->next = chunk->next;
1043 chunk->next->prev = chunk->prev;
1044 chunk->next = heap->main_chunk->next;
1045 chunk->prev = heap->main_chunk;
1046 chunk->prev->next = chunk;
1047 chunk->next->prev = chunk;
1050 chunk->free_pages -= pages_count;
1051 zend_mm_bitset_set_range(chunk->free_map, page_num, pages_count);
1052 chunk->map[page_num] = ZEND_MM_LRUN(pages_count);
1053 if (page_num == chunk->free_tail) {
1054 chunk->free_tail = page_num + pages_count;
1056 return ZEND_MM_PAGE_ADDR(chunk, page_num);
1078 static zend_always_inline void zend_mm_delete_chunk(zend_mm_heap *heap, zend_mm_chunk *chunk) argument
1080 chunk->next->prev = chunk->prev;
1081 chunk->prev->next = chunk->next;
1088 chunk->next = heap->cached_chunks;
1089 heap->cached_chunks = chunk;
1102 if (!heap->cached_chunks || chunk->num > heap->cached_chunks->num) {
1103 zend_mm_chunk_free(heap, chunk, ZEND_MM_CHUNK_SIZE);
1106 chunk->next = heap->cached_chunks->next;
1108 heap->cached_chunks = chunk;
1113 static zend_always_inline void zend_mm_free_pages_ex(zend_mm_heap *heap, zend_mm_chunk *chunk, uint… argument
1115 chunk->free_pages += pages_count;
1116 zend_mm_bitset_reset_range(chunk->free_map, page_num, pages_count);
1117 chunk->map[page_num] = 0;
1118 if (chunk->free_tail == page_num + pages_count) {
1120 chunk->free_tail = page_num;
1122 if (free_chunk && chunk->free_pages == ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE) {
1123 zend_mm_delete_chunk(heap, chunk);
1127 static void zend_mm_free_pages(zend_mm_heap *heap, zend_mm_chunk *chunk, int page_num, int pages_co… argument
1129 zend_mm_free_pages_ex(heap, chunk, page_num, pages_count, 1);
1132 static zend_always_inline void zend_mm_free_large(zend_mm_heap *heap, zend_mm_chunk *chunk, int pag… argument
1137 zend_mm_free_pages(heap, chunk, page_num, pages_count);
1208 zend_mm_chunk *chunk; local
1223 chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(bin, ZEND_MM_CHUNK_SIZE);
1225 chunk->map[page_num] = ZEND_MM_SRUN(bin_num);
1230 chunk->map[page_num+i] = ZEND_MM_NRUN(bin_num, i);
1310 zend_mm_chunk *chunk; local
1315 chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE);
1317 info = chunk->map[page_num];
1318 ZEND_MM_CHECK(chunk->heap == heap, "zend_mm_heap corrupted");
1384 zend_mm_chunk *chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE); local
1386 zend_mm_page_info info = chunk->map[page_num];
1388 ZEND_MM_CHECK(chunk->heap == heap, "zend_mm_heap corrupted");
1395 zend_mm_free_large(heap, chunk, page_num, pages_count);
1407 zend_mm_chunk *chunk; local
1415 chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE);
1417 info = chunk->map[page_num];
1418 ZEND_MM_CHECK(chunk->heap == heap, "zend_mm_heap corrupted");
1520 zend_mm_chunk *chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE); local
1522 zend_mm_page_info info = chunk->map[page_num];
1529 ZEND_MM_CHECK(chunk->heap == heap, "zend_mm_heap corrupted");
1570 chunk->map[page_num] = ZEND_MM_LRUN(new_pages_count);
1571 chunk->free_pages += rest_pages_count;
1572 zend_mm_bitset_reset_range(chunk->free_map, page_num + new_pages_count, rest_pages_count);
1588 …zend_mm_bitset_is_free_range(chunk->free_map, page_num + old_pages_count, new_pages_count - old_pa…
1597 chunk->free_pages -= new_pages_count - old_pages_count;
1598 …zend_mm_bitset_set_range(chunk->free_map, page_num + old_pages_count, new_pages_count - old_pages_…
1599 chunk->map[page_num] = ZEND_MM_LRUN(new_pages_count);
1813 …zend_mm_chunk *chunk = (zend_mm_chunk*)zend_mm_chunk_alloc_int(ZEND_MM_CHUNK_SIZE, ZEND_MM_CHUNK_S… local
1816 if (UNEXPECTED(chunk == NULL)) {
1826 heap = &chunk->heap_slot;
1827 chunk->heap = heap;
1828 chunk->next = chunk;
1829 chunk->prev = chunk;
1830 chunk->free_pages = ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE;
1831 chunk->free_tail = ZEND_MM_FIRST_PAGE;
1832 chunk->num = 0;
1833 chunk->free_map[0] = (Z_L(1) << ZEND_MM_FIRST_PAGE) - 1;
1834 chunk->map[0] = ZEND_MM_LRUN(ZEND_MM_FIRST_PAGE);
1835 heap->main_chunk = chunk;
1868 zend_mm_chunk *chunk; local
1886 chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(p, ZEND_MM_CHUNK_SIZE);
1887 ZEND_MM_CHECK(chunk->heap == heap, "zend_mm_heap corrupted");
1891 info = chunk->map[page_num];
1895 info = chunk->map[page_num];
1904 chunk->map[page_num] = ZEND_MM_SRUN_EX(i, free_counter);
1915 chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(p, ZEND_MM_CHUNK_SIZE);
1916 ZEND_MM_CHECK(chunk->heap == heap, "zend_mm_heap corrupted");
1920 info = chunk->map[page_num];
1924 info = chunk->map[page_num];
1940 chunk = heap->main_chunk;
1943 while (i < chunk->free_tail) {
1944 if (zend_mm_bitset_is_set(chunk->free_map, i)) {
1945 info = chunk->map[i];
1952 zend_mm_free_pages_ex(heap, chunk, i, pages_count, 0);
1956 chunk->map[i] = ZEND_MM_SRUN(bin_num);
1966 if (chunk->free_pages == ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE) {
1967 zend_mm_chunk *next_chunk = chunk->next;
1969 zend_mm_delete_chunk(heap, chunk);
1970 chunk = next_chunk;
1972 chunk = chunk->next;
1974 } while (chunk != heap->main_chunk);
2381 zend_mm_chunk *chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE); \
2383 ZEND_MM_CHECK(chunk->heap == AG(mm_heap), "zend_mm_heap corrupted"); \
2384 ZEND_ASSERT(chunk->map[page_num] & ZEND_MM_IS_SRUN); \
2385 ZEND_ASSERT(ZEND_MM_SRUN_BIN_NUM(chunk->map[page_num]) == _num); \
2394 zend_mm_chunk *chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE); \
2395 ZEND_MM_CHECK(chunk->heap == AG(mm_heap), "zend_mm_heap corrupted"); \
2409 zend_mm_chunk *chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE); local
2413 …ZEND_MM_CHECK(chunk->heap == AG(mm_heap) && ZEND_MM_ALIGNED_OFFSET(page_offset, ZEND_MM_PAGE_SIZE)…
2414 ZEND_ASSERT(chunk->map[page_num] & ZEND_MM_IS_LRUN);
2415 ZEND_ASSERT(ZEND_MM_LRUN_PAGES(chunk->map[page_num]) == pages_count);
2416 zend_mm_free_large(AG(mm_heap), chunk, page_num, pages_count);
2752 zend_mm_chunk *chunk; local
2757chunk = (zend_mm_chunk*)handlers->chunk_alloc(&tmp_storage, ZEND_MM_CHUNK_SIZE, ZEND_MM_CHUNK_SIZE…
2758 if (UNEXPECTED(chunk == NULL)) {
2768 heap = &chunk->heap_slot;
2769 chunk->heap = heap;
2770 chunk->next = chunk;
2771 chunk->prev = chunk;
2772 chunk->free_pages = ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE;
2773 chunk->free_tail = ZEND_MM_FIRST_PAGE;
2774 chunk->num = 0;
2775 chunk->free_map[0] = (Z_L(1) << ZEND_MM_FIRST_PAGE) - 1;
2776 chunk->map[0] = ZEND_MM_LRUN(ZEND_MM_FIRST_PAGE);
2777 heap->main_chunk = chunk;
2805 handlers->chunk_free(&tmp_storage, chunk, ZEND_MM_CHUNK_SIZE);