Lines Matching refs:list
346 ossl_ssize_t list = sh.freelist_size - 1; in sh_getlist() local
349 for (; bit; bit >>= 1, list--) { in sh_getlist()
355 return list; in sh_getlist()
359 static int sh_testbit(char *ptr, int list, unsigned char *table) in sh_testbit() argument
363 OPENSSL_assert(list >= 0 && list < sh.freelist_size); in sh_testbit()
364 OPENSSL_assert(((ptr - sh.arena) & ((sh.arena_size >> list) - 1)) == 0); in sh_testbit()
365 bit = (ONE << list) + ((ptr - sh.arena) / (sh.arena_size >> list)); in sh_testbit()
370 static void sh_clearbit(char *ptr, int list, unsigned char *table) in sh_clearbit() argument
374 OPENSSL_assert(list >= 0 && list < sh.freelist_size); in sh_clearbit()
375 OPENSSL_assert(((ptr - sh.arena) & ((sh.arena_size >> list) - 1)) == 0); in sh_clearbit()
376 bit = (ONE << list) + ((ptr - sh.arena) / (sh.arena_size >> list)); in sh_clearbit()
382 static void sh_setbit(char *ptr, int list, unsigned char *table) in sh_setbit() argument
386 OPENSSL_assert(list >= 0 && list < sh.freelist_size); in sh_setbit()
387 OPENSSL_assert(((ptr - sh.arena) & ((sh.arena_size >> list) - 1)) == 0); in sh_setbit()
388 bit = (ONE << list) + ((ptr - sh.arena) / (sh.arena_size >> list)); in sh_setbit()
394 static void sh_add_to_list(char **list, char *ptr) in sh_add_to_list() argument
398 OPENSSL_assert(WITHIN_FREELIST(list)); in sh_add_to_list()
402 temp->next = *(SH_LIST **)list; in sh_add_to_list()
404 temp->p_next = (SH_LIST **)list; in sh_add_to_list()
407 OPENSSL_assert((char **)temp->next->p_next == list); in sh_add_to_list()
411 *list = ptr; in sh_add_to_list()
618 static char *sh_find_my_buddy(char *ptr, int list) in sh_find_my_buddy() argument
623 bit = (ONE << list) + (ptr - sh.arena) / (sh.arena_size >> list); in sh_find_my_buddy()
627 chunk = sh.arena + ((bit & ((ONE << list) - 1)) * (sh.arena_size >> list)); in sh_find_my_buddy()
634 ossl_ssize_t list, slist; in sh_malloc() local
641 list = sh.freelist_size - 1; in sh_malloc()
643 list--; in sh_malloc()
644 if (list < 0) in sh_malloc()
648 for (slist = list; slist >= 0; slist--) in sh_malloc()
655 while (slist != list) { in sh_malloc()
684 chunk = sh.freelist[list]; in sh_malloc()
685 OPENSSL_assert(sh_testbit(chunk, list, sh.bittable)); in sh_malloc()
686 sh_setbit(chunk, list, sh.bitmalloc); in sh_malloc()
699 size_t list; in sh_free() local
708 list = sh_getlist(ptr); in sh_free()
709 OPENSSL_assert(sh_testbit(ptr, list, sh.bittable)); in sh_free()
710 sh_clearbit(ptr, list, sh.bitmalloc); in sh_free()
711 sh_add_to_list(&sh.freelist[list], ptr); in sh_free()
714 while ((buddy = sh_find_my_buddy(ptr, list)) != NULL) { in sh_free()
715 OPENSSL_assert(ptr == sh_find_my_buddy(buddy, list)); in sh_free()
717 OPENSSL_assert(!sh_testbit(ptr, list, sh.bitmalloc)); in sh_free()
718 sh_clearbit(ptr, list, sh.bittable); in sh_free()
720 OPENSSL_assert(!sh_testbit(ptr, list, sh.bitmalloc)); in sh_free()
721 sh_clearbit(buddy, list, sh.bittable); in sh_free()
724 list--; in sh_free()
731 OPENSSL_assert(!sh_testbit(ptr, list, sh.bitmalloc)); in sh_free()
732 sh_setbit(ptr, list, sh.bittable); in sh_free()
733 sh_add_to_list(&sh.freelist[list], ptr); in sh_free()
734 OPENSSL_assert(sh.freelist[list] == ptr); in sh_free()
740 int list; in sh_actual_size() local
745 list = sh_getlist(ptr); in sh_actual_size()
746 OPENSSL_assert(sh_testbit(ptr, list, sh.bittable)); in sh_actual_size()
747 return sh.arena_size / (ONE << list); in sh_actual_size()