|
| | hash_table (size_t, bool ggc=false, bool sanitize_eq_and_hash=true, bool gather_mem_stats=GATHER_STATISTICS, mem_alloc_origin origin=HASH_TABLE_ORIGIN CXX_MEM_STAT_INFO) |
| | hash_table (const hash_table &, bool ggc=false, bool sanitize_eq_and_hash=true, bool gather_mem_stats=GATHER_STATISTICS, mem_alloc_origin origin=HASH_TABLE_ORIGIN CXX_MEM_STAT_INFO) |
| | ~hash_table () |
| size_t | size () const |
| size_t | elements () const |
| size_t | elements_with_deleted () const |
| void | empty () |
| bool | is_empty () const |
| void | clear_slot (value_type *) |
| value_type & | find_with_hash (const compare_type &, hashval_t) |
| value_type & | find (const value_type &value) |
| value_type * | find_slot (const value_type &value, insert_option insert) |
| value_type * | find_slot_with_hash (const compare_type &comparable, hashval_t hash, enum insert_option insert) |
| void | remove_elt_with_hash (const compare_type &, hashval_t) |
| void | remove_elt (const value_type &value) |
| template<typename Argument, int(*)(value_type *slot, Argument argument) Callback> |
| void | traverse_noresize (Argument argument) |
| template<typename Argument, int(*)(value_type *slot, Argument argument) Callback> |
| void | traverse (Argument argument) |
| iterator | begin () const |
| iterator | end () const |
| double | collisions () const |
| void | check_complete_insertion () const |
|
| template<typename T> |
| void | gt_ggc_mx (hash_table< T > *) |
| template<typename T> |
| void | gt_pch_nx (hash_table< T > *) |
| template<typename T> |
| void | hashtab_entry_note_pointers (void *obj, void *h, gt_pointer_operator op, void *cookie) |
| template<typename T, typename U, typename V> |
| void | gt_pch_nx (hash_map< T, U, V > *, gt_pointer_operator, void *) |
| template<typename T, typename U> |
| void | gt_pch_nx (hash_set< T, false, U > *, gt_pointer_operator, void *) |
| template<typename T> |
| void | gt_pch_nx (hash_table< T > *, gt_pointer_operator, void *) |
| template<typename T> |
| void | gt_cleare_cache (hash_table< T > *) |
template<typename Descriptor,
bool Lazy = false, template< typename Type > class Allocator = xcallocator>
class hash_table< Descriptor, Lazy, Allocator >
User-facing hash table type.
The table stores elements of type Descriptor::value_type and uses
the static descriptor functions described at the top of the file
to hash, compare and remove elements.
Specify the template Allocator to allocate and free memory.
The default is xcallocator.
Storage is an implementation detail and should not be used outside the
hash table code.
template<typename Descriptor,
bool Lazy, template< typename Type > class Allocator>
| void hash_table< Descriptor, Lazy, Allocator >::expand |
( |
| ) |
|
|
private |
The following function changes size of memory allocated for the
entries and repeatedly inserts the table elements. The occupancy
of the table after the call will be about 50%. Naturally the hash
table must already exist. Remember also that the place of the
table entries is changed. If memory allocation fails, this function
will abort.
References alloc_entries(), check_complete_insertion(), elements(), find_empty_slot_for_expand(), gcc_checking_assert, ggc_free(), hash_table_higher_prime_index(), hash_table_usage(), is_deleted(), is_empty(), m_entries, m_gather_mem_stats, m_ggc, m_n_deleted, m_n_elements, m_size, m_size_prime_index, prime_tab, size(), and too_empty_p().
Referenced by find_slot_with_hash(), and traverse().
template<typename Descriptor,
bool Lazy, template< typename Type > class Allocator>
Similar to find_slot, but without several unwanted side effects:
- Does not call equal when it finds an existing entry.
- Does not change the count of elements/searches/collisions in the
hash table.
This function also assumes there are no deleted entries in the table.
HASH is the hash value for the element to be inserted.
References find_empty_slot_for_expand(), gcc_checking_assert, hash_table_mod1(), hash_table_mod2(), is_deleted(), is_empty(), m_entries, m_size, m_size_prime_index, and size().
Referenced by expand(), and find_empty_slot_for_expand().
template<typename Descriptor,
bool Lazy, template< typename Type > class Allocator>
This function searches for a hash table slot containing an entry
equal to the given COMPARABLE element and starting with the given
HASH. To delete an entry, call this with insert=NO_INSERT, then
call clear_slot on the slot returned (possibly after doing some
checks). To insert an entry, call this with insert=INSERT, then
write the value you want into the returned slot. When inserting an
entry, NULL may be returned if memory allocation fails.
References alloc_entries(), check_complete_insertion(), check_insert_slot(), expand(), hash_table_mod1(), hash_table_mod2(), insert(), is_deleted(), is_empty(), m_collisions, m_entries, m_n_deleted, m_n_elements, m_sanitize_eq_and_hash, m_searches, m_size, m_size_prime_index, mark_empty(), NULL, size(), and verify().
Referenced by add_ttypes_entry(), find_coalesce_pair(), find_or_insert_inv(), hash_table< decl_table_entry_hasher >::find_slot(), force_const_mem(), move_sese_region_to_fn(), notify_dependents_of_changed_value(), optimize_constant_pool(), register_scoped_attribute(), remove_elt_with_hash(), separate_decls_in_region_debug(), separate_decls_in_region_name(), shared_hash_find_slot_1(), shared_hash_find_slot_noinsert_1(), shared_hash_find_slot_unshare_1(), and vars_copy().
template<typename Descriptor,
bool Lazy, template< typename Type > class Allocator>
This function searches for a hash table entry equal to the given
COMPARABLE element starting with the given HASH value. It cannot
be used to insert or delete an element.
References alloc_entries(), check_complete_insertion(), hash_table_mod1(), hash_table_mod2(), is_deleted(), is_empty(), m_collisions, m_entries, m_sanitize_eq_and_hash, m_searches, m_size, m_size_prime_index, NULL, size(), and verify().
Referenced by dataflow_set_different(), emit_notes_for_differences_1(), emit_notes_for_differences_2(), hash_table< decl_table_entry_hasher >::find(), find_loc_in_1pdv(), find_mem_expr_in_1pdv(), loc_exp_insert_dep(), notify_dependents_of_changed_value(), notify_dependents_of_resolved_value(), shared_hash_find_1(), and vt_expand_loc_callback().
template<typename Descriptor,
bool Lazy, template< typename Type > class Allocator>
template<typename Argument, int(*)(typename
hash_table< Descriptor, Lazy, Allocator >
::value_type *
slot, Argument argument) Callback>
| void hash_table< Descriptor, Lazy, Allocator >::traverse |
( |
Argument | argument | ) |
|
Like traverse_noresize, but does resize the table when it is too empty
to improve effectivity of subsequent calls.
References elements(), expand(), m_entries, too_empty_p(), and traverse().
Referenced by btf_collect_translated_types(), clobber_overlapping_mems(), compute_bb_dataflow(), create_call_for_reduction(), create_final_loads_for_reduction(), ctf_preprocess(), dataflow_post_merge_adjust(), dataflow_set_clear_at_call(), dump_vars(), emit_notes_for_differences(), gather_scalar_reductions(), gen_parallel_loop(), separate_decls_in_region(), traverse(), vt_emit_notes(), and vt_find_locations().
template<typename Descriptor,
bool Lazy, template< typename Type > class Allocator>
template<typename Argument, int(*)(typename
hash_table< Descriptor, Lazy, Allocator >
::value_type *
slot, Argument argument) Callback>
| void hash_table< Descriptor, Lazy, Allocator >::traverse_noresize |
( |
Argument | argument | ) |
|
template<typename Descriptor,
bool Lazy, template< typename Type > class Allocator>
Verify that all existing elements in the hash table which are
equal to COMPARABLE have an equal HASH value provided as argument.
Also check that the hash table element counts are correct.
References gcc_checking_assert, hash_table_sanitize_eq_limit, hashtab_chk_error(), i, is_deleted(), is_empty(), m_entries, m_n_deleted, m_n_elements, m_size, and MIN.
Referenced by find_slot_with_hash(), and find_with_hash().