Lines Matching refs:map

101 	struct ck_ht_map *map = table->map;  in ck_ht_stat()  local
103 st->n_entries = map->n_entries; in ck_ht_stat()
104 st->probe_maximum = map->probe_maximum; in ck_ht_stat()
143 struct ck_ht_map *map; in ck_ht_map_create() local
162 map = table->m->malloc(size); in ck_ht_map_create()
163 if (map == NULL) in ck_ht_map_create()
166 map->mode = table->mode; in ck_ht_map_create()
167 map->size = size; in ck_ht_map_create()
168 map->probe_limit = ck_internal_max_64(n_entries >> in ck_ht_map_create()
171 map->deletions = 0; in ck_ht_map_create()
172 map->probe_maximum = 0; in ck_ht_map_create()
173 map->capacity = n_entries; in ck_ht_map_create()
174 map->step = ck_cc_ffsll(map->capacity); in ck_ht_map_create()
175 map->mask = map->capacity - 1; in ck_ht_map_create()
176 map->n_entries = 0; in ck_ht_map_create()
177 map->entries = (struct ck_ht_entry *)(((uintptr_t)&map[1] + prefix + in ck_ht_map_create()
181 map->probe_bound = (CK_HT_WORD *)&map[1]; in ck_ht_map_create()
182 memset(map->probe_bound, 0, prefix); in ck_ht_map_create()
184 map->probe_bound = NULL; in ck_ht_map_create()
187 memset(map->entries, 0, sizeof(struct ck_ht_entry) * n_entries); in ck_ht_map_create()
189 return map; in ck_ht_map_create()
231 ck_ht_map_destroy(struct ck_malloc *m, struct ck_ht_map *map, bool defer) in ck_ht_map_destroy() argument
234 m->free(map, map->size, defer); in ck_ht_map_destroy()
239 ck_ht_map_probe_next(struct ck_ht_map *map, size_t offset, ck_ht_hash_t h, size_t probes) in ck_ht_map_probe_next() argument
245 r.value = (h.value >> map->step) >> level; in ck_ht_map_probe_next()
250 (stride | CK_HT_BUCKET_LENGTH)) & map->mask; in ck_ht_map_probe_next()
275 table->map = ck_ht_map_create(table, entries); in ck_ht_init()
276 return table->map != NULL; in ck_ht_init()
280 ck_ht_map_probe_wr(struct ck_ht_map *map, in ck_ht_map_probe_wr() argument
296 limit = ck_ht_map_bound_get(map, h); in ck_ht_map_probe_wr()
301 offset = h.value & map->mask; in ck_ht_map_probe_wr()
302 for (i = 0; i < map->probe_limit; i++) { in ck_ht_map_probe_wr()
308 bucket = (void *)((uintptr_t)(map->entries + offset) & in ck_ht_map_probe_wr()
339 if (map->mode & CK_HT_MODE_BYTESTRING) { in ck_ht_map_probe_wr()
364 offset = ck_ht_map_probe_next(map, offset, h, probes); in ck_ht_map_probe_wr()
389 struct ck_ht_map *map = ht->map; in ck_ht_gc() local
393 if (map->n_entries == 0) { in ck_ht_gc()
394 CK_HT_TYPE_STORE(&map->probe_maximum, 0); in ck_ht_gc()
395 if (map->probe_bound != NULL) in ck_ht_gc()
396 memset(map->probe_bound, 0, sizeof(CK_HT_WORD) * map->capacity); in ck_ht_gc()
404 if (map->probe_bound != NULL) { in ck_ht_gc()
405 size = sizeof(CK_HT_WORD) * map->capacity; in ck_ht_gc()
413 maximum = map->probe_maximum; in ck_ht_gc()
416 for (i = 0; i < map->capacity; i++) { in ck_ht_gc()
422 entry = &map->entries[(i + seed) & map->mask]; in ck_ht_gc()
435 entry = ck_ht_map_probe_wr(map, h, &snapshot, &priority, in ck_ht_gc()
445 entry = ck_ht_map_probe_wr(map, h, &snapshot, &priority, in ck_ht_gc()
451 offset = h.value & map->mask; in ck_ht_gc()
454 CK_HT_TYPE_STORE(&map->deletions, map->deletions + 1); in ck_ht_gc()
464 CK_HT_TYPE_STORE(&map->deletions, map->deletions + 1); in ck_ht_gc()
483 if (maximum != map->probe_maximum) in ck_ht_gc()
484 CK_HT_TYPE_STORE(&map->probe_maximum, maximum); in ck_ht_gc()
487 for (i = 0; i < map->capacity; i++) in ck_ht_gc()
488 CK_HT_STORE(&map->probe_bound[i], bounds[i]); in ck_ht_gc()
497 ck_ht_map_probe_rd(struct ck_ht_map *map, in ck_ht_map_probe_rd() argument
514 probe_maximum = ck_ht_map_bound_get(map, h); in ck_ht_map_probe_rd()
515 offset = h.value & map->mask; in ck_ht_map_probe_rd()
517 for (i = 0; i < map->probe_limit; i++) { in ck_ht_map_probe_rd()
523 bucket = (void *)((uintptr_t)(map->entries + offset) & in ck_ht_map_probe_rd()
539 d = CK_HT_TYPE_LOAD(&map->deletions); in ck_ht_map_probe_rd()
561 if (map->mode & CK_HT_MODE_BYTESTRING) { in ck_ht_map_probe_rd()
578 d_prime = CK_HT_TYPE_LOAD(&map->deletions); in ck_ht_map_probe_rd()
594 offset = ck_ht_map_probe_next(map, offset, h, probes); in ck_ht_map_probe_rd()
606 struct ck_ht_map *map = ck_pr_load_ptr(&table->map); in ck_ht_count() local
608 return CK_HT_TYPE_LOAD(&map->n_entries); in ck_ht_count()
616 struct ck_ht_map *map = table->map; in ck_ht_next() local
619 if (i->offset >= map->capacity) in ck_ht_next()
623 key = map->entries[i->offset].key; in ck_ht_next()
626 } while (++i->offset < map->capacity); in ck_ht_next()
628 if (i->offset >= map->capacity) in ck_ht_next()
631 *entry = map->entries + i->offset++; in ck_ht_next()
638 struct ck_ht_map *map, *update; in ck_ht_reset_size_spmc() local
640 map = table->map; in ck_ht_reset_size_spmc()
645 ck_pr_store_ptr_unsafe(&table->map, update); in ck_ht_reset_size_spmc()
646 ck_ht_map_destroy(table->m, map, true); in ck_ht_reset_size_spmc()
653 struct ck_ht_map *map = table->map; in ck_ht_reset_spmc() local
655 return ck_ht_reset_size_spmc(table, map->capacity); in ck_ht_reset_spmc()
661 struct ck_ht_map *map, *update; in ck_ht_grow_spmc() local
668 map = table->map; in ck_ht_grow_spmc()
670 if (map->capacity >= capacity) in ck_ht_grow_spmc()
677 for (k = 0; k < map->capacity; k++) { in ck_ht_grow_spmc()
678 previous = &map->entries[k]; in ck_ht_grow_spmc()
741 ck_pr_store_ptr_unsafe(&table->map, update); in ck_ht_grow_spmc()
742 ck_ht_map_destroy(table->m, map, true); in ck_ht_grow_spmc()
751 struct ck_ht_map *map; in ck_ht_remove_spmc() local
754 map = table->map; in ck_ht_remove_spmc()
757 candidate = ck_ht_map_probe_rd(map, h, &snapshot, in ck_ht_remove_spmc()
761 candidate = ck_ht_map_probe_rd(map, h, &snapshot, in ck_ht_remove_spmc()
774 CK_HT_TYPE_STORE(&map->n_entries, map->n_entries - 1); in ck_ht_remove_spmc()
784 struct ck_ht_map *map; in ck_ht_get_spmc() local
788 map = ck_pr_load_ptr(&table->map); in ck_ht_get_spmc()
794 d = CK_HT_TYPE_LOAD(&map->deletions); in ck_ht_get_spmc()
797 candidate = ck_ht_map_probe_rd(map, h, &snapshot, in ck_ht_get_spmc()
800 candidate = ck_ht_map_probe_rd(map, h, &snapshot, in ck_ht_get_spmc()
804 d_prime = CK_HT_TYPE_LOAD(&map->deletions); in ck_ht_get_spmc()
827 struct ck_ht_map *map; in ck_ht_set_spmc() local
832 map = table->map; in ck_ht_set_spmc()
835 candidate = ck_ht_map_probe_wr(map, h, &snapshot, &priority, in ck_ht_set_spmc()
840 candidate = ck_ht_map_probe_wr(map, h, &snapshot, &priority, in ck_ht_set_spmc()
854 if (ck_ht_grow_spmc(table, map->capacity << 1) == false) in ck_ht_set_spmc()
885 CK_HT_TYPE_STORE(&map->deletions, map->deletions + 1); in ck_ht_set_spmc()
898 CK_HT_TYPE_STORE(&map->deletions, map->deletions + 1); in ck_ht_set_spmc()
915 CK_HT_TYPE_STORE(&map->deletions, map->deletions + 1); in ck_ht_set_spmc()
940 CK_HT_TYPE_STORE(&map->n_entries, map->n_entries + 1); in ck_ht_set_spmc()
943 ck_ht_map_bound_set(map, h, probes); in ck_ht_set_spmc()
946 if (map->n_entries * 2 > map->capacity) in ck_ht_set_spmc()
947 ck_ht_grow_spmc(table, map->capacity << 1); in ck_ht_set_spmc()
964 struct ck_ht_map *map; in ck_ht_put_spmc() local
968 map = table->map; in ck_ht_put_spmc()
971 candidate = ck_ht_map_probe_wr(map, h, &snapshot, &priority, in ck_ht_put_spmc()
976 candidate = ck_ht_map_probe_wr(map, h, &snapshot, &priority, in ck_ht_put_spmc()
985 if (ck_ht_grow_spmc(table, map->capacity << 1) == false) in ck_ht_put_spmc()
991 CK_HT_TYPE_STORE(&map->deletions, map->deletions + 1); in ck_ht_put_spmc()
1007 ck_ht_map_bound_set(map, h, probes); in ck_ht_put_spmc()
1021 CK_HT_TYPE_STORE(&map->n_entries, map->n_entries + 1); in ck_ht_put_spmc()
1024 if (map->n_entries * 2 > map->capacity) in ck_ht_put_spmc()
1025 ck_ht_grow_spmc(table, map->capacity << 1); in ck_ht_put_spmc()
1034 ck_ht_map_destroy(table->m, table->map, false); in ck_ht_destroy()