6 #define ID_TABLE_DEBUG 0 9 #if ID_TABLE_DEBUG == 0 36 #define ID_TABLE_IMPL 34 39 #if ID_TABLE_IMPL == 0 40 #define ID_TABLE_NAME st 41 #define ID_TABLE_IMPL_TYPE struct st_id_table 43 #define ID_TABLE_USE_ST 1 44 #define ID_TABLE_USE_ST_DEBUG 1 46 #elif ID_TABLE_IMPL == 1 47 #define ID_TABLE_NAME st 48 #define ID_TABLE_IMPL_TYPE struct st_id_table 50 #define ID_TABLE_USE_ST 1 51 #define ID_TABLE_USE_ST_DEBUG 0 53 #elif ID_TABLE_IMPL == 11 54 #define ID_TABLE_NAME list 55 #define ID_TABLE_IMPL_TYPE struct list_id_table 57 #define ID_TABLE_USE_LIST 1 58 #define ID_TABLE_USE_CALC_VALUES 1 60 #elif ID_TABLE_IMPL == 12 61 #define ID_TABLE_NAME list 62 #define ID_TABLE_IMPL_TYPE struct list_id_table 64 #define ID_TABLE_USE_LIST 1 65 #define ID_TABLE_USE_CALC_VALUES 1 66 #define ID_TABLE_USE_ID_SERIAL 1 68 #elif ID_TABLE_IMPL == 13 69 #define ID_TABLE_NAME list 70 #define ID_TABLE_IMPL_TYPE struct list_id_table 72 #define ID_TABLE_USE_LIST 1 73 #define ID_TABLE_USE_CALC_VALUES 1 74 #define ID_TABLE_USE_ID_SERIAL 1 75 #define ID_TABLE_SWAP_RECENT_ACCESS 1 77 #elif ID_TABLE_IMPL == 14 78 #define ID_TABLE_NAME list 79 #define ID_TABLE_IMPL_TYPE struct list_id_table 81 #define ID_TABLE_USE_LIST 1 82 #define ID_TABLE_USE_CALC_VALUES 1 83 #define ID_TABLE_USE_ID_SERIAL 1 84 #define ID_TABLE_USE_LIST_SORTED 1 86 #elif ID_TABLE_IMPL == 15 87 #define ID_TABLE_NAME list 88 #define ID_TABLE_IMPL_TYPE struct list_id_table 90 #define ID_TABLE_USE_LIST 1 91 #define ID_TABLE_USE_CALC_VALUES 1 92 #define ID_TABLE_USE_ID_SERIAL 1 93 #define ID_TABLE_USE_LIST_SORTED 1 94 #define ID_TABLE_USE_LIST_SORTED_LINEAR_SMALL_RANGE 1 96 #elif ID_TABLE_IMPL == 21 97 #define ID_TABLE_NAME hash 98 #define ID_TABLE_IMPL_TYPE sa_table 100 #define ID_TABLE_USE_COALESCED_HASHING 1 101 #define ID_TABLE_USE_ID_SERIAL 1 103 #elif ID_TABLE_IMPL == 22 104 #define ID_TABLE_NAME hash 105 #define ID_TABLE_IMPL_TYPE struct hash_id_table 107 #define ID_TABLE_USE_SMALL_HASH 1 108 #define ID_TABLE_USE_ID_SERIAL 1 110 #elif ID_TABLE_IMPL == 31 111 #define ID_TABLE_NAME mix 112 #define ID_TABLE_IMPL_TYPE struct mix_id_table 114 #define ID_TABLE_USE_MIX 1 115 #define ID_TABLE_USE_MIX_LIST_MAX_CAPA 32 117 #define ID_TABLE_USE_ID_SERIAL 1 119 #define ID_TABLE_USE_LIST 1 120 #define ID_TABLE_USE_CALC_VALUES 1 121 #define ID_TABLE_USE_SMALL_HASH 1 123 #elif ID_TABLE_IMPL == 32 124 #define ID_TABLE_NAME mix 125 #define ID_TABLE_IMPL_TYPE struct mix_id_table 127 #define ID_TABLE_USE_MIX 1 128 #define ID_TABLE_USE_MIX_LIST_MAX_CAPA 32 130 #define ID_TABLE_USE_ID_SERIAL 1 132 #define ID_TABLE_USE_LIST 1 133 #define ID_TABLE_USE_CALC_VALUES 1 134 #define ID_TABLE_USE_LIST_SORTED 1 136 #define ID_TABLE_USE_SMALL_HASH 1 138 #elif ID_TABLE_IMPL == 33 139 #define ID_TABLE_NAME mix 140 #define ID_TABLE_IMPL_TYPE struct mix_id_table 142 #define ID_TABLE_USE_MIX 1 143 #define ID_TABLE_USE_MIX_LIST_MAX_CAPA 64 145 #define ID_TABLE_USE_ID_SERIAL 1 147 #define ID_TABLE_USE_LIST 1 148 #define ID_TABLE_USE_CALC_VALUES 1 149 #define ID_TABLE_USE_SMALL_HASH 1 151 #elif ID_TABLE_IMPL == 34 152 #define ID_TABLE_NAME mix 153 #define ID_TABLE_IMPL_TYPE struct mix_id_table 155 #define ID_TABLE_USE_MIX 1 156 #define ID_TABLE_USE_MIX_LIST_MAX_CAPA 64 158 #define ID_TABLE_USE_ID_SERIAL 1 160 #define ID_TABLE_USE_LIST 1 161 #define ID_TABLE_USE_CALC_VALUES 1 162 #define ID_TABLE_USE_LIST_SORTED 1 164 #define ID_TABLE_USE_SMALL_HASH 1 166 #elif ID_TABLE_IMPL == 35 167 #define ID_TABLE_NAME mix 168 #define ID_TABLE_IMPL_TYPE struct mix_id_table 170 #define ID_TABLE_USE_MIX 1 171 #define ID_TABLE_USE_MIX_LIST_MAX_CAPA 64 173 #define ID_TABLE_USE_ID_SERIAL 1 175 #define ID_TABLE_USE_LIST 1 176 #define ID_TABLE_USE_CALC_VALUES 1 177 #define ID_TABLE_USE_LIST_SORTED 1 178 #define ID_TABLE_USE_LIST_SORTED_LINEAR_SMALL_RANGE 1 180 #define ID_TABLE_USE_SMALL_HASH 1 186 #if ID_TABLE_SWAP_RECENT_ACCESS && ID_TABLE_USE_LIST_SORTED 191 #define IMPL1(name, op) TOKEN_PASTE(name, _id##op) 192 #define IMPL(op) IMPL1(ID_TABLE_NAME, _table##op) 195 # define UNUSED(func) static func __attribute__((unused)) 197 # define UNUSED(func) static func 211 #if ID_TABLE_USE_ID_SERIAL 219 static inline id_key_t
227 #define key2id(key) key 228 #define id2key(id) id 237 #if ID_TABLE_USE_ST_DEBUG 238 #define ID_TABLE_MARK 0x12345678 246 tbl2st(
struct st_id_table *tbl)
248 if (tbl->check != ID_TABLE_MARK)
rb_bug(
"tbl2st: check error %x", tbl->check);
252 static struct st_id_table *
253 st_id_table_create(
size_t size)
255 struct st_id_table *tbl =
ALLOC(
struct st_id_table);
257 tbl->check = ID_TABLE_MARK;
262 st_id_table_free(
struct st_id_table *tbl)
275 tbl2st(
struct st_id_table *tbl)
280 static struct st_id_table *
281 st_id_table_create(
size_t size)
287 st_id_table_free(
struct st_id_table *tbl)
295 st_id_table_clear(
struct st_id_table *tbl)
301 st_id_table_size(
const struct st_id_table *tbl)
303 return tbl2st(tbl)->num_entries;
307 st_id_table_memsize(
const struct st_id_table *tbl)
309 size_t header_size = ID_TABLE_USE_ST_DEBUG ?
sizeof(
struct st_id_table) : 0;
314 st_id_table_lookup(struct st_id_table *tbl, ID id, VALUE *val)
320 st_id_table_insert(
struct st_id_table *tbl,
ID id,
VALUE val)
326 st_id_table_delete(
struct st_id_table *tbl,
ID id)
337 struct values_iter_data {
345 struct values_iter_data *values_iter_data = (
struct values_iter_data *)ptr;
346 return values_iter_data->values_i(val, values_iter_data->data);
352 struct values_iter_data values_iter_data;
353 values_iter_data.values_i =
func;
354 values_iter_data.data = data;
359 #if ID_TABLE_USE_LIST 361 #define LIST_MIN_CAPA 4 367 #if ID_TABLE_USE_CALC_VALUES == 0 372 #if ID_TABLE_USE_CALC_VALUES 373 #define TABLE_VALUES(tbl) ((VALUE *)((tbl)->keys + (tbl)->capa)) 375 #define TABLE_VALUES(tbl) (tbl)->values_ 382 #if ID_TABLE_USE_CALC_VALUES && \ 383 (UNALIGNED_WORD_ACCESS == 0) && (SIZEOF_VALUE == 8) 388 if (capa & (
size_t)1) capa += 1;
390 tbl->
capa = (int)capa;
391 #if ID_TABLE_USE_CALC_VALUES 392 tbl->
keys = (id_key_t *)
xmalloc(
sizeof(id_key_t) * capa +
sizeof(
VALUE) * capa);
401 #ifndef ID_TABLE_USE_MIX 403 list_id_table_create(
size_t capa)
414 #if ID_TABLE_USE_CALC_VALUES == 0 429 return (
size_t)tbl->
num;
444 #if ID_TABLE_USE_CALC_VALUES 446 VALUE *old_values, *new_values;
456 for (i=0; i<
num; i++) {
457 debug_values[i] = orig_values[i];
461 for (i=0; i< 2 *
num; i++) {
462 unsigned char *cs = (
unsigned char *)&tbl->
keys[i];
464 fprintf(stderr,
">> %3d | %p - ", i, cs);
465 for (j=0; j<
sizeof(
VALUE); j++) {
466 fprintf(stderr,
"%x ", cs[j]);
468 fprintf(stderr,
"\n");
474 new_values = (
VALUE *)(tbl->
keys + capa);
485 fprintf(stderr,
"memmove: %p -> %p (%d, capa: %d)\n",
486 old_values, new_values, num, capa);
489 assert(num == 0 || old_values < new_values);
491 for (i=num-1; i>=0; i--) {
492 new_values[i] = old_values[i];
496 for (i=0; i<
num; i++) {
497 assert(debug_values[i] == new_values[i]);
520 fprintf(stderr,
"tbl: %p (num: %d)\n", tbl, num);
521 for (i=0; i<
num; i++) {
522 fprintf(stderr,
" -> [%d] %s %d\n", i,
rb_id2name(
key2id(keys[i])), (
int)keys[i]);
531 #if ID_TABLE_USE_LIST_SORTED 536 for (i=0; i<num-1; i++) {
537 if (keys[i] >= keys[i+1]) {
538 list_table_show(tbl);
546 #if ID_TABLE_USE_LIST_SORTED 550 int p, min = 0,
max =
num;
552 #if ID_TABLE_USE_LIST_SORTED_LINEAR_SMALL_RANGE 555 if (keys[num/2] <= key) {
561 for (p = min; p<num && keys[p] <
key; p++) {
564 return (p<num && keys[p] == key) ? p : -p-1;
569 p = min + (
max - min) / 2;
575 id_key_t kp = keys[p];
579 if (kp > key)
max = p;
580 else if (kp < key) min = p+1;
602 #if ID_TABLE_USE_LIST_SORTED 607 for (i=0; i<
num; i++) {
610 if (keys[i] == key) {
621 id_key_t key =
id2key(
id);
627 #if ID_TABLE_SWAP_RECENT_ACCESS 630 id_key_t tk = tbl->
keys[index-1];
631 VALUE tv = values[index-1];
632 tbl->
keys[index-1] = tbl->
keys[index];
633 tbl->
keys[index] = tk;
634 values[index-1] = values[index];
648 const id_key_t key =
id2key(
id);
657 const int num = tbl->
num++;
658 #if ID_TABLE_USE_LIST_SORTED 659 const int insert_index = -(index + 1);
664 if (0) fprintf(stderr,
"insert: %d into %d on\n", (
int)key, insert_index);
666 for (i=num; i>insert_index; i--) {
668 values[i] = values[i-1];
690 #if ID_TABLE_USE_LIST_SORTED 695 for (i=index+1; i<
num; i++) {
697 values[i-1] = values[i];
701 values[index] = values[tbl->
num-1];
716 const id_key_t key =
id2key(
id);
721 #define FOREACH_LAST() do { \ 723 case ID_TABLE_ITERATOR_RESULT_END: \ 724 case ID_TABLE_CONTINUE: \ 725 case ID_TABLE_STOP: \ 727 case ID_TABLE_DELETE: \ 728 list_delete_index(tbl, key, i); \ 729 values = TABLE_VALUES(tbl); \ 744 for (i=0; i<
num; i++) {
745 const id_key_t key = keys[i];
762 for (i=0; i<
num; i++) {
763 const id_key_t key = keys[i];
774 #if ID_TABLE_USE_COALESCED_HASHING 779 typedef unsigned int sa_index_t;
784 #define SA_MIN_SIZE 4 786 typedef struct sa_entry {
794 sa_index_t num_entries;
800 sa_init_table(
register sa_table *table, sa_index_t num_bins)
803 table->num_entries = 0;
804 table->entries =
ZALLOC_N(sa_entry, num_bins);
805 table->num_bins = num_bins;
806 table->free_pos = num_bins;
811 hash_id_table_create(
size_t size)
813 sa_table* table =
ZALLOC(sa_table);
814 sa_init_table(table, (sa_index_t)size);
821 xfree(table->entries);
822 memset(table, 0,
sizeof(sa_table));
828 xfree(table->entries);
835 return sizeof(sa_table) + table->num_bins * sizeof (sa_entry);
838 static inline sa_index_t
839 calc_pos(
register sa_table* table, id_key_t key)
841 return key & (table->num_bins - 1);
845 fix_empty(
register sa_table* table)
847 while (--table->free_pos &&
848 table->entries[table->free_pos-1].next != SA_EMPTY);
851 #define FLOOR_TO_4 ((~((sa_index_t)0)) << 2) 853 find_empty(
register sa_table* table,
register sa_index_t pos)
855 sa_index_t new_pos = table->free_pos-1;
857 static const unsigned offsets[][3] = {
863 const unsigned *
const check = offsets[pos&3];
865 entry = table->entries+pos;
867 if (entry[check[0]].next == SA_EMPTY) { new_pos = pos + check[0];
goto check; }
868 if (entry[check[1]].next == SA_EMPTY) { new_pos = pos + check[1];
goto check; }
869 if (entry[check[2]].next == SA_EMPTY) { new_pos = pos + check[2];
goto check; }
872 if (new_pos+1 == table->free_pos) fix_empty(table);
876 static void resize(
register sa_table* table);
877 static int insert_into_chain(
register sa_table*,
register id_key_t,
st_data_t, sa_index_t pos);
878 static int insert_into_main(
register sa_table*, id_key_t,
st_data_t, sa_index_t pos, sa_index_t prev_pos);
881 sa_insert(
register sa_table* table, id_key_t key,
VALUE value)
883 register sa_entry *entry;
884 sa_index_t pos, main_pos;
886 if (table->num_bins == 0) {
887 sa_init_table(table, SA_MIN_SIZE);
890 pos = calc_pos(table, key);
891 entry = table->entries + pos;
893 if (entry->next == SA_EMPTY) {
894 entry->next = SA_LAST;
896 entry->value = value;
897 table->num_entries++;
898 if (pos+1 == table->free_pos) fix_empty(table);
902 if (entry->key == key) {
903 entry->value = value;
907 if (table->num_entries + (table->num_entries >> 2) > table->num_bins) {
909 return sa_insert(table, key, value);
912 main_pos = calc_pos(table, entry->key);
913 if (main_pos == pos) {
914 return insert_into_chain(table, key, value, pos);
917 if (!table->free_pos) {
919 return sa_insert(table, key, value);
921 return insert_into_main(table, key, value, pos, main_pos);
928 return sa_insert(table,
id2key(
id), value);
932 insert_into_chain(
register sa_table* table, id_key_t key,
st_data_t value, sa_index_t pos)
934 sa_entry *entry = table->entries + pos, *new_entry;
937 while (entry->next != SA_LAST) {
938 pos = entry->next - SA_OFFSET;
939 entry = table->entries + pos;
940 if (entry->key == key) {
941 entry->value = value;
946 if (!table->free_pos) {
948 return sa_insert(table, key, value);
951 new_pos = find_empty(table, pos);
952 new_entry = table->entries + new_pos;
953 entry->next = new_pos + SA_OFFSET;
955 new_entry->next = SA_LAST;
956 new_entry->key =
key;
957 new_entry->value = value;
958 table->num_entries++;
963 insert_into_main(
register sa_table* table, id_key_t key,
st_data_t value, sa_index_t pos, sa_index_t prev_pos)
965 sa_entry *entry = table->entries + pos;
966 sa_index_t new_pos = find_empty(table, pos);
967 sa_entry *new_entry = table->entries + new_pos;
972 while((npos = table->entries[prev_pos].next - SA_OFFSET) != pos) {
975 table->entries[prev_pos].next = new_pos + SA_OFFSET;
977 entry->next = SA_LAST;
979 entry->value = value;
980 table->num_entries++;
985 new_size(sa_index_t num_entries)
987 sa_index_t size = num_entries >> 3;
993 return (size + 1) << 3;
997 resize(
register sa_table *table)
1003 if (table->num_entries == 0) {
1004 xfree(table->entries);
1005 memset(table, 0,
sizeof(sa_table));
1009 sa_init_table(&tmp_table, new_size(table->num_entries + (table->num_entries >> 2)));
1010 entry = table->entries;
1012 for(i = 0; i < table->num_bins; i++, entry++) {
1013 if (entry->next != SA_EMPTY) {
1014 sa_insert(&tmp_table, entry->key, entry->value);
1017 xfree(table->entries);
1024 register sa_entry *entry;
1025 id_key_t key =
id2key(
id);
1027 if (table->num_entries == 0)
return 0;
1029 entry = table->entries + calc_pos(table, key);
1030 if (entry->next == SA_EMPTY)
return 0;
1032 if (entry->key == key)
goto found;
1033 if (entry->next == SA_LAST)
return 0;
1035 entry = table->entries + (entry->next - SA_OFFSET);
1036 if (entry->key == key)
goto found;
1038 while(entry->next != SA_LAST) {
1039 entry = table->entries + (entry->next - SA_OFFSET);
1040 if (entry->key == key)
goto found;
1044 if (valuep) *valuep = entry->value;
1051 return table->num_entries;
1057 sa_index_t pos, prev_pos = ~0;
1059 id_key_t key =
id2key(
id);
1061 if (table->num_entries == 0)
goto not_found;
1063 pos = calc_pos(table, key);
1064 entry = table->entries + pos;
1066 if (entry->next == SA_EMPTY)
goto not_found;
1069 if (entry->key == key) {
1070 if (entry->next != SA_LAST) {
1071 sa_index_t npos = entry->next - SA_OFFSET;
1072 *entry = table->entries[npos];
1073 memset(table->entries + npos, 0,
sizeof(sa_entry));
1076 memset(table->entries + pos, 0,
sizeof(sa_entry));
1078 table->entries[prev_pos].next = SA_LAST;
1081 table->num_entries--;
1082 if (table->num_entries < table->num_bins / 4) {
1087 if (entry->next == SA_LAST)
break;
1089 pos = entry->next - SA_OFFSET;
1090 entry = table->entries + pos;
1107 if (table->num_bins > 0) {
1108 for(i = 0; i < table->num_bins ; i++) {
1109 if (table->entries[i].next != SA_EMPTY) {
1110 id_key_t key = table->entries[i].key;
1111 st_data_t val = table->entries[i].value;
1115 case foreach_key_values:
1118 case foreach_values:
1119 ret = (*func)(
val, arg);
1139 hash_foreach(table, func, arg, foreach_key_values);
1145 hash_foreach(table, func, arg, foreach_values);
1149 #ifdef ID_TABLE_USE_SMALL_HASH 1156 #if SIZEOF_VALUE == 8 1169 #if SIZEOF_VALUE == 8 1170 #define ITEM_GET_KEY(tbl, i) ((tbl)->items[i].key) 1171 #define ITEM_KEY_ISSET(tbl, i) ((tbl)->items[i].key) 1172 #define ITEM_COLLIDED(tbl, i) ((tbl)->items[i].collision) 1173 #define ITEM_SET_COLLIDED(tbl, i) ((tbl)->items[i].collision = 1) 1180 #define ITEM_GET_KEY(tbl, i) ((tbl)->items[i].key >> 1) 1181 #define ITEM_KEY_ISSET(tbl, i) ((tbl)->items[i].key > 1) 1182 #define ITEM_COLLIDED(tbl, i) ((tbl)->items[i].key & 1) 1183 #define ITEM_SET_COLLIDED(tbl, i) ((tbl)->items[i].key |= 1) 1201 return (capa + 1) << 2;
1210 tbl->
capa = (int)capa;
1216 #ifndef ID_TABLE_USE_MIX 1218 hash_id_table_create(
size_t capa)
1243 return (
size_t)tbl->
num;
1255 if (tbl->
capa > 0) {
1256 int mask = tbl->
capa - 1;
1257 int ix = key & mask;
1262 ix = (ix + d) & mask;
1273 int mask = tbl->
capa - 1;
1274 int ix = key & mask;
1279 ix = (ix + d) & mask;
1314 if (new_cap < tbl->capa) {
1317 tmp_tbl.
capa = new_cap;
1319 for (i = 0; i < tbl->
capa; i++) {
1331 #if ID_TABLE_DEBUG && 0 1335 const id_key_t *keys = tbl->keys;
1336 const int capa = tbl->
capa;
1339 fprintf(stderr,
"tbl: %p (capa: %d, num: %d, used: %d)\n", tbl, tbl->
capa, tbl->
num, tbl->
used);
1340 for (i=0; i<
capa; i++) {
1342 fprintf(stderr,
" -> [%d] %s %d\n", i,
rb_id2name(
key2id(keys[i])), (
int)keys[i]);
1351 id_key_t key =
id2key(
id);
1387 const id_key_t key =
id2key(
id);
1395 int i, capa = tbl->
capa;
1397 for (i=0; i<
capa; i++) {
1414 int i, capa = tbl->
capa;
1416 for (i=0; i<
capa; i++) {
1429 #if ID_TABLE_USE_MIX 1442 #define LIST_LIMIT_P(mix) ((mix)->aux.size.num == ID_TABLE_USE_MIX_LIST_MAX_CAPA) 1443 #define LIST_P(mix) ((mix)->aux.size.capa <= ID_TABLE_USE_MIX_LIST_MAX_CAPA) 1495 id_key_t *keys = list->
keys;
1497 const int num = list->
num;
1502 for (i=0; i<
num; i++) {
1511 #if ID_TABLE_USE_CALC_VALUES == 0 1555 #define IMPL_TYPE1(type, prot, name, args) \ 1556 RUBY_ALIAS_FUNCTION_TYPE(type, prot, name, args) 1557 #define IMPL_TYPE(type, name, prot, args) \ 1558 IMPL_TYPE1(type, rb_id_table_##name prot, IMPL(_##name), args) 1559 #define IMPL_VOID1(prot, name, args) \ 1560 RUBY_ALIAS_FUNCTION_VOID(prot, name, args) 1561 #define IMPL_VOID(name, prot, args) \ 1562 IMPL_VOID1(rb_id_table_##name prot, IMPL(_##name), args) 1563 #define id_tbl (ID_TABLE_IMPL_TYPE *)tbl 1565 IMPL_TYPE(
struct rb_id_table *, create, (
size_t size), (size))
1575 IMPL_TYPE(
int,
delete, (
struct rb_id_table *tbl,
ID id),
1585 #if ID_TABLE_STARTUP_SIG
static int hash_id_table_lookup(struct hash_id_table *tbl, ID id, VALUE *valp)
enum rb_id_table_iterator_result rb_id_table_foreach_values_func_t(VALUE val, void *data)
static void mix_id_table_foreach(struct mix_id_table *tbl, rb_id_table_foreach_func_t *func, void *data)
static void list_id_table_free(struct list_id_table *tbl)
static rb_id_serial_t rb_id_to_serial(ID id)
void rb_bug(const char *fmt,...)
static void hash_table_raw_insert(struct hash_id_table *tbl, id_key_t key, VALUE val)
unsigned int UINT8 __attribute__((__mode__(__QI__)))
static int max(int a, int b)
static unsigned int hash(str, len) register const char *str
static id_key_t id2key(ID id)
static struct mix_id_table * mix_id_table_create(size_t size)
#define ITEM_COLLIDED(tbl, i)
#define ZALLOC_N(type, n)
static size_t hash_id_table_size(const struct hash_id_table *tbl)
static void list_id_table_clear(struct list_id_table *tbl)
SSL_METHOD *(* func)(void)
static int list_id_table_lookup(struct list_id_table *tbl, ID id, VALUE *valp)
static size_t hash_id_table_memsize(const struct hash_id_table *tbl)
static int list_id_table_delete(struct list_id_table *tbl, ID id)
static int hash_id_table_delete(struct hash_id_table *tbl, ID id)
static void tbl_assert(struct list_id_table *tbl)
static int values_i(VALUE key, VALUE value, VALUE ary)
static ID rb_id_serial_to_id(rb_id_serial_t num)
#define st_init_numtable_with_size
static void hash_id_table_foreach_values(struct hash_id_table *tbl, rb_id_table_foreach_values_func_t *func, void *data)
static int list_delete_index(struct list_id_table *tbl, id_key_t key, int index)
static size_t mix_id_table_size(const struct mix_id_table *tbl)
static void list_id_table_foreach(struct list_id_table *tbl, rb_id_table_foreach_func_t *func, void *data)
RUBY_SYMBOL_EXPORT_BEGIN typedef unsigned long st_data_t
#define ITEM_GET_KEY(tbl, i)
static int mix_id_table_delete(struct mix_id_table *tbl, ID id)
static int list_ids_bsearch(const id_key_t *keys, id_key_t key, int num)
#define MEMZERO(p, type, n)
static struct list_id_table * list_id_table_init(struct list_id_table *tbl, size_t capa)
static size_t list_id_table_memsize(const struct list_id_table *tbl)
static int round_capa(int capa)
static struct hash_id_table * hash_id_table_init(struct hash_id_table *tbl, int capa)
struct list_id_table list
#define ITEM_KEY_ISSET(tbl, i)
size_t st_memsize(const st_table *tab)
static void ITEM_SET_KEY(struct hash_id_table *tbl, int i, id_key_t key)
#define ITEM_SET_COLLIDED(tbl, i)
static void mix_id_table_foreach_values(struct mix_id_table *tbl, rb_id_table_foreach_values_func_t *func, void *data)
#define IMPL_VOID(name, prot, args)
static size_t mix_id_table_memsize(const struct mix_id_table *tbl)
static int mix_id_table_insert(struct mix_id_table *tbl, ID id, VALUE val)
static int hash_id_table_insert_key(struct hash_id_table *tbl, const id_key_t key, const VALUE val)
static int list_table_index(struct list_id_table *tbl, id_key_t key)
static int mix_id_table_lookup(struct mix_id_table *tbl, ID id, VALUE *valp)
static void list_table_extend(struct list_id_table *tbl)
static void hash_table_extend(struct hash_id_table *tbl)
static void hash_id_table_foreach(struct hash_id_table *tbl, rb_id_table_foreach_func_t *func, void *data)
static int list_id_table_insert(struct list_id_table *tbl, ID id, VALUE val)
static void mix_id_table_free(struct mix_id_table *tbl)
static int hash_delete_index(struct hash_id_table *tbl, int ix)
const char * rb_id2name(ID)
static int insert(const char *path, VALUE vinfo, void *enc)
static void hash_id_table_free(struct hash_id_table *tbl)
static void mix_id_table_clear(struct mix_id_table *tbl)
static size_t list_id_table_size(const struct list_id_table *tbl)
union mix_id_table::@117 aux
static void list_id_table_foreach_values(struct list_id_table *tbl, rb_id_table_foreach_values_func_t *func, void *data)
static ID key2id(id_key_t key)
#define IMPL_TYPE(type, name, prot, args)
struct rb_encoding_entry * list
enum rb_id_table_iterator_result rb_id_table_foreach_func_t(ID id, VALUE val, void *data)
#define LIST_LIMIT_P(mix)
#define TABLE_VALUES(tbl)
struct hash_id_table hash
static int hash_table_index(struct hash_id_table *tbl, id_key_t key)
static int hash_id_table_insert(struct hash_id_table *tbl, ID id, VALUE val)
static void hash_id_table_clear(struct hash_id_table *tbl)
void st_clear(st_table *)
rb_id_table_iterator_result
void rb_warn(const char *fmt,...)
#define ID_TABLE_IMPL_TYPE