Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

Data Structures | Macros | Typedefs | Functions | Variables
st.c File Reference
`#include "internal.h"`
`#include <stdio.h>`
`#include <string.h>`
`#include <assert.h>`

Go to the source code of this file.

## Data Structures
struct | st_table_entry
struct | st_features
struct | functor

## Macros
#define | PREFETCH(addr, write_p)
#define | EXPECT(expr, val) (expr)
#define | ATTRIBUTE_UNUSED
#define | st_assert(cond) ((void)(0 && (cond)))
#define | type_numhash st_hashtype_num
#define | ST_INIT_VAL 0xafafafafafafafaf
#define | ST_INIT_VAL_BYTE 0xafa
#define | malloc ruby_xmalloc
#define | calloc ruby_xcalloc
#define | realloc ruby_xrealloc
#define | free ruby_xfree
#define | EQUAL(tab, x, y) ((x) == (y) || (*(tab)->type->compare)((x),(y)) == 0)
#define | PTR_EQUAL(tab, ptr, hash_val, key_) ((ptr)->hash == (hash_val) && EQUAL((tab), (key_), (ptr)->key))
#define | DO_PTR_EQUAL_CHECK(tab, ptr, hash_val, key, res, rebuilt_p)
#define | MAX_POWER2 30
#define | RESERVED_HASH_VAL (~(st_hash_t) 0)
#define | RESERVED_HASH_SUBSTITUTION_VAL ((st_hash_t) 0)
#define | MINIMAL_POWER2 2
#define | MAX_POWER2_FOR_TABLES_WITHOUT_BINS 4
#define | EMPTY_BIN 0
#define | DELETED_BIN 1
#define | ENTRY_BASE 2
#define | MARK_BIN_EMPTY(tab, i) (set_bin((tab)->bins, get_size_ind(tab), i, EMPTY_BIN))
#define | UNDEFINED_ENTRY_IND (~(st_index_t) 0)
#define | UNDEFINED_BIN_IND (~(st_index_t) 0)
#define | REBUILT_TABLE_ENTRY_IND (~(st_index_t) 1)
#define | REBUILT_TABLE_BIN_IND (~(st_index_t) 1)
#define | MARK_BIN_DELETED(tab, i)
#define | EMPTY_BIN_P(b) ((b) == EMPTY_BIN)
#define | DELETED_BIN_P(b) ((b) == DELETED_BIN)
#define | EMPTY_OR_DELETED_BIN_P(b) ((b) <= DELETED_BIN)
#define | IND_EMPTY_BIN_P(tab, i) (EMPTY_BIN_P(get_bin((tab)->bins, get_size_ind(tab), i)))
#define | IND_DELETED_BIN_P(tab, i) (DELETED_BIN_P(get_bin((tab)->bins, get_size_ind(tab), i)))
#define | IND_EMPTY_OR_DELETED_BIN_P(tab, i) (EMPTY_OR_DELETED_BIN_P(get_bin((tab)->bins, get_size_ind(tab), i)))
#define | MARK_ENTRY_DELETED(e_ptr) ((e_ptr)->hash = RESERVED_HASH_VAL)
#define | DELETED_ENTRY_P(e_ptr) ((e_ptr)->hash == RESERVED_HASH_VAL)
#define | COLLISION
#define | FOUND_BIN
#define | REBUILD_THRESHOLD 4
#define | FNV1_32A_INIT 0x811c9dc5
#define | FNV_32_PRIME 0x01000193
#define | BIG_CONSTANT(x, y) ((st_index_t)(x)<<32|(st_index_t)(y))
#define | ROTL(x, n) ((x)<<(n)|(x)>>(SIZEOF_ST_INDEX_T*CHAR_BIT-(n)))
#define | C1 (st_index_t)0xcc9e2d51
#define | C2 (st_index_t)0x1b873593
#define | r1 (17)
#define | r2 (11)
#define | r1 (16)
#define | r2 (13)
#define | r3 (16)
#define | data_at(n) (st_index_t)((unsigned char)data[(n)])
#define | UNALIGNED_ADD_4 UNALIGNED_ADD(2); UNALIGNED_ADD(1); UNALIGNED_ADD(0)
#define | UNALIGNED_ADD_ALL UNALIGNED_ADD_4
#define | UNALIGNED_ADD(n)
#define | SKIP_TAIL 1
#define | aligned_data data
#define | UNALIGNED_ADD(n)

## Typedefs
typedef st_index_t | st_hash_t

## Functions
st_table * | st_init_table_with_size (const struct st_hash_type *type, st_index_t size)
st_table * | st_init_table (const struct st_hash_type *type)
st_table * | st_init_numtable (void)
st_table * | st_init_numtable_with_size (st_index_t size)
st_table * | st_init_strtable (void)
st_table * | st_init_strtable_with_size (st_index_t size)
st_table * | st_init_strcasetable (void)
st_table * | st_init_strcasetable_with_size (st_index_t size)
void | st_clear (st_table *tab)
void | st_free_table (st_table *tab)
size_t | st_memsize (const st_table *tab)
int | st_lookup (st_table *tab, st_data_t key, st_data_t *value)
int | st_get_key (st_table *tab, st_data_t key, st_data_t *result)
int | st_insert (st_table *tab, st_data_t key, st_data_t value)
void | st_add_direct (st_table *tab, st_data_t key, st_data_t value)
int | st_insert2 (st_table *tab, st_data_t key, st_data_t value, st_data_t(*func)(st_data_t))
st_table * | st_copy (st_table *old_tab)
int | st_delete (st_table *tab, st_data_t *key, st_data_t *value)
int | st_delete_safe (st_table *tab, st_data_t *key, st_data_t *value, st_data_t never ATTRIBUTE_UNUSED)
int | st_shift (st_table *tab, st_data_t *key, st_data_t *value)
void | st_cleanup_safe (st_table *tab ATTRIBUTE_UNUSED, st_data_t never ATTRIBUTE_UNUSED)
int | st_update (st_table *tab, st_data_t key, st_update_callback_func *func, st_data_t arg)
int | st_foreach_with_replace (st_table *tab, st_foreach_check_callback_func *func, st_update_callback_func *replace, st_data_t arg)
int | st_foreach (st_table *tab, st_foreach_callback_func *func, st_data_t arg)
int | st_foreach_check (st_table *tab, st_foreach_check_callback_func *func, st_data_t arg, st_data_t never ATTRIBUTE_UNUSED)
st_index_t | st_keys (st_table *tab, st_data_t *keys, st_index_t size)
st_index_t | st_keys_check (st_table *tab, st_data_t *keys, st_index_t size, st_data_t never ATTRIBUTE_UNUSED)
st_index_t | st_values (st_table *tab, st_data_t *values, st_index_t size)
st_index_t | st_values_check (st_table *tab, st_data_t *values, st_index_t size, st_data_t never ATTRIBUTE_UNUSED)
| NO_SANITIZE ("unsigned-integer-overflow", static inline st_index_t murmur_step(st_index_t h, st_index_t k))
| NO_SANITIZE ("unsigned-integer-overflow", static inline st_index_t murmur_finish(st_index_t h))
| NO_SANITIZE ("unsigned-integer-overflow", extern st_index_t st_hash(const void *ptr, size_t len, st_index_t h))
st_index_t | st_hash (const void *ptr, size_t len, st_index_t h)
st_index_t | st_hash_uint32 (st_index_t h, uint32_t i)
| NO_SANITIZE ("unsigned-integer-overflow", extern st_index_t st_hash_uint(st_index_t h, st_index_t i))
st_index_t | st_hash_uint (st_index_t h, st_index_t i)
st_index_t | st_hash_end (st_index_t h)
st_index_t | rb_st_hash_start (st_index_t h)
int | st_locale_insensitive_strcasecmp (const char *s1, const char *s2)
int | st_locale_insensitive_strncasecmp (const char *s1, const char *s2, size_t n)
| NO_SANITIZE ("unsigned-integer-overflow", PUREFUNC(static st_index_t strcasehash(st_data_t)))
int | st_numcmp (st_data_t x, st_data_t y)
st_index_t | st_numhash (st_data_t n)
void | rb_hash_bulk_insert_into_st_table (long argc, const VALUE *argv, VALUE hash)

## Variables
const st_hash_t | st_reserved_hash_val = RESERVED_HASH_VAL
const st_hash_t | st_reserved_hash_substitution_val = RESERVED_HASH_SUBSTITUTION_VAL

## Macro Definition Documentation

## ◆ aligned_data

#define aligned_data data

## ◆ ATTRIBUTE_UNUSED

#define ATTRIBUTE_UNUSED

Definition at line 124 of file st.c.

## ◆ BIG_CONSTANT

#define BIG_CONSTANT | ( |  | x,
|  |  | y
| ) |  | ((st_index_t)(x)<<32|(st_index_t)(y))

Definition at line 1830 of file st.c.

## ◆ C1

#define C1 (st_index_t)0xcc9e2d51

Definition at line 1834 of file st.c.

## ◆ C2

#define C2 (st_index_t)0x1b873593

Definition at line 1835 of file st.c.

## ◆ calloc

#define calloc ruby_xcalloc

Definition at line 174 of file st.c.

## ◆ COLLISION

#define COLLISION

Definition at line 759 of file st.c.

## ◆ data_at

#define data_at | ( |  | n | ) | (st_index_t)((unsigned char)data[(n)])

## ◆ DELETED_BIN

#define DELETED_BIN 1

Definition at line 385 of file st.c.

## ◆ DELETED_BIN_P

#define DELETED_BIN_P | ( |  | b | ) | ((b) == DELETED_BIN)

Definition at line 416 of file st.c.

## ◆ DELETED_ENTRY_P

#define DELETED_ENTRY_P | ( |  | e_ptr | ) | ((e_ptr)->hash == RESERVED_HASH_VAL)

Definition at line 428 of file st.c.

## ◆ DO_PTR_EQUAL_CHECK

#define DO_PTR_EQUAL_CHECK | ( |  | tab,
|  |  | ptr,
|  |  | hash_val,
|  |  | key,
|  |  | res,
|  |  | rebuilt_p
| ) |  |

Value:
do { \
unsigned int _old_rebuilds_num = (tab)->rebuilds_num; \
res = PTR_EQUAL(tab, ptr, hash_val, key); \
rebuilt_p = _old_rebuilds_num != (tab)->rebuilds_num; \
} while (FALSE)

Definition at line 185 of file st.c.

## ◆ EMPTY_BIN

#define EMPTY_BIN 0

Definition at line 384 of file st.c.

## ◆ EMPTY_BIN_P

#define EMPTY_BIN_P | ( |  | b | ) | ((b) == EMPTY_BIN)

Definition at line 415 of file st.c.

## ◆ EMPTY_OR_DELETED_BIN_P

#define EMPTY_OR_DELETED_BIN_P | ( |  | b | ) | ((b) <= DELETED_BIN)

Definition at line 417 of file st.c.

## ◆ ENTRY_BASE

#define ENTRY_BASE 2

Definition at line 387 of file st.c.

## ◆ EQUAL

#define EQUAL | ( |  | tab,
|  |  | x,
|  |  | y
| ) |  | ((x) == (y) || (*(tab)->type->compare)((x),(y)) == 0)

Definition at line 179 of file st.c.

## ◆ EXPECT

#define EXPECT | ( |  | expr,
|  |  | val
| ) |  | (expr)

Definition at line 123 of file st.c.

## ◆ FNV1_32A_INIT

#define FNV1_32A_INIT 0x811c9dc5

Definition at line 1808 of file st.c.

## ◆ FNV_32_PRIME

#define FNV_32_PRIME 0x01000193

Definition at line 1813 of file st.c.

## ◆ FOUND_BIN

#define FOUND_BIN

Definition at line 760 of file st.c.

## ◆ free

#define free ruby_xfree

Definition at line 176 of file st.c.

## ◆ IND_DELETED_BIN_P

#define IND_DELETED_BIN_P | ( |  | tab,
|  |  | i
| ) |  | (DELETED_BIN_P(get_bin((tab)->bins, get_size_ind(tab), i)))

Definition at line 422 of file st.c.

## ◆ IND_EMPTY_BIN_P

#define IND_EMPTY_BIN_P | ( |  | tab,
|  |  | i
| ) |  | (EMPTY_BIN_P(get_bin((tab)->bins, get_size_ind(tab), i)))

Definition at line 421 of file st.c.

## ◆ IND_EMPTY_OR_DELETED_BIN_P

#define IND_EMPTY_OR_DELETED_BIN_P | ( |  | tab,
|  |  | i
| ) |  | (EMPTY_OR_DELETED_BIN_P(get_bin((tab)->bins, get_size_ind(tab), i)))

Definition at line 423 of file st.c.

## ◆ malloc

#define malloc ruby_xmalloc

Definition at line 173 of file st.c.

## ◆ MARK_BIN_DELETED

#define MARK_BIN_DELETED | ( |  | tab,
|  |  | i
| ) |  |

Value:
do { \
st_assert(i != UNDEFINED_BIN_IND); \
st_assert(! IND_EMPTY_OR_DELETED_BIN_P(tab, i)); \
set_bin((tab)->bins, get_size_ind(tab), i, DELETED_BIN); \
} while (0)

Definition at line 406 of file st.c.

## ◆ MARK_BIN_EMPTY

#define MARK_BIN_EMPTY | ( |  | tab,
|  |  | i
| ) |  | (set_bin((tab)->bins, get_size_ind(tab), i, EMPTY_BIN))

Definition at line 391 of file st.c.

## ◆ MARK_ENTRY_DELETED

#define MARK_ENTRY_DELETED | ( |  | e_ptr | ) | ((e_ptr)->hash = RESERVED_HASH_VAL)

Definition at line 427 of file st.c.

## ◆ MAX_POWER2

#define MAX_POWER2 30

Definition at line 277 of file st.c.

## ◆ MAX_POWER2_FOR_TABLES_WITHOUT_BINS

#define MAX_POWER2_FOR_TABLES_WITHOUT_BINS 4

Definition at line 342 of file st.c.

## ◆ MINIMAL_POWER2

#define MINIMAL_POWER2 2

Definition at line 334 of file st.c.

## ◆ PREFETCH

#define PREFETCH | ( |  | addr,
|  |  | write_p
| ) |  |

Definition at line 122 of file st.c.

## ◆ PTR_EQUAL

#define PTR_EQUAL | ( |  | tab,
|  |  | ptr,
|  |  | hash_val,
|  |  | key_
| ) |  | ((ptr)->hash == (hash_val) && EQUAL((tab), (key_), (ptr)->key))

Definition at line 180 of file st.c.

## ◆ r1 [1/2]

#define r1 (17)

## ◆ r1 [2/2]

#define r1 (16)

## ◆ r2 [1/2]

#define r2 (11)

## ◆ r2 [2/2]

#define r2 (13)

## ◆ r3

#define r3 (16)

## ◆ realloc

#define realloc ruby_xrealloc

Definition at line 175 of file st.c.

## ◆ REBUILD_THRESHOLD

#define REBUILD_THRESHOLD 4

Definition at line 766 of file st.c.

## ◆ REBUILT_TABLE_BIN_IND

#define REBUILT_TABLE_BIN_IND (~(st_index_t) 1)

Definition at line 401 of file st.c.

## ◆ REBUILT_TABLE_ENTRY_IND

#define REBUILT_TABLE_ENTRY_IND (~(st_index_t) 1)

Definition at line 400 of file st.c.

## ◆ RESERVED_HASH_SUBSTITUTION_VAL

#define RESERVED_HASH_SUBSTITUTION_VAL ((st_hash_t) 0)

Definition at line 317 of file st.c.

## ◆ RESERVED_HASH_VAL

#define RESERVED_HASH_VAL (~(st_hash_t) 0)

Definition at line 316 of file st.c.

## ◆ ROTL

#define ROTL | ( |  | x,
|  |  | n
| ) |  | ((x)<<(n)|(x)>>(SIZEOF_ST_INDEX_T*CHAR_BIT-(n)))

Definition at line 1831 of file st.c.

## ◆ SKIP_TAIL

#define SKIP_TAIL 1

## ◆ st_assert

#define st_assert | ( |  | cond | ) | ((void)(0 && (cond)))

Definition at line 130 of file st.c.

## ◆ ST_INIT_VAL

#define ST_INIT_VAL 0xafafafafafafafaf

Definition at line 165 of file st.c.

## ◆ ST_INIT_VAL_BYTE

#define ST_INIT_VAL_BYTE 0xafa

Definition at line 166 of file st.c.

## ◆ type_numhash

#define type_numhash st_hashtype_num

Definition at line 142 of file st.c.

## ◆ UNALIGNED_ADD [1/3]

#define UNALIGNED_ADD | ( |  | n | ) |

Value:
case SIZEOF_ST_INDEX_T - (n) - 1: \
t |= data_at(n) << CHAR_BIT*(n)

## ◆ UNALIGNED_ADD [2/3]

#define UNALIGNED_ADD | ( |  | n | ) |

Value:
case (n) + 1: \
d |= data_at(n) << CHAR_BIT*(n)

## ◆ UNALIGNED_ADD [3/3]

#define UNALIGNED_ADD | ( |  | n | ) |

Value:
case (n) + 1: \
t |= data_at(n) << CHAR_BIT*(n)

## ◆ UNALIGNED_ADD_4

#define UNALIGNED_ADD_4 UNALIGNED_ADD(2); UNALIGNED_ADD(1); UNALIGNED_ADD(0)

## ◆ UNALIGNED_ADD_ALL

#define UNALIGNED_ADD_ALL UNALIGNED_ADD_4

## ◆ UNDEFINED_BIN_IND

#define UNDEFINED_BIN_IND (~(st_index_t) 0)

Definition at line 396 of file st.c.

## ◆ UNDEFINED_ENTRY_IND

#define UNDEFINED_ENTRY_IND (~(st_index_t) 0)

Definition at line 395 of file st.c.

## Typedef Documentation

## ◆ st_hash_t

typedef st_index_t st_hash_t

Definition at line 134 of file st.c.

## Function Documentation

## ◆ NO_SANITIZE() [1/5]

NO_SANITIZE | ( | "unsigned-integer-overflow" | ,
|  | extern st_index_t | st_hashconst void *ptr, size_t len, st_index_t h
| ) |  |

## ◆ NO_SANITIZE() [2/5]

NO_SANITIZE | ( | "unsigned-integer-overflow" | ,
|  | extern st_index_t | st_hash_uintst_index_t h, st_index_t i
| ) |  |

## ◆ NO_SANITIZE() [3/5]

NO_SANITIZE | ( | "unsigned-integer-overflow" | ,
|  | PUREFUNC(static st_index_t strcasehash(st_data_t)) |
| ) |  |

## ◆ NO_SANITIZE() [4/5]

NO_SANITIZE | ( | "unsigned-integer-overflow" | ,
|  | static inline st_index_t | murmur_finishst_index_t h
| ) |  |

## ◆ NO_SANITIZE() [5/5]

NO_SANITIZE | ( | "unsigned-integer-overflow" | ,
|  | static inline st_index_t | murmur_stepst_index_t h, st_index_t k
| ) |  |

## ◆ rb_hash_bulk_insert_into_st_table()

void rb_hash_bulk_insert_into_st_table | ( | long | argc,
|  | const VALUE * | argv,
|  | VALUE | hash
| ) |  |

Definition at line 2380 of file st.c.

## ◆ rb_st_hash_start()

st_index_t rb_st_hash_start | ( | st_index_t | h | ) |

Definition at line 2070 of file st.c.

References h.

## ◆ st_add_direct()

void st_add_direct | ( | st_table * | tab,
|  | st_data_t | key,
|  | st_data_t | value
| ) |  |

Definition at line 1251 of file st.c.

## ◆ st_cleanup_safe()

void st_cleanup_safe | ( | st_table *tab | ATTRIBUTE_UNUSED,
|  | st_data_t never | ATTRIBUTE_UNUSED
| ) |  |

Definition at line 1496 of file st.c.

## ◆ st_clear()

void st_clear | ( | st_table * | tab | ) |

Definition at line 698 of file st.c.

## ◆ st_copy()

st_table* st_copy | ( | st_table * | old_tab | ) |

Definition at line 1320 of file st.c.

References st_table::bins, malloc, and NULL.

Referenced by rb_iv_tbl_copy().

## ◆ st_delete()

int st_delete | ( | st_table * | tab,
|  | st_data_t * | key,
|  | st_data_t * | value
| ) |  |

Definition at line 1418 of file st.c.

Referenced by rb_free_generic_ivar(), rb_mod_remove_cvar(), rb_mv_generic_ivar(), rb_obj_remove_instance_variable(), rb_str_free(), and rb_undefine_finalizer().

## ◆ st_delete_safe()

int st_delete_safe | ( | st_table * | tab,
|  | st_data_t * | key,
|  | st_data_t * | value,
|  | st_data_t never | ATTRIBUTE_UNUSED
| ) |  |

Definition at line 1429 of file st.c.

## ◆ st_foreach()

int st_foreach | ( | st_table * | tab,
|  | st_foreach_callback_func * | func,
|  | st_data_t | arg
| ) |  |

Definition at line 1718 of file st.c.

References arg, f, and functor::func.

Referenced by Init_String(), rb_enc_foreach_name(), rb_iv_tbl_copy(), rb_sym_all_symbols(), and ruby::backward::cxxanyargs::st_foreach().

## ◆ st_foreach_check()

int st_foreach_check | ( | st_table * | tab,
|  | st_foreach_check_callback_func * | func,
|  | st_data_t | arg,
|  | st_data_t never | ATTRIBUTE_UNUSED
| ) |  |

Definition at line 1726 of file st.c.

Referenced by ruby::backward::cxxanyargs::st_foreach_check(), and st_foreach_safe().

## ◆ st_foreach_with_replace()

int st_foreach_with_replace | ( | st_table * | tab,
|  | st_foreach_check_callback_func * | func,
|  | st_update_callback_func * | replace,
|  | st_data_t | arg
| ) |  |

Definition at line 1700 of file st.c.

## ◆ st_free_table()

void st_free_table | ( | st_table * | tab | ) |

Definition at line 709 of file st.c.

References st_table::bins, st_table::entries, free, and NULL.

Referenced by rb_iseq_build_from_ary().

## ◆ st_get_key()

int st_get_key | ( | st_table * | tab,
|  | st_data_t | key,
|  | st_data_t * | result
| ) |  |

Definition at line 1130 of file st.c.

## ◆ st_hash()

st_index_t st_hash | ( | const void * | ptr,
|  | size_t | len,
|  | st_index_t | h
| ) |  |

Definition at line 1897 of file st.c.

References CHAR_BIT, h, int, len, ptr, SIZEOF_ST_INDEX_T, and UNALIGNED_ADD_ALL.

## ◆ st_hash_end()

st_index_t st_hash_end | ( | st_index_t | h | ) |

Definition at line 2062 of file st.c.

References h.

## ◆ st_hash_uint()

st_index_t st_hash_uint | ( | st_index_t | h,
|  | st_index_t | i
| ) |  |

Definition at line 2049 of file st.c.

References h, and i.

## ◆ st_hash_uint32()

st_index_t st_hash_uint32 | ( | st_index_t | h,
|  | uint32_t | i
| ) |  |

Definition at line 2042 of file st.c.

## ◆ st_init_numtable()

st_table* st_init_numtable | ( | void |  | ) |

Definition at line 653 of file st.c.

References st_init_table(), and type_numhash.

Referenced by Init_vm_objects(), rb_iseq_build_from_ary(), rb_mod_const_at(), rb_obj_singleton_methods(), rb_singleton_class_attached(), and ruby_register_rollback_func_for_ensure().

## ◆ st_init_numtable_with_size()

st_table* st_init_numtable_with_size | ( | st_index_t | size | ) |

Definition at line 660 of file st.c.

References size, st_init_table_with_size(), and type_numhash.

## ◆ st_init_strcasetable()

st_table* st_init_strcasetable | ( | void |  | ) |

Definition at line 683 of file st.c.

References st_init_table().

## ◆ st_init_strcasetable_with_size()

st_table* st_init_strcasetable_with_size | ( | st_index_t | size | ) |

Definition at line 691 of file st.c.

References st_init_table_with_size().

## ◆ st_init_strtable()

st_table* st_init_strtable | ( | void |  | ) |

Definition at line 668 of file st.c.

References st_init_table().

Referenced by Init_vm_objects().

## ◆ st_init_strtable_with_size()

st_table* st_init_strtable_with_size | ( | st_index_t | size | ) |

Definition at line 675 of file st.c.

References st_init_table_with_size().

## ◆ st_init_table()

st_table* st_init_table | ( | const struct st_hash_type * | type | ) |

Definition at line 645 of file st.c.

References st_init_table_with_size().

Referenced by Init_heap(), rb_init_identtable(), st_init_numtable(), st_init_strcasetable(), and st_init_strtable().

## ◆ st_init_table_with_size()

st_table* st_init_table_with_size | ( | const struct st_hash_type * | type,
|  | st_index_t | size
| ) |  |

Definition at line 577 of file st.c.

References atexit(), getenv, and n.

Referenced by Init_sym(), Init_vm_objects(), st_init_numtable_with_size(), st_init_strcasetable_with_size(), st_init_strtable_with_size(), and st_init_table().

## ◆ st_insert()

int st_insert | ( | st_table * | tab,
|  | st_data_t | key,
|  | st_data_t | value
| ) |  |

Definition at line 1171 of file st.c.

References bin.

Referenced by rb_gc_copy_finalizer(), rb_marshal_define_compat(), rb_vm_add_root_module(), and ruby_register_rollback_func_for_ensure().

## ◆ st_insert2()

int st_insert2 | ( | st_table * | tab,
|  | st_data_t | key,
|  | st_data_t | value,
|  | st_data_t(*)(st_data_t) | func
| ) |  |

Definition at line 1263 of file st.c.

References bin.

## ◆ st_keys()

st_index_t st_keys | ( | st_table * | tab,
|  | st_data_t * | keys,
|  | st_index_t | size
| ) |  |

Definition at line 1757 of file st.c.

## ◆ st_keys_check()

st_index_t st_keys_check | ( | st_table * | tab,
|  | st_data_t * | keys,
|  | st_index_t | size,
|  | st_data_t never | ATTRIBUTE_UNUSED
| ) |  |

Definition at line 1764 of file st.c.

## ◆ st_lookup()

int st_lookup | ( | st_table * | tab,
|  | st_data_t | key,
|  | st_data_t * | value
| ) |  |

Definition at line 1101 of file st.c.

References bin.

Referenced by rb_autoload_str(), rb_econv_asciicompat_encoding(), rb_gc_copy_finalizer(), rb_ivar_defined(), rb_ivar_lookup(), rb_obj_remove_instance_variable(), rb_vm_insn_addr2insn(), rsock_intern_family(), rsock_intern_family_noprefix(), rsock_intern_ip_optname(), rsock_intern_iplevel(), rsock_intern_ipproto(), rsock_intern_ipv6_optname(), rsock_intern_local_optname(), rsock_intern_protocol_family(), rsock_intern_scm_optname(), rsock_intern_so_optname(), rsock_intern_socktype(), rsock_intern_tcp_optname(), and rsock_intern_udp_optname().

## ◆ st_memsize()

size_t st_memsize | ( | const st_table * | tab | ) |

Definition at line 719 of file st.c.

References st_table::bins, and NULL.

## ◆ st_numcmp()

int st_numcmp | ( | st_data_t | x,
|  | st_data_t | y
| ) |  |

Definition at line 2170 of file st.c.

## ◆ st_numhash()

st_index_t st_numhash | ( | st_data_t | n | ) |

Definition at line 2176 of file st.c.

References n, and s2.

## ◆ st_shift()

int st_shift | ( | st_table * | tab,
|  | st_data_t * | key,
|  | st_data_t * | value
| ) |  |

Definition at line 1440 of file st.c.

References bin, st_table::bins, DELETED_ENTRY_P, st_table::entries, entries, st_table::entries_bound, st_table::entries_start, st_table_entry::hash, i, st_table_entry::key, key, NULL, and st_table_entry::record.

## ◆ st_update()

int st_update | ( | st_table * | tab,
|  | st_data_t | key,
|  | st_update_callback_func * | func,
|  | st_data_t | arg
| ) |  |

Definition at line 1510 of file st.c.

References bin, entries, and NULL.

## ◆ st_values()

st_index_t st_values | ( | st_table * | tab,
|  | st_data_t * | values,
|  | st_index_t | size
| ) |  |

Definition at line 1795 of file st.c.

## ◆ st_values_check()

st_index_t st_values_check | ( | st_table * | tab,
|  | st_data_t * | values,
|  | st_index_t | size,
|  | st_data_t never | ATTRIBUTE_UNUSED
| ) |  |

Definition at line 1802 of file st.c.

## Variable Documentation

## ◆ st_reserved_hash_substitution_val

const st_hash_t st_reserved_hash_substitution_val = RESERVED_HASH_SUBSTITUTION_VAL

Definition at line 320 of file st.c.

## ◆ st_reserved_hash_val

const st_hash_t st_reserved_hash_val = RESERVED_HASH_VAL

Definition at line 319 of file st.c.

UNDEFINED_BIN_IND
#define UNDEFINED_BIN_IND
Definition: st.c:396
CHAR_BIT
#define CHAR_BIT
Definition: ruby.h:227
ptr
struct RIMemo * ptr
Definition: debug.c:74
IND_EMPTY_OR_DELETED_BIN_P
#define IND_EMPTY_OR_DELETED_BIN_P(tab, i)
Definition: st.c:423
SIZEOF_ST_INDEX_T
#define SIZEOF_ST_INDEX_T
Definition: st.h:59
i
uint32_t i
Definition: rb_mjit_min_header-2.7.0.h:5464
FALSE
#define FALSE
Definition: nkf.h:174
data_at
#define data_at(n)
PTR_EQUAL
#define PTR_EQUAL(tab, ptr, hash_val, key_)
Definition: st.c:180
key
key
Definition: openssl_missing.h:181
n
const char size_t n
Definition: rb_mjit_min_header-2.7.0.h:5456
DELETED_BIN
#define DELETED_BIN
Definition: st.c:385