aboutsummaryrefslogtreecommitdiff
path: root/gcc/hash-table.h
AgeCommit message (Collapse)AuthorFilesLines
2023-02-27don't declare header-defined functions both static and inline, cont.Patrick Palka1-1/+1
This fixes some header-defined functions that are undesirably declared static and weren't caught by the "^static inline" pattern used for the main patch r13-6096-gcb3e0eac262e55. gcc/ChangeLog: * hash-table.h (gt_pch_nx(hash_table<D>)): Remove static. * lra-int.h (lra_change_class): Likewise. * recog.h (which_op_alt): Likewise. * sel-sched-ir.h (sel_bb_empty_or_nop_p): Declare inline instead of static.
2023-02-16don't declare header-defined functions both static and inlinePatrick Palka1-3/+3
Many functions defined in our headers are declared 'static inline' which is a C idiom whose use predates our move to C++ as the implementation language. But in C++ the inline keyword is more than just a compiler hint, and is sufficient to give the function the intended semantics. In fact declaring a function both static and inline is a pessimization since static effectively disables the desired definition merging behavior enabled by inline, and is also a source of (harmless) ODR violations when a static inline function gets called from a non-static inline one (such as tree_operand_check calling tree_operand_length). This patch mechanically fixes the vast majority of occurrences of this anti-pattern throughout the compiler's headers via the command line sed -i 's/^static inline/inline/g' gcc/*.h gcc/*/*.h There's also a manual change to remove the redundant declarations of is_ivar and lookup_category in gcc/objc/objc-act.cc which would otherwise conflict with their modified definitions in objc-act.h (due to the difference in staticness). Besides fixing some ODR violations, this speeds up stage1 cc1plus by about 2% and reduces the size of its text segment by 1.5MB. gcc/ChangeLog: * addresses.h: Mechanically drop 'static' from 'static inline' functions via s/^static inline/inline/g. * asan.h: Likewise. * attribs.h: Likewise. * basic-block.h: Likewise. * bitmap.h: Likewise. * cfghooks.h: Likewise. * cfgloop.h: Likewise. * cgraph.h: Likewise. * cselib.h: Likewise. * data-streamer.h: Likewise. * debug.h: Likewise. * df.h: Likewise. * diagnostic.h: Likewise. * dominance.h: Likewise. * dumpfile.h: Likewise. * emit-rtl.h: Likewise. * except.h: Likewise. * expmed.h: Likewise. * expr.h: Likewise. * fixed-value.h: Likewise. * gengtype.h: Likewise. * gimple-expr.h: Likewise. * gimple-iterator.h: Likewise. * gimple-predict.h: Likewise. * gimple-range-fold.h: Likewise. * gimple-ssa.h: Likewise. * gimple.h: Likewise. * graphite.h: Likewise. * hard-reg-set.h: Likewise. * hash-map.h: Likewise. * hash-set.h: Likewise. * hash-table.h: Likewise. * hwint.h: Likewise. * input.h: Likewise. * insn-addr.h: Likewise. * internal-fn.h: Likewise. * ipa-fnsummary.h: Likewise. * ipa-icf-gimple.h: Likewise. * ipa-inline.h: Likewise. * ipa-modref.h: Likewise. * ipa-prop.h: Likewise. * ira-int.h: Likewise. * ira.h: Likewise. * lra-int.h: Likewise. * lra.h: Likewise. * lto-streamer.h: Likewise. * memmodel.h: Likewise. * omp-general.h: Likewise. * optabs-query.h: Likewise. * optabs.h: Likewise. * plugin.h: Likewise. * pretty-print.h: Likewise. * range.h: Likewise. * read-md.h: Likewise. * recog.h: Likewise. * regs.h: Likewise. * rtl-iter.h: Likewise. * rtl.h: Likewise. * sbitmap.h: Likewise. * sched-int.h: Likewise. * sel-sched-ir.h: Likewise. * sese.h: Likewise. * sparseset.h: Likewise. * ssa-iterators.h: Likewise. * system.h: Likewise. * target-globals.h: Likewise. * target.h: Likewise. * timevar.h: Likewise. * tree-chrec.h: Likewise. * tree-data-ref.h: Likewise. * tree-iterator.h: Likewise. * tree-outof-ssa.h: Likewise. * tree-phinodes.h: Likewise. * tree-scalar-evolution.h: Likewise. * tree-sra.h: Likewise. * tree-ssa-alias.h: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-manip.h: Likewise. * tree-ssa-loop.h: Likewise. * tree-ssa-operands.h: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa.h: Likewise. * tree-ssanames.h: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.h: Likewise. * tree-vectorizer.h: Likewise. * tree.h: Likewise. * wide-int.h: Likewise. gcc/c-family/ChangeLog: * c-common.h: Mechanically drop static from static inline functions via s/^static inline/inline/g. gcc/c/ChangeLog: * c-parser.h: Mechanically drop static from static inline functions via s/^static inline/inline/g. gcc/cp/ChangeLog: * cp-tree.h: Mechanically drop static from static inline functions via s/^static inline/inline/g. gcc/fortran/ChangeLog: * gfortran.h: Mechanically drop static from static inline functions via s/^static inline/inline/g. gcc/jit/ChangeLog: * jit-dejagnu.h: Mechanically drop static from static inline functions via s/^static inline/inline/g. * jit-recording.h: Likewise. gcc/objc/ChangeLog: * objc-act.h: Mechanically drop static from static inline functions via s/^static inline/inline/g. * objc-map.h: Likewise. * objc-act.cc: Remove the redundant redeclarations of is_ivar and lookup_category.
2023-01-13hash table: enforce testing is_empty before is_deletedAlexandre Oliva1-2/+14
Existing hash_table traits that use the same representation for empty and deleted slots reject marking slots as deleted, and to not pass is_deleted for slots that pass is_empty. Nevertheless, nearly everywhere, we only test for is_deleted after checking that !is_empty first. The one exception was the copy constructor, that would fail if traits recognized is_empty slots as is_deleted, but then refused to mark_deleted. This asymmetry is neither necessary nor desirable, and there is a theoretical risk that traits might not only fail to refuse to mark_deleted, but also return is_deleted for is_empty slots. This patch introduces checks that detect these potentially problematic situations, and reorders the tests in the copy constructor so as to use the conventional testing order and thus avoid them. for gcc/ChangeLog * hash-table.h (is_deleted): Precheck !is_empty. (mark_deleted): Postcheck !is_empty. (copy constructor): Test is_empty before is_deleted.
2023-01-12check hash table counts at expandAlexandre Oliva1-7/+28
Add cheap verification of element and deleted entry counts during expand and hash verify. for gcc/ChangeLog * hash-table.h (expand): Check elements and deleted counts. (verify): Likewise.
2023-01-02Update copyright years.Jakub Jelinek1-1/+1
2022-12-30check hash table insertionsAlexandre Oliva1-3/+60
I've noticed a number of potential problems in hash tables, of three kinds: insertion of entries that seem empty, dangling insertions, and lookups during insertions. These problems may all have the effect of replacing a deleted entry with one that seems empty, which may disconnect double-hashing chains involving that entry, and thus cause entries to go missing. This patch detects such problems by recording a pending insertion and checking that it's completed before other potentially-conflicting operations. The additional field is only introduced when checking is enabled. for gcc/ChnageLog * hash-table.h (check_complete_insertion, check_insert_slot): New hash_table methods. (m_inserting_slot): New hash_table field. (begin, hash_table ctors, ~hash_table): Check previous insert. (expand, empty_slow, clear_slot, find_with_hash): Likewise. (remote_elt_with_hash, traverse_noresize): Likewise. (gt_pch_nx): Likewise. (find_slot_with_hash): Likewise. Record requested insert.
2022-01-03Update copyright years.Jakub Jelinek1-1/+1
2021-12-09pch: Add support for relocation of the PCH data [PR71934]Jakub Jelinek1-1/+1
The following patch adds support for relocation of the PCH blob on PCH restore if we don't manage to get the preferred map slot for it. The GTY stuff knows where all the pointers are, after all it relocates it once during PCH save from the addresses where it was initially allocated to addresses in the preferred map slot. But, if we were to do it solely using GTY info upon PCH restore, we'd need another set of GTY functions, which I think would make it less maintainable and I think it would also be more costly at PCH restore time. Those functions would need to call something to add bias to pointers that haven't been marked yet and make sure not to add bias to any pointer twice. So, this patch instead builds a relocation table (sorted list of addresses in the blob which needs relocation) at PCH save time, stores it in a very compact form into the gch file and upon restore, adjusts pointers in GTY roots (that is right away in the root structures) and the addresses in the relocation table. The cost on stdc++.gch/O2g.gch (previously 85MB large) is about 3% file size growth, there are 2.5 million pointers that need relocation in the gch blob and the relocation table uses uleb128 for address deltas and needs ~1.01 bytes for one address that needs relocation, and about 20% compile time during PCH save (I think it is mainly because of the need to qsort those 2.5 million pointers). On PCH restore, if it doesn't need relocation (the usual case), it is just an extra fread of sizeof (size_t) data and fseek (in my tests real time on vanilla tree for #include <bits/stdc++.h> CU was ~0.175s and with the patch but no relocation ~0.173s), while if it needs relocation it took ~0.193s, i.e. 11.5% slower. Without PCH that #include <bits/stdc++.h> int i; testcase compiles with -O2 -g in ~1.199s, i.e. 6.2 times slower than PCH with relocation and 6.9 times than PCH without relocation. The discovery of the pointers in the blob that need relocation is done in the relocate_ptrs hook which does the pointer relocation during PCH save. Unfortunately, I had to make one change to the gengtype stuff due to the nested_ptr feature of GTY, which some libcpp headers and stringpool.c use. The relocate_ptrs hook had 2 arguments, pointer to the pointer and a cookie. When relocate_ptrs is done, in most cases it is called solely on the subfields of the current object, so e.g. if ((void *)(x) == this_obj) op (&((*x).u.fld[0].rt_rtx), cookie); so relocate_ptrs can assert that ptr_p is within the state->ptrs[state->ptrs_i]->obj .. state->ptrs[state->ptrs_i]->obj+state->ptrs[state->ptrs_i]->size-sizeof(void*) range and compute from that the address in the blob which will need relocation (state->ptrs[state->ptrs_i]->new_addr is the new address given to it and ptr_p-state->ptrs[state->ptrs_i]->obj is the relative offset. Unfortunately, for nested_ptr gengtype emits something like: { union tree_node * x0 = ((*x).val.node.node) ? HT_IDENT_TO_GCC_IDENT (HT_NODE (((*x).val.node.node))) : NULL; if ((void *)(x) == this_obj) op (&(x0), cookie); (*x).val.node.node = (x0) ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT ((x0))) : NULL; } so relocate_ptrs is called with an address of some temporary variable and so doesn't know where the pointer will finally be. So, I've added another argument to relocate_ptrs (and to gt_pointer_operator). For the most common case I pass NULL as the new middle argument to that function, first one remains pointer to the pointer that needs adjustment and last the cookie. The NULL seems to be cheap to compute and short in the gt*.[ch] files and stands for ptr_p is an address within the this_obj's range, remember its address. For the nested_ptr case, the new middle argument contains actual address of the pointer that might need to be relocated, so instead of the above op (&(x0), &((*x).val.node.node), cookie); in there. And finally, e.g. for the reorder case I need a way to tell restore_ptrs to ignore a particular address for the relocation purposes and only treat it the old way. I've used for that the case when the first and second arguments are equal. In order to enable support for mapping PCH as fallback at different addresses than the preferred ones, a small change is needed to the host pch_use_address hooks. One change I've done to all of them is the change of the type of the first argument from void * to void *&, such that the actual address can be told to the callers (or shall I instead use void **?), but another change that still needs to be done in them if they want the relocation is actually not fail if they couldn't get a preferred address, but instead modify what the first argument refers to. I've done that only for host-linux.c and Iain is testing similar change for host-darwin.c. Didn't change hpux, netbsd, openbsd, solaris, mingw32 or the fallbacks because I can't test those. Tested also with the: --- gcc/config/host-linux.c.jj 2021-12-06 22:22:42.007777367 +0100 +++ gcc/config/host-linux.c 2021-12-07 00:21:53.052674040 +0100 @@ -191,6 +191,8 @@ linux_gt_pch_use_address (void *&base, s if (size == 0) return -1; +base = (char *) base + ((size + 8191) & (size_t) -4096); + /* Try to map the file with MAP_PRIVATE. */ addr = mmap (base, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, offset); hack which forces all PCH restores to be relocated. An earlier version of the patch has been also regrest with base = (char *) base + 16384; in that spot, so both relocation to a non-overlapping spot and to an overlapping spot have been tested. 2021-12-09 Jakub Jelinek <jakub@redhat.com> PR pch/71934 * coretypes.h (gt_pointer_operator): Use 3 pointer arguments instead of two. * gengtype.c (struct walk_type_data): Add in_nested_ptr argument. (walk_type): Temporarily set d->in_nested_ptr around nested_ptr handling. (write_types_local_user_process_field): Pass a new middle pointer to gt_pointer_operator op calls, if d->in_nested_ptr pass there address of d->prev_val[2], otherwise NULL. (write_types_local_process_field): Likewise. * ggc-common.c (relocate_ptrs): Add real_ptr_p argument. If equal to ptr_p, do nothing, otherwise if NULL remember ptr_p's or if non-NULL real_ptr_p's corresponding new address in reloc_addrs_vec. (reloc_addrs_vec): New variable. (compare_ptr, read_uleb128, write_uleb128): New functions. (gt_pch_save): When iterating over objects through relocate_ptrs, save current i into state.ptrs_i. Sort reloc_addrs_vec and emit it as uleb128 of differences between pointer addresses into the PCH file. (gt_pch_restore): Allow restoring of PCH to a different address than the preferred one, in that case adjust global pointers by bias and also adjust by bias addresses read from the relocation table as uleb128 differences. Otherwise fseek over it. Perform gt_pch_restore_stringpool only after adjusting callbacks and for callback adjustments also take into account the bias. (default_gt_pch_use_address): Change type of first argument from void * to void *&. (mmap_gt_pch_use_address): Likewise. * ggc-tests.c (gt_pch_nx): Pass NULL as new middle argument to op. * hash-map.h (hash_map::pch_nx_helper): Likewise. (gt_pch_nx): Likewise. * hash-set.h (gt_pch_nx): Likewise. * hash-table.h (gt_pch_nx): Likewise. * hash-traits.h (ggc_remove::pch_nx): Likewise. * hosthooks-def.h (default_gt_pch_use_address): Change type of first argument from void * to void *&. (mmap_gt_pch_use_address): Likewise. * hosthooks.h (struct host_hooks): Change type of first argument of gt_pch_use_address hook from void * to void *&. * machmode.h (gt_pch_nx): Expect a callback with 3 pointers instead of two in the middle argument. * poly-int.h (gt_pch_nx): Likewise. * stringpool.c (gt_pch_nx): Pass NULL as new middle argument to op. * tree-cfg.c (gt_pch_nx): Likewise, except for LOCATION_BLOCK pass the same &(block) twice. * value-range.h (gt_pch_nx): Pass NULL as new middle argument to op. * vec.h (gt_pch_nx): Likewise. * wide-int.h (gt_pch_nx): Likewise. * config/host-darwin.c (darwin_gt_pch_use_address): Change type of first argument from void * to void *&. * config/host-darwin.h (darwin_gt_pch_use_address): Likewise. * config/host-hpux.c (hpux_gt_pch_use_address): Likewise. * config/host-linux.c (linux_gt_pch_use_address): Likewise. If it couldn't succeed to mmap at the preferred location, set base to the actual one. Update addr in the manual reading loop instead of base. * config/host-netbsd.c (netbsd_gt_pch_use_address): Change type of first argument from void * to void *&. * config/host-openbsd.c (openbsd_gt_pch_use_address): Likewise. * config/host-solaris.c (sol_gt_pch_use_address): Likewise. * config/i386/host-mingw32.c (mingw32_gt_pch_use_address): Likewise. * config/rs6000/rs6000-gen-builtins.c (write_init_file): Pass NULL as new middle argument to op in the generated code. * doc/gty.texi: Adjust samples for the addition of middle pointer to gt_pointer_operator callback. gcc/ada/ * gcc-interface/decl.c (gt_pch_nx): Pass NULL as new middle argument to op. gcc/c-family/ * c-pch.c (c_common_no_more_pch): Pass a temporary void * var with NULL value instead of NULL to host_hooks.gt_pch_use_address. gcc/c/ * c-decl.c (resort_field_decl_cmp): Pass the same pointer twice to resort_data.new_value. gcc/cp/ * module.cc (nop): Add another void * argument. * name-lookup.c (resort_member_name_cmp): Pass the same pointer twice to resort_data.new_value.
2021-09-17Fix 'hash_table::expand' to destruct stale Value objectsThomas Schwinge1-0/+3
Thus plugging potentional memory leaks if these have non-trivial constructor/destructor. See <https://stackoverflow.com/questions/6730403/how-to-delete-object-constructed-via-placement-new-operator> and others. As one example, compilation of 'g++.dg/warn/Wmismatched-tags.C' per 'valgrind --leak-check=full' improves as follows: [...] - -104 bytes in 1 blocks are definitely lost in loss record 399 of 519 - at 0x483DFAF: realloc (vg_replace_malloc.c:836) - by 0x223B62C: xrealloc (xmalloc.c:179) - by 0xA8D848: void va_heap::reserve<class_decl_loc_t::class_key_loc_t>(vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_embed>*&, unsigned int, bool) (vec.h:290) - by 0xA8B373: vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_ptr>::reserve(unsigned int, bool) (vec.h:1858) - by 0xA8B277: vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_ptr>::safe_push(class_decl_loc_t::class_key_loc_t const&) (vec.h:1967) - by 0xA57481: class_decl_loc_t::add_or_diag_mismatched_tag(tree_node*, tag_types, bool, bool) (parser.c:32967) - by 0xA573E1: class_decl_loc_t::add(cp_parser*, unsigned int, tag_types, tree_node*, bool, bool) (parser.c:32941) - by 0xA56C52: cp_parser_check_class_key(cp_parser*, unsigned int, tag_types, tree_node*, bool, bool) (parser.c:32819) - by 0xA3AD12: cp_parser_elaborated_type_specifier(cp_parser*, bool, bool) (parser.c:20227) - by 0xA37EF2: cp_parser_type_specifier(cp_parser*, int, cp_decl_specifier_seq*, bool, int*, bool*) (parser.c:18942) - by 0xA31CDD: cp_parser_decl_specifier_seq(cp_parser*, int, cp_decl_specifier_seq*, int*) (parser.c:15517) - by 0xA43C71: cp_parser_parameter_declaration(cp_parser*, int, bool, bool*) (parser.c:24242) - -168 bytes in 3 blocks are definitely lost in loss record 422 of 519 - at 0x483DFAF: realloc (vg_replace_malloc.c:836) - by 0x223B62C: xrealloc (xmalloc.c:179) - by 0xA8D848: void va_heap::reserve<class_decl_loc_t::class_key_loc_t>(vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_embed>*&, unsigned int, bool) (vec.h:290) - by 0xA8B373: vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_ptr>::reserve(unsigned int, bool) (vec.h:1858) - by 0xA8B277: vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_ptr>::safe_push(class_decl_loc_t::class_key_loc_t const&) (vec.h:1967) - by 0xA57481: class_decl_loc_t::add_or_diag_mismatched_tag(tree_node*, tag_types, bool, bool) (parser.c:32967) - by 0xA573E1: class_decl_loc_t::add(cp_parser*, unsigned int, tag_types, tree_node*, bool, bool) (parser.c:32941) - by 0xA56C52: cp_parser_check_class_key(cp_parser*, unsigned int, tag_types, tree_node*, bool, bool) (parser.c:32819) - by 0xA3AD12: cp_parser_elaborated_type_specifier(cp_parser*, bool, bool) (parser.c:20227) - by 0xA37EF2: cp_parser_type_specifier(cp_parser*, int, cp_decl_specifier_seq*, bool, int*, bool*) (parser.c:18942) - by 0xA31CDD: cp_parser_decl_specifier_seq(cp_parser*, int, cp_decl_specifier_seq*, int*) (parser.c:15517) - by 0xA53385: cp_parser_single_declaration(cp_parser*, vec<deferred_access_check, va_gc, vl_embed>*, bool, bool, bool*) (parser.c:31072) - -488 bytes in 7 blocks are definitely lost in loss record 449 of 519 - at 0x483DFAF: realloc (vg_replace_malloc.c:836) - by 0x223B62C: xrealloc (xmalloc.c:179) - by 0xA8D848: void va_heap::reserve<class_decl_loc_t::class_key_loc_t>(vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_embed>*&, unsigned int, bool) (vec.h:290) - by 0xA8B373: vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_ptr>::reserve(unsigned int, bool) (vec.h:1858) - by 0xA8B277: vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_ptr>::safe_push(class_decl_loc_t::class_key_loc_t const&) (vec.h:1967) - by 0xA57481: class_decl_loc_t::add_or_diag_mismatched_tag(tree_node*, tag_types, bool, bool) (parser.c:32967) - by 0xA573E1: class_decl_loc_t::add(cp_parser*, unsigned int, tag_types, tree_node*, bool, bool) (parser.c:32941) - by 0xA56C52: cp_parser_check_class_key(cp_parser*, unsigned int, tag_types, tree_node*, bool, bool) (parser.c:32819) - by 0xA3AD12: cp_parser_elaborated_type_specifier(cp_parser*, bool, bool) (parser.c:20227) - by 0xA37EF2: cp_parser_type_specifier(cp_parser*, int, cp_decl_specifier_seq*, bool, int*, bool*) (parser.c:18942) - by 0xA31CDD: cp_parser_decl_specifier_seq(cp_parser*, int, cp_decl_specifier_seq*, int*) (parser.c:15517) - by 0xA49508: cp_parser_member_declaration(cp_parser*) (parser.c:26440) - -728 bytes in 7 blocks are definitely lost in loss record 455 of 519 - at 0x483B7F3: malloc (vg_replace_malloc.c:309) - by 0x223B63F: xrealloc (xmalloc.c:177) - by 0xA8D848: void va_heap::reserve<class_decl_loc_t::class_key_loc_t>(vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_embed>*&, unsigned int, bool) (vec.h:290) - by 0xA8B373: vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_ptr>::reserve(unsigned int, bool) (vec.h:1858) - by 0xA57508: class_decl_loc_t::add_or_diag_mismatched_tag(tree_node*, tag_types, bool, bool) (parser.c:32980) - by 0xA573E1: class_decl_loc_t::add(cp_parser*, unsigned int, tag_types, tree_node*, bool, bool) (parser.c:32941) - by 0xA56C52: cp_parser_check_class_key(cp_parser*, unsigned int, tag_types, tree_node*, bool, bool) (parser.c:32819) - by 0xA48BC6: cp_parser_class_head(cp_parser*, bool*) (parser.c:26090) - by 0xA4674B: cp_parser_class_specifier_1(cp_parser*) (parser.c:25302) - by 0xA47D76: cp_parser_class_specifier(cp_parser*) (parser.c:25680) - by 0xA37E27: cp_parser_type_specifier(cp_parser*, int, cp_decl_specifier_seq*, bool, int*, bool*) (parser.c:18912) - by 0xA31CDD: cp_parser_decl_specifier_seq(cp_parser*, int, cp_decl_specifier_seq*, int*) (parser.c:15517) - -832 bytes in 8 blocks are definitely lost in loss record 458 of 519 - at 0x483B7F3: malloc (vg_replace_malloc.c:309) - by 0x223B63F: xrealloc (xmalloc.c:177) - by 0xA8D848: void va_heap::reserve<class_decl_loc_t::class_key_loc_t>(vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_embed>*&, unsigned int, bool) (vec.h:290) - by 0xA901ED: bool vec_safe_reserve<class_decl_loc_t::class_key_loc_t, va_heap>(vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_embed>*&, unsigned int, bool) (vec.h:697) - by 0xA8F161: void vec_alloc<class_decl_loc_t::class_key_loc_t, va_heap>(vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_embed>*&, unsigned int) (vec.h:718) - by 0xA8D18D: vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_embed>::copy() const (vec.h:979) - by 0xA8B0C3: vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_ptr>::copy() const (vec.h:1824) - by 0xA896B1: class_decl_loc_t::operator=(class_decl_loc_t const&) (parser.c:32697) - by 0xA571FD: class_decl_loc_t::add(cp_parser*, unsigned int, tag_types, tree_node*, bool, bool) (parser.c:32899) - by 0xA56C52: cp_parser_check_class_key(cp_parser*, unsigned int, tag_types, tree_node*, bool, bool) (parser.c:32819) - by 0xA3AD12: cp_parser_elaborated_type_specifier(cp_parser*, bool, bool) (parser.c:20227) - by 0xA37EF2: cp_parser_type_specifier(cp_parser*, int, cp_decl_specifier_seq*, bool, int*, bool*) (parser.c:18942) - -1,144 bytes in 11 blocks are definitely lost in loss record 466 of 519 - at 0x483B7F3: malloc (vg_replace_malloc.c:309) - by 0x223B63F: xrealloc (xmalloc.c:177) - by 0xA8D848: void va_heap::reserve<class_decl_loc_t::class_key_loc_t>(vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_embed>*&, unsigned int, bool) (vec.h:290) - by 0xA901ED: bool vec_safe_reserve<class_decl_loc_t::class_key_loc_t, va_heap>(vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_embed>*&, unsigned int, bool) (vec.h:697) - by 0xA8F161: void vec_alloc<class_decl_loc_t::class_key_loc_t, va_heap>(vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_embed>*&, unsigned int) (vec.h:718) - by 0xA8D18D: vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_embed>::copy() const (vec.h:979) - by 0xA8B0C3: vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_ptr>::copy() const (vec.h:1824) - by 0xA896B1: class_decl_loc_t::operator=(class_decl_loc_t const&) (parser.c:32697) - by 0xA571FD: class_decl_loc_t::add(cp_parser*, unsigned int, tag_types, tree_node*, bool, bool) (parser.c:32899) - by 0xA56C52: cp_parser_check_class_key(cp_parser*, unsigned int, tag_types, tree_node*, bool, bool) (parser.c:32819) - by 0xA48BC6: cp_parser_class_head(cp_parser*, bool*) (parser.c:26090) - by 0xA4674B: cp_parser_class_specifier_1(cp_parser*) (parser.c:25302) - -1,376 bytes in 10 blocks are definitely lost in loss record 467 of 519 - at 0x483DFAF: realloc (vg_replace_malloc.c:836) - by 0x223B62C: xrealloc (xmalloc.c:179) - by 0xA8D848: void va_heap::reserve<class_decl_loc_t::class_key_loc_t>(vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_embed>*&, unsigned int, bool) (vec.h:290) - by 0xA8B373: vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_ptr>::reserve(unsigned int, bool) (vec.h:1858) - by 0xA8B277: vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_ptr>::safe_push(class_decl_loc_t::class_key_loc_t const&) (vec.h:1967) - by 0xA57481: class_decl_loc_t::add_or_diag_mismatched_tag(tree_node*, tag_types, bool, bool) (parser.c:32967) - by 0xA573E1: class_decl_loc_t::add(cp_parser*, unsigned int, tag_types, tree_node*, bool, bool) (parser.c:32941) - by 0xA56C52: cp_parser_check_class_key(cp_parser*, unsigned int, tag_types, tree_node*, bool, bool) (parser.c:32819) - by 0xA3AD12: cp_parser_elaborated_type_specifier(cp_parser*, bool, bool) (parser.c:20227) - by 0xA37EF2: cp_parser_type_specifier(cp_parser*, int, cp_decl_specifier_seq*, bool, int*, bool*) (parser.c:18942) - by 0xA31CDD: cp_parser_decl_specifier_seq(cp_parser*, int, cp_decl_specifier_seq*, int*) (parser.c:15517) - by 0xA301E0: cp_parser_simple_declaration(cp_parser*, bool, tree_node**) (parser.c:14772) - -3,552 bytes in 33 blocks are definitely lost in loss record 483 of 519 - at 0x483B7F3: malloc (vg_replace_malloc.c:309) - by 0x223B63F: xrealloc (xmalloc.c:177) - by 0xA8D848: void va_heap::reserve<class_decl_loc_t::class_key_loc_t>(vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_embed>*&, unsigned int, bool) (vec.h:290) - by 0xA901ED: bool vec_safe_reserve<class_decl_loc_t::class_key_loc_t, va_heap>(vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_embed>*&, unsigned int, bool) (vec.h:697) - by 0xA8F161: void vec_alloc<class_decl_loc_t::class_key_loc_t, va_heap>(vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_embed>*&, unsigned int) (vec.h:718) - by 0xA8D18D: vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_embed>::copy() const (vec.h:979) - by 0xA8B0C3: vec<class_decl_loc_t::class_key_loc_t, va_heap, vl_ptr>::copy() const (vec.h:1824) - by 0xA8964A: class_decl_loc_t::class_decl_loc_t(class_decl_loc_t const&) (parser.c:32689) - by 0xA8F515: hash_table<hash_map<tree_decl_hash, class_decl_loc_t, simple_hashmap_traits<default_hash_traits<tree_decl_hash>, class_decl_loc_t> >::hash_entry, false, xcallocator>::expand() (hash-table.h:839) - by 0xA8D4B3: hash_table<hash_map<tree_decl_hash, class_decl_loc_t, simple_hashmap_traits<default_hash_traits<tree_decl_hash>, class_decl_loc_t> >::hash_entry, false, xcallocator>::find_slot_with_hash(tree_node* const&, unsigned int, insert_option) (hash-table.h:1008) - by 0xA8B1DC: hash_map<tree_decl_hash, class_decl_loc_t, simple_hashmap_traits<default_hash_traits<tree_decl_hash>, class_decl_loc_t> >::get_or_insert(tree_node* const&, bool*) (hash-map.h:200) - by 0xA57128: class_decl_loc_t::add(cp_parser*, unsigned int, tag_types, tree_node*, bool, bool) (parser.c:32888) [...] LEAK SUMMARY: - definitely lost: 8,440 bytes in 81 blocks + definitely lost: 48 bytes in 1 blocks indirectly lost: 12,529 bytes in 329 blocks possibly lost: 0 bytes in 0 blocks still reachable: 1,644,376 bytes in 768 blocks gcc/ * hash-table.h (hash_table<Descriptor, Lazy, Allocator>::expand): Destruct stale Value objects. * hash-map-tests.c (test_map_of_type_with_ctor_and_dtor_expand): Update.
2021-01-04Update copyright years.Jakub Jelinek1-1/+1
2020-09-24add move CTOR to auto_vec, use auto_vec for get_loop_exit_edgesRichard Biener1-1/+1
This adds a move CTOR to auto_vec<T, 0> and makes use of a auto_vec<edge> return value for get_loop_exit_edges denoting that lifetime management of the vector is handed to the caller. The move CTOR prompted the hash_table change because it appearantly makes the copy CTOR implicitely deleted (good) and hash-table expansion of the odr_enum_map which is hash_map <nofree_string_hash, odr_enum> where odr_enum has an auto_vec<odr_enum_val, 0> member triggers this. Not sure if there's a latent bug there before this (I think we're not invoking DTORs, but we're invoking copy-CTORs). 2020-08-06 Richard Biener <rguenther@suse.de> * vec.h (auto_vec<T, 0>::auto_vec (auto_vec &&)): New move CTOR. (auto_vec<T, 0>::operator=(auto_vec &&)): Delete. * hash-table.h (hash_table::expand): Use std::move when expanding. * cfgloop.h (get_loop_exit_edges): Return auto_vec<edge>. * cfgloop.c (get_loop_exit_edges): Adjust. * cfgloopmanip.c (fix_loop_placement): Likewise. * ipa-fnsummary.c (analyze_function_body): Likewise. * ira-build.c (create_loop_tree_nodes): Likewise. (create_loop_tree_node_allocnos): Likewise. (loop_with_complex_edge_p): Likewise. * ira-color.c (ira_loop_edge_freq): Likewise. * loop-unroll.c (analyze_insns_in_loop): Likewise. * predict.c (predict_loops): Likewise. * tree-predcom.c (last_always_executed_block): Likewise. * tree-ssa-loop-ch.c (ch_base::copy_headers): Likewise. * tree-ssa-loop-im.c (store_motion_loop): Likewise. * tree-ssa-loop-ivcanon.c (loop_edge_to_cancel): Likewise. (canonicalize_loop_induction_variables): Likewise. * tree-ssa-loop-manip.c (get_loops_exits): Likewise. * tree-ssa-loop-niter.c (find_loop_niter): Likewise. (finite_loop_p): Likewise. (find_loop_niter_by_eval): Likewise. (estimate_numbers_of_iterations): Likewise. * tree-ssa-loop-prefetch.c (emit_mfence_after_loop): Likewise. (may_use_storent_in_loop_p): Likewise.
2020-05-20c++: spec_hasher and TYPENAME_TYPE resolution [PR95223]Patrick Palka1-7/+7
After enabling sanitization of the specialization tables, we are triggering one of the hash table sanity checks in the below testcase. The reason is that when looking up the specialization j<int> in the type_specializations table, the sanity check finds that the existing entry j<n<t>::m> compares equal to j<int> but hashes differently. The discrepancy is due to structural_comptypes looking through TYPENAME_TYPEs (via resolve_typename_type), something which iterative_hash_template_arg doesn't do. So the TYPENAME_TYPE n<t>::m is considered equal to int, but the hashes of these two template arguments are different. It seems wrong for the result of a specialization table lookup to depend on the current scope, so this patch makes structural_comptypes avoid calling resolve_typename_type when comparing_specializations. In order for the below testcase to deterministically trigger the sanitization error without this patch, we also need to fix the location of the call to hash_table::verify within hash_table::find_with_hash. gcc/ChangeLog: PR c++/95223 * hash-table.h (hash_table::find_with_hash): Move up the call to hash_table::verify. gcc/cp/ChangeLog: PR c++/95223 * typeck.c (structural_comptypes): Don't perform context-dependent resolution of TYPENAME_TYPEs when comparing_specializations. gcc/testsuite/ChangeLog: PR c++/95223 * g++.dg/template/typename23.C: New test.
2020-01-14hash-table.h: support non-zero empty values in empty_slow (v2)David Malcolm1-3/+7
gcc/cp/ChangeLog: * cp-gimplify.c (source_location_table_entry_hash::empty_zero_p): New static constant. * cp-tree.h (named_decl_hash::empty_zero_p): Likewise. (struct named_label_hash::empty_zero_p): Likewise. * decl2.c (mangled_decl_hash::empty_zero_p): Likewise. gcc/ChangeLog: * attribs.c (excl_hash_traits::empty_zero_p): New static constant. * gcov.c (function_start_pair_hash::empty_zero_p): Likewise. * graphite.c (struct sese_scev_hash::empty_zero_p): Likewise. * hash-map-tests.c (selftest::test_nonzero_empty_key): New selftest. (selftest::hash_map_tests_c_tests): Call it. * hash-map-traits.h (simple_hashmap_traits::empty_zero_p): New static constant, using the value of = H::empty_zero_p. (unbounded_hashmap_traits::empty_zero_p): Likewise, using the value from default_hash_traits <Value>. * hash-map.h (hash_map::empty_zero_p): Likewise, using the value from Traits. * hash-set-tests.c (value_hash_traits::empty_zero_p): Likewise. * hash-table.h (hash_table::alloc_entries): Guard the loop of calls to mark_empty with !Descriptor::empty_zero_p. (hash_table::empty_slow): Conditionalize the memset call with a check that Descriptor::empty_zero_p; otherwise, loop through the entries calling mark_empty on them. * hash-traits.h (int_hash::empty_zero_p): New static constant. (pointer_hash::empty_zero_p): Likewise. (pair_hash::empty_zero_p): Likewise. * ipa-devirt.c (default_hash_traits <type_pair>::empty_zero_p): Likewise. * ipa-prop.c (ipa_bit_ggc_hash_traits::empty_zero_p): Likewise. (ipa_vr_ggc_hash_traits::empty_zero_p): Likewise. * profile.c (location_triplet_hash::empty_zero_p): Likewise. * sanopt.c (sanopt_tree_triplet_hash::empty_zero_p): Likewise. (sanopt_tree_couple_hash::empty_zero_p): Likewise. * tree-hasher.h (int_tree_hasher::empty_zero_p): Likewise. * tree-ssa-sccvn.c (vn_ssa_aux_hasher::empty_zero_p): Likewise. * tree-vect-slp.c (bst_traits::empty_zero_p): Likewise. * tree-vectorizer.h (default_hash_traits<scalar_cond_masked_key>::empty_zero_p): Likewise.
2020-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r279813
2019-12-09PR middle-end/92761 - hash_table::expand invokes assignment on invalid objectsMartin Sebor1-10/+3
PR middle-end/92761 - hash_table::expand invokes assignment on invalid objects PR middle-end/92762 - hash_table::empty_slow invokes assignment on invalid objects gcc/ChangeLog: PR middle-end/92761 PR middle-end/92762 * hash-map-tests.c (test_map_of_type_with_ctor_and_dtor): Tighten up tests. * hash-table.h (hash_table::expand): Use placement new to copy construct objects in uninitialized storage. (hash_table::empty_slow): Avoid invoking copy assignment on uninitialized objects. From-SVN: r279139
2019-10-04hash-table.h (hash_table::empty_slow): Don't assign size_t values to int ↵Bernd Edlinger1-4/+4
variables. 2019-10-04 Bernd Edlinger <bernd.edlinger@hotmail.de> * hash-table.h (hash_table::empty_slow): Don't assign size_t values to int variables. From-SVN: r276592
2019-07-01PR middle-end/90923 - hash_map destroys elements without constructing themMartin Sebor1-4/+10
gcc/ChangeLog: PR middle-end/90923 * hash-map.h (hash_map::put): On insertion invoke element ctor. (hash_map::get_or_insert): Same. Reformat comment. * hash-set.h (hash_set::add): On insertion invoke element ctor. * hash-map-tests.c (test_map_of_type_with_ctor_and_dtor): New. * hash-set-tests.c (test_map_of_type_with_ctor_and_dtor): New. * hash-table.h (hash_table::operator=): Prevent copy assignment. (hash_table::hash_table (const hash_table&)): Use copy ctor instead of assignment to copy elements. From-SVN: r272893
2019-06-25Put hashtab_chk_error into hash-table.c.Martin Liska1-12/+2
2019-06-25 Martin Liska <mliska@suse.cz> * hash-table.c (hashtab_chk_error): Move here from ... * hash-table.h (hashtab_chk_error): ... here. From-SVN: r272655
2019-06-11Disable htable sanitization in pt.c (PR c++/87847).Martin Liska1-2/+2
2019-06-11 Martin Liska <mliska@suse.cz> PR c++/87847 * hash-table.h: Extend create_gcc, add one parameter that is passed into hash_table::hash_table. 2019-06-11 Martin Liska <mliska@suse.cz> PR c++/87847 * pt.c (init_template_processing): Disable hash table sanitization for decl_specializations and type_specializations. From-SVN: r272144
2019-06-10Fix build with --enable-gather-detailed-mem-stats.Martin Liska1-1/+1
2019-06-10 Martin Liska <mliska@suse.cz> * hash-map.h: Pass default value to hash_table ctor. * hash-table.h: Add default value to call of a ctor. From-SVN: r272104
2019-06-07Enable sanitization for hash tables.Martin Liska1-4/+56
2019-06-07 Martin Liska <mliska@suse.cz> * cselib.c (cselib_init): Disable hash table sanitization. * hash-set.h: Pass new default argument to m_table. * hash-table.c: Add global variable with hash table sanitization limit. * hash-table.h (Allocator>::hash_table): Add new argument to ctor. (hashtab_chk_error): New. * params.def (PARAM_HASH_TABLE_VERIFICATION_LIMIT): New. * toplev.c (process_options): Set hash_table_sanitize_eq_limit from the PARAM_HASH_TABLE_VERIFICATION_LIMIT value. From-SVN: r272038
2019-05-03Come up with is_empty for hash_{table,map,set}.Martin Liska1-0/+3
2019-05-03 Martin Liska <mliska@suse.cz> * hash-map.h: Add is_empty function. * hash-set.h: Likewise. * hash-table.h: Likewise. * dwarf2out.c (dwarf2out_finish): Use is_empty instead of elements () == 0 (and similar usages). * gimple-ssa-store-merging.c (pass_store_merging::terminate_and_process_all_chains): Likewise. * gimplify.c (gimplify_bind_expr): Likewise. (gimplify_switch_expr): Likewise. * hash-map-tests.c (test_map_of_strings_to_int): Likewise. * ipa-icf.c (sem_item_optimizer::remove_symtab_node): Likewise. * postreload-gcse.c (dump_hash_table): Likewise. (gcse_after_reload_main): Likewise. * predict.c (combine_predictions_for_bb): Likewise. * tree-parloops.c (reduction_phi): Likewise. (separate_decls_in_region): Likewise. (transform_to_exit_first_loop): Likewise. (gen_parallel_loop): Likewise. (gather_scalar_reductions): Likewise. (try_create_reduction_list): Likewise. * var-tracking.c (dump_vars): Likewise. (emit_notes_for_changes): Likewise. (vt_emit_notes): Likewise. 2019-05-03 Martin Liska <mliska@suse.cz> * call.c (build_aggr_conv): Use is_empty instead of elements () == 0 (and similar usages). * parser.c (cp_parser_lambda_introducer): Likewise. From-SVN: r270851
2019-03-26hash-table.h (hash_table::m_gather_mem_stats): If GATHER_STATISTICS is ↵Jakub Jelinek1-5/+16
constant 0... * hash-table.h (hash_table::m_gather_mem_stats): If GATHER_STATISTICS is constant 0, turn into static const data member initialized to false. (hash_table::hash_table): Only initialize m_gather_mem_stats #if GATHER_STATISTICS. Add ATTRIBUTE_UNUSED to gather_mem_stats param. From-SVN: r269944
2019-03-26mem-stats.h (mem_alloc_description::unregister_descriptor): New method.Jason Merrill1-5/+6
* mem-stats.h (mem_alloc_description::unregister_descriptor): New method. (mem_alloc_description::release_object_overhead): Fix comment typos. * hash-table.h (hash_table::~hash_table): Call release_instance_overhead only if m_entries is non-NULL, otherwise call unregister_descriptor. Co-Authored-By: Jakub Jelinek <jakub@redhat.com> From-SVN: r269943
2019-03-21hash-table.h (hash_table): Add Lazy template parameter defaulted to false...Jakub Jelinek1-75/+125
* hash-table.h (hash_table): Add Lazy template parameter defaulted to false, if true, don't alloc_entries during construction, but defer it to the first method that needs m_entries allocated. (hash_table::hash_table, hash_table::~hash_table, hash_table::alloc_entries, hash_table::find_empty_slot_for_expand, hash_table::too_empty_p, hash_table::expand, hash_table::empty_slow, hash_table::clear_slot, hash_table::traverse_noresize, hash_table::traverse, hash_table::iterator::slide): Adjust all methods. * hash-set.h (hash_set): Add Lazy template parameter defaulted to false. (hash_set::contains): If Lazy is true, use find_slot_with_hash with NO_INSERT instead of find_with_hash. (hash_set::traverse, hash_set::iterator, hash_set::iterator::m_iter, hash_set::m_table): Add Lazy to template params of hash_table. (gt_ggc_mx, gt_pch_nx): Use false as Lazy in hash_set template param. * attribs.c (test_attribute_exclusions): Likewise. * hash-set-tests.c (test_set_of_strings): Add iterator tests for hash_set. Add tests for hash_set with Lazy = true. c-family/ * c-common.c (per_file_includes_t): Use false as Lazy in hash_set template param. jit/ * jit-recording.c (reproducer::m_set_identifiers): Use false as Lazy in hash_set template param. From-SVN: r269859
2019-03-14hash-table.h (remove_elt_with_hash): Return if slot is NULL rather than if ↵Jason Merrill1-1/+1
is_empty (*slot). * hash-table.h (remove_elt_with_hash): Return if slot is NULL rather than if is_empty (*slot). * hash-set-tests.c (test_set_of_strings): Add tests for addition of existing elt and for elt removal. * hash-map-tests.c (test_map_of_strings_to_int): Add test for removal of already removed elt. * hashtab.c (htab_remove_elt_with_hash): Return if slot is NULL rather than if *slot is HTAB_EMPTY_ENTRY. Co-Authored-By: Jakub Jelinek <jakub@redhat.com> From-SVN: r269695
2019-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r267494
2018-09-14Fix --enable-gather-detailed-mem-stats.Jason Merrill1-6/+6
* hash-table.c (hash_table_usage): Change from variable to function. * hash-table.h: Adjust. * Makefile.in: Add missing dependencies on hash-table.h. From-SVN: r264313
2018-02-16re PR bootstrap/84405 (Fails to bootstrap with GCC 4.1.2, GCC 4.2.4)Jakub Jelinek1-0/+4
PR bootstrap/84405 * system.h (BROKEN_VALUE_INITIALIZATION): Define for GCC < 4.3. * vec.h (vec_default_construct): Use memset instead of placement new if BROKEN_VALUE_INITIALIZATION is defined. * hash-table.h (hash_table<Descriptor, Allocator>::empty_slow): Use memset instead of value initialization if BROKEN_VALUE_INITIALIZATION is defined. From-SVN: r257726
2018-01-03Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r256169
2017-11-14Support GTY((cache)) on hash_map.Jason Merrill1-3/+4
gcc/ * hash-traits.h (ggc_remove): Add ggc_maybe_mx member function. (ggc_cache_remove): Override it instead of ggc_mx. * hash-table.h (gt_ggc_mx): Call it instead of ggc_mx. (gt_cleare_cache): Call ggc_mx instead of gt_ggc_mx. * hash-map-traits.h (simple_hashmap_traits): Add maybe_mx member. (simple_cache_map_traits): Override maybe_mx. * hash-map.h (hash_entry): Add ggc_maybe_mx and keep_cache_entry. (hash_map): Friend gt_cleare_cache. (gt_cleare_cache): New. * tree.h (tree_cache_traits): New hash_map traits class. (tree_cache_map): New typedef. gcc/cp/ * decl.c (decomp_type_table): Use tree_cache_map. * init.c (nsdmi_inst): Likewise. * pt.c (defarg_ints): Likewise. * cp-objcp-common.c (cp_get_debug_type): Likewise. From-SVN: r254731
2017-07-03* hash-table.h (hash_table_mod1): Fix indentation.Nathan Sidwell1-1/+1
From-SVN: r249925
2017-06-15PR c++/80560 - warn on undefined memory operations involving non-trivial typesMartin Sebor1-1/+4
gcc/c-family/ChangeLog: PR c++/80560 * c.opt (-Wclass-memaccess): New option. gcc/cp/ChangeLog: PR c++/80560 * call.c (first_non_public_field, maybe_warn_class_memaccess): New functions. (has_trivial_copy_assign_p, has_trivial_copy_p): Ditto. (build_cxx_call): Call maybe_warn_class_memaccess. gcc/ChangeLog: PR c++/80560 * dumpfile.c (dump_register): Avoid calling memset to initialize a class with a default ctor. * gcc.c (struct compiler): Remove const qualification. * genattrtab.c (gen_insn_reserv): Replace memset with initialization. * hash-table.h: Ditto. * ipa-cp.c (allocate_and_init_ipcp_value): Replace memset with assignment. * ipa-prop.c (ipa_free_edge_args_substructures): Ditto. * omp-low.c (lower_omp_ordered_clauses): Replace memset with default ctor. * params.h (struct param_info): Make struct members non-const. * tree-switch-conversion.c (emit_case_bit_tests): Replace memset with default initialization. * vec.h (vec_copy_construct, vec_default_construct): New helper functions. (vec<T>::copy, vec<T>::splice, vec<T>::reserve): Replace memcpy with vec_copy_construct. (vect<T>::quick_grow_cleared): Replace memset with default ctor. (vect<T>::vec_safe_grow_cleared, vec_safe_grow_cleared): Same. * doc/invoke.texi (-Wclass-memaccess): Document. libcpp/ChangeLog: PR c++/80560 * line-map.c (line_maps::~line_maps): Avoid calling htab_delete with a null pointer. (linemap_init): Avoid calling memset on an object of a non-trivial type. libitm/ChangeLog: PR c++/80560 * beginend.cc (GTM::gtm_thread::rollback): Avoid calling memset on an object of a non-trivial type. (GTM::gtm_transaction_cp::commit): Use assignment instead of memcpy to copy an object. * method-ml.cc (orec_iterator::reinit): Avoid -Wclass-memaccess. gcc/testsuite/ChangeLog: PR c++/80560 * g++.dg/Wclass-memaccess.C: New test. From-SVN: r249234
2017-01-13Avoid excessively-big hash tables in empty-add cyclesRichard Sandiford1-5/+20
A big source of cache misses when compiling a recent version of gimple-match.ii was the call to cv_cache.empty () in clear_cv_cache. The problem was that at one early point the hash table had grown to 8191 entries (128k on LP64 hosts). It then stayed at that size for the rest of the compilation, even though subsequent uses needed only a small number of entries (usually fewer than ten). We would still clear the whole 128k each time clear_cv_cache was called. empty() already looks for cases where the hash table is very big and cuts it down. At the moment it fires when the table is 1M in size and reduces it to the next selected prime above 1K (so almost 2K in practice). One fix would have been to lower the threshold, but that didn't feel like the right approach. Reducing the current limit of 1M by a factor of 8 would be pretty significant on its own, but I think this cv_cache behaviour would have been a problem even with 64k or 32k tables. I think the existing check is really for cases in which even a well-populated table would need to be shrunk rather than cleared. Here the problem isn't that the table is excessively big in absolute terms, more that one outlier has made the table much too big for the general case. traverse() already shrinks the table if it's "too empty", which is taken to be if: no. elements * 8 < capacity && capacity > 32 So an alternative would be to apply the same test (and the same choice of shrunken size) to empty_slow too. The patch below does this. It gives a 2.5% improvement in gimple-match.ii compile time at -O0 -g and doesn't seem to adversely affect any other tests I've tried. Of course, there's a theoretical risk of a table alternating between one large element count and one small element count. If there was a factor of eight difference between the two, we could shrink the table on seeing each small element count, then grow it again when adding the large number of elements. That seems pretty unlikely in practice though. Also, empty_slow() does involve a traversal if some form of manual gc is needed on active elements, so trying to recover from an outlier should have even more benefit there. (cv_cache uses automatic gc and so the traversal gets optimised away.) The calculation of the existing 1M threshold was assuming that each entry was pointer-sized. This patch makes it use the actual size of the entry instead. Tested on aarch64-linux-gnu and x86_64-linux-gnu. gcc/ * hash-table.h (hash_table::too_empty_p): New function. (hash_table::expand): Use it. (hash_table::traverse): Likewise. (hash_table::empty_slot): Use sizeof (value_type) instead of sizeof (PTR) to convert bytes to elements. Shrink the table if the current size is excessive for the current number of elements. From-SVN: r244447
2017-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r243994
2016-01-16Optimise hash_table::emptyRichard Sandiford1-3/+7
Calling redirect_edge_var_map_empty after each pass was slowing things down because hash_table::empty () cleared all slots even if the hash table was already empty. Tested on x86_64-linux-gnu, where it gives a 1% compile time improvement for fold-const.ii at -O and -O2. gcc/ * hash-table.h (hash_table::empty): Turn into an inline wrapper that checks whether the table is already empty. Rename the original implementation to... (hash_table::empty_slot): ...this new private function. From-SVN: r232467
2016-01-04Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r232055
2015-12-15* hash-map.h, hash-table.h: Make copy constructors explicit.Jason Merrill1-4/+4
From-SVN: r231658
2015-12-14re PR c++/68309 (ICE: Segmentation fault)Jason Merrill1-0/+33
PR c++/68309 gcc/ * hash-table.h: Add copy constructor. * hash-map.h: Add copy constructor. gcc/cp/ * pt.c (instantiate_decl): Copy local_specializations for nested function. From-SVN: r231632
2015-12-11hash-map.h (hash_map::hash_map): Gather statistics only when ↵Michael Matz1-2/+4
GATHER_STATISTICS is true. * hash-map.h (hash_map::hash_map): Gather statistics only when GATHER_STATISTICS is true. * hash-set.h (hash_set::hash_set): Ditto. * hash-table.h (hash_table::hash_table): Ditto. (hash_table::create_ggc): Ditto. From-SVN: r231560
2015-10-27[PATCH 7/9] ENABLE_CHECKING refactoring: middle-end, LTO FEMikhail Maltsev1-4/+0
[PATCH 7/9] ENABLE_CHECKING refactoring: middle-end, LTO FE gcc/lto/ChangeLog: 2015-10-27 Mikhail Maltsev <maltsevm@gmail.com> * lto.c (unify_scc): Use flag_checking and remove ENABLE_CHECKING conditionals. (lto_fixup_state): Likewise. (do_whole_program_analysis): Use symtab_node::checking_verify_symtab_nodes and remove ENABLE_CHECKING conditionals. gcc/ChangeLog: 2015-10-27 Mikhail Maltsev <maltsevm@gmail.com> * attribs.c (check_attribute_tables): New function, broken out from... (init_attributes): Use it. * cfgcleanup.c (try_optimize_cfg): Use flag_checking, CHECKING_P gcc_checking_assert and checking_* functions to eliminate ENABLE_CHECKING conditionals. * cfgexpand.c (expand_goto, expand_debug_expr): Likewise. (pass_expand::execute): Likewise. * cgraphclones.c (symbol_table::materialize_all_clones): Likewise. * cgraphunit.c (mark_functions_to_output): Likewise. (cgraph_node::expand_thunk): Likewise. (symbol_table::compile): Likewise. * ddg.c (add_cross_iteration_register_deps): Likewise. (create_ddg_all_sccs): Likewise. * df-core.c (df_finish_pass, df_analyze): Likewise. * diagnostic-core.h: Likewise. * diagnostic.c (diagnostic_report_diagnostic): Likewise. * dominance.c (calculate_dominance_info): Likewise. * dwarf2out.c (add_AT_die_ref): Likewise. (const_ok_for_output_1, mem_loc_descriptor): Likewise. (loc_list_from_tree, gen_lexical_block_die): Likewise. gen_type_die_with_usage, gen_type_die): Likewise. (dwarf2out_decl): Likewise. * emit-rtl.c (verify_rtx_sharing, reorder_insns_nobb): Likewise. * except.c (duplicate_eh_regions): Likewise. * fwprop.c (register_active_defs, update_df_init): Likewise. (fwprop_init, fwprop_done): Likewise. (update_uses): Likewise. * ggc-page.c (ggc_grow): Likewise. * gimplify.c (gimplify_body): Likewise. (gimplify_hasher::equal): Likewise. * graphite-isl-ast-to-gimple.c (graphite_verify): Likewise. * graphite-scop-detection.c (canonicalize_loop_closed_ssa_form): Likewise. * graphite-sese-to-poly.c (rewrite_reductions_out_of_ssa): Likewise. (rewrite_cross_bb_scalar_deps_out_of_ssa): Likwise. * hash-table.h (::find_empty_slot_for_expand): Likewise. * ifcvt.c (if_convert): Likewise. * ipa-cp.c (ipcp_propagate_stage): Likewise. * ipa-devirt.c (type_in_anonymous_namespace_p): Likewise. (odr_type_p, odr_types_equivalent_p): Likewise. (add_type_duplicate, get_odr_type): Likewise. * ipa-icf.c (sem_item_optimizer::execute): Likewise. (sem_item_optimizer::subdivide_classes_by_equality): Likewise. (sem_item_optimizer::verify_classes): Likewise. (sem_item_optimizer::traverse_congruence_split): Likewise. (sem_item_optimizer::checking_verify_classes): New. * ipa-icf.h (sem_item_optimizer::checking_verify_classes): Add new method. * cfgrtl.c (commit_edge_insertions): Likewise. (fixup_reorder_chain, cfg_layout_finalize): Likewise. (rtl_flow_call_edges_add): Likewise. * cgraph.c (symbol_table::create_edge): Likewise. (cgraph_edge::redirect_call_stmt_to_callee): Likewise. * cgraph.h (symtab_node): Likewise. (symtab_node::checking_verify_symtab_nodes): Define. (cgraph_node::checking_verify_cgraph_nodes): Define. * cfghooks.h (checking_verify_flow_info): Define. * cfgloop.h (checking_verify_loop_structure): Define. * dominance.h (checking_verify_dominators): Define. * et-forest.c: Fix comment. * ipa-inline-analysis.c (compute_inline_parameters): Use flag_checking, CHECKING_P gcc_checking_assert and checking_* functions to eliminate ENABLE_CHECKING conditionals. * ipa-inline-transform.c (save_inline_function_body): Likewise. * ipa-inline.c (inline_small_functions): Likewise. (early_inliner): Likewise. * ipa-inline.h (estimate_edge_growth): Likewise. * ipa-visibility.c (function_and_variable_visibility): Likewise. * ipa.c (symbol_table::remove_unreachable_nodes): Likewise. (ipa_single_use): Likewise. * ira-int.h: Likewise. * ira.c (ira): Likewise. * loop-doloop.c (doloop_optimize_loops): Likewise. * loop-init.c (loop_optimizer_init, fix_loop_structure): Likewise. * loop-invariant.c (move_loop_invariants): Likewise. * lra-assigns.c (lra_assign): Likewise. * lra-constraints.c (lra_constraints): Likewise. * lra-eliminations.c (lra_eliminate): Likewise. * lra-int.h (struct lra_reg): Likewise. * lra-lives.c (check_pseudos_live_through_calls): Likewise. (lra_create_live_ranges_1): Likewise. * lra-remat.c (create_remat_bb_data): Likewise. * lra.c (lra_update_insn_recog_data, restore_scratches): Likewise. (lra): Likewise. (check_rtl): Always define. Remove incorrect guard around extract_constrain_insn call. * lto-cgraph.c (input_cgraph_1: Use flag_checking, CHECKING_P gcc_checking_assert and checking_* functions to eliminate ENABLE_CHECKING conditionals. * lto-streamer-out.c (DFS::DFS): Likewise. (lto_output): Likewise. * lto-streamer.c (lto_streamer_init): Likewise. * omp-low.c (scan_omp_target, expand_omp_taskreg): Likewise. expand_omp_target, execute_expand_omp): Likewise. (lower_omp_target): Likewise. * passes.c (execute_function_todo): Likewise. (execute_todo, execute_one_pass): Likewise. (verify_curr_properties): Always define. * predict.c (tree_estimate_probability: Use flag_checking, CHECKING_P gcc_checking_assert and checking_* functions to eliminate ENABLE_CHECKING conditionals. (propagate_freq): Likewise. * pretty-print.c (pp_format): Likewise. * real.c (real_to_decimal_for_mode): Likewise. * recog.c (split_all_insns): Likewise. * regcprop.c (kill_value_one_regno): Likewise. (copy_value): Likewise. (validate_value_data): Define unconditionally. * reload.c: Fix comment. * timevar.c: Include options.h * tree-ssa.h (checking_verify_ssa): Define. * tree-ssa-loop-manip.h (checking_verify_loop_closed_ssa): Define. * sched-deps.c (CHECK): Remove unused macro. (add_or_update_dep_1, sd_add_dep: Use flag_checking, CHECKING_P gcc_checking_assert and checking_* functions to eliminate ENABLE_CHECKING conditionals. * sel-sched-ir.c (free_regset_pool, tidy_control_flow): Likewise. * sel-sched.c (struct moveop_static_params): Likewise. (find_best_reg_for_expr, move_cond_jump): Likewise. (move_op_orig_expr_not_found): Likewise. (code_motion_process_successors, move_op): Likewise. * ssa-iterators.h (first_readonly_imm_use): Likewise. (next_readonly_imm_use): Likewise. * store-motion.c (compute_store_table): Likewise. * symbol-summary.h (function_summary::function_summary): Likewise. * target.h (cumulative_args_t): Likewise. (get_cumulative_args, pack_cumulative_args): Likewise. * timevar.c: (timer::print): Likewise. * trans-mem.c (ipa_tm_execute): Likewise. * tree-cfg.c (move_stmt_op): Likewise. (move_sese_region_to_fn): Likewise. (gimple_flow_call_edges_add): Likewise. * tree-cfgcleanup.c (cleanup_tree_cfg_noloop, repair_loop_structures): Likewise. * tree-eh.c (remove_unreachable_handlers): Likewise. * tree-if-conv.c (pass_if_conversion::execute): Likewise. * tree-inline.c (expand_call_inline, optimize_inline_calls): Likewise. * tree-into-ssa.c (update_ssa): Likewise. * tree-loop-distribution.c (pass_loop_distribution::execute): Likewise. * tree-outof-ssa.c (eliminate_useless_phis, rewrite_trees): Likewise. * tree-parloops.c (pass_parallelize_loops::execute): Likewise. * tree-predcom.c (suitable_component_p): Likewise. * tree-profile.c (gimple_gen_const_delta_profiler): Likewise. * tree-ssa-alias.c (refs_may_alias_p_1): Likewise. * tree-ssa-live.c (verify_live_on_entry): Likewise. * tree-ssa-live.h (register_ssa_partition): Likewise. * tree-ssa-loop-ivcanon.c (tree_unroll_loops_completely): Likewise. * tree-ssa-loop-manip.c (add_exit_phi): Likewise. (tree_transform_and_unroll_loop): Likewise. * tree-ssa-math-opts.c (pass_cse_reciprocals::execute): Likewise. * tree-ssa-operands.c (get_expr_operands): Likewise. * tree-ssa-propagate.c (replace_exp_1): Likewise. * tree-ssa-structalias.c (rewrite_constraints): Likewise. * tree-ssa-ter.c (free_temp_expr_table): Likewise. * tree-ssa-threadupdate.c (duplicate_thread_path): Likewise. * tree-ssanames.c (release_ssa_name_fn): Likewise. * tree-stdarg.c (expand_ifn_va_arg): Likewise. * tree-vect-loop-manip.c (slpeel_tree_duplicate_loop_to_edge_cfg): Likewise. (slpeel_checking_verify_cfg_after_peeling): Likewise. (vect_do_peeling_for_loop_bound): Likewise. (vect_do_peeling_for_alignment): Likewise. * tree-vrp.c (supports_overflow_infinity): Likewise. (set_value_range): Likewise. * tree.c (free_lang_data_in_cgraph): Likewise. * value-prof.c (gimple_remove_histogram_value): Likewise. (free_hist): Likewise. * var-tracking.c (canonicalize_values_star): Likewise. (compute_bb_dataflow, vt_find_locations, vt_emit_notes): Likewise. From-SVN: r229470
2015-07-13Fix double word typos.Aldy Hernandez1-1/+1
From-SVN: r225726
2015-06-25hash-table.h: Update comments.Richard Sandiford1-30/+33
gcc/ * hash-table.h: Update comments. From-SVN: r224965
2015-06-25hash-table.h (has_is_deleted, [...]): Delete.Richard Sandiford1-128/+13
gcc/ * hash-table.h (has_is_deleted, is_deleted_helper): Delete. (has_is_empty, is_empty_helper): Delete. (has_mark_deleted, mark_deleted_helper): Delete. (has_mark_empty, mark_empty_helper): Delete. (hash_table::is_deleted): Call the Descriptor unconditionally. (hash_table::is_empty): Likewise. (hash_table::mark_deleted): Likewise. (hash_table::mark_empty): Likewise. From-SVN: r224962
2015-06-25hash-traits.h (ggc_cache_hasher): Rename to...Richard Sandiford1-1/+8
gcc/ * hash-traits.h (ggc_cache_hasher): Rename to... (ggc_cache_remove): ...this and remove typedefs. (ggc_cache_ptr_hash): New class. * hash-table.h: Update commentary. * emit-rtl.c (const_int_hasher): Inherit from ggc_cache_ptr_hash rather than ggc_cache_hasher. (const_wide_int_hasher, reg_attr_hasher): Likewise. (const_double_hasher, const_fixed_hasher): Likewise. * function.c (insn_cache_hasher): Likewise. * trans-mem.c (tm_wrapper_hasher): Likewise. * tree.h (tree_decl_map_cache_hasher): Likewise. * tree.c (type_cache_hasher, int_cst_hasher): Likewise. (cl_option_hasher, tree_vec_map_cache_hasher): Likewise. * ubsan.c (tree_type_map_cache_hasher): Likewise. * varasm.c (tm_clone_hasher): Likewise. * config/i386/i386.c (dllimport_hasher): Likewise. * config/nvptx/nvptx.c (declared_libfunc_hasher): Likewise. (tree_hasher): Likewise. gcc/ada/ * gcc-interface/decl.c (value_annotation_hasher): Inherit from ggc_cache_ptr_hash rather than ggc_cache_hasher. * gcc-interface/utils.c (pad_type_hasher): Likewise. From-SVN: r224960
2015-06-25hash-traits.h (ggc_hasher): Rename to...Richard Sandiford1-2/+7
gcc/ * hash-traits.h (ggc_hasher): Rename to... (ggc_remover): ...this and remove typedefs. (ggc_cache_hasher): Update accordingly. Add typedefs. (ggc_ptr_hash): New class. * hash-table.h: Update comment. * cfgloop.h (loop_exit_hasher): Inherit from ggc_ptr_hash rather than ggc_hasher. * cgraph.h (section_name_hasher, cgraph_edge_hasher): Likewise. (tree_descriptor_hasher): Likewise. * cgraph.c (function_version_hasher): Likewise. * dwarf2out.c (indirect_string_hasher, dwarf_file_hasher): Likewise. (decl_die_hasher, block_die_hasher, decl_loc_hasher): Likewise. (dw_loc_list_hasher, addr_hasher): Likewise. * function.h (used_type_hasher): Likewise. * function.c (temp_address_hasher): Likewise. * gimple-ssa.h (tm_restart_hasher, ssa_name_hasher): Likewise. * libfuncs.h (libfunc_hasher): Likewise. * lto-streamer.h (decl_state_hasher): Likewise. * optabs.c (libfunc_decl_hasher): Likewise. * tree-scalar-evolution.c (scev_info_hasher): Likewise. * varasm.c (section_hasher, object_block_hasher): Likewise. (const_rtx_desc_hasher): Likewise. * config/darwin.c (indirection_hasher, cfstring_hasher): Likewise. * config/rs6000/rs6000.c (toc_hasher, builtin_hasher): Likewise. gcc/c-family/ * c-common.c (c_type_hasher): Inherit from ggc_ptr_hash rather than ggc_hasher. gcc/cp/ * constexpr.c (constexpr_fundef_hasher): Inherit from ggc_ptr_hash rather than ggc_hasher. (constexpr_call_hasher): Likewise. * cp-tree.h (cxx_int_tree_map_hasher, named_label_hasher): Likewise. * decl.c (typename_hasher): Likewise. * mangle.c (conv_type_hasher): Likewise. * pt.c (spec_hasher): Likewise. * tree.c (cplus_array_hasher, list_hasher): Likewise. * typeck2.c (abstract_type_hasher): Likewise. gcc/fortran/ * trans-decl.c (module_hasher): Likewise. * trans.h (module_decl_hasher): Likewise. gcc/java/ * java-tree.h (treetreehasher): Inherit from ggc_ptr_hash rather than ggc_hasher. (ict_hasher, type_assertion_hasher): Likewise. gcc/objc/ * objc-act.c (objc_string_hasher): Inherit from ggc_ptr_hash rather than ggc_hasher. From-SVN: r224959
2015-06-25hash-table.h: Update comments.Richard Sandiford1-4/+2
gcc/ * hash-table.h: Update comments. * hash-traits.h (pointer_hash): Don't inherit from typed_noop_remove. (nofree_ptr_hash): New class. * asan.c (asan_mem_ref_hasher): Inherit from nofree_ptr_hash rather than typed_noop_remove. Remove redudant typedefs. * attribs.c (attribute_hasher): Likewise. * cfg.c (bb_copy_hasher): Likewise. * cselib.c (cselib_hasher): Likewise. * dse.c (invariant_group_base_hasher): Likewise. * dwarf2cfi.c (trace_info_hasher): Likewise. * dwarf2out.c (macinfo_entry_hasher): Likewise. (comdat_type_hasher, loc_list_hasher): Likewise. * gcse.c (pre_ldst_expr_hasher): Likewise. * genmatch.c (id_base): Likewise. * genrecog.c (test_pattern_hasher): Likewise. * gimple-ssa-strength-reduction.c (cand_chain_hasher): Likewise. * haifa-sched.c (delay_i1_hasher): Likewise. * hard-reg-set.h (simplifiable_subregs_hasher): Likewise. * ipa-icf.h (congruence_class_group_hash): Likewise. * ipa-profile.c (histogram_hash): Likewise. * ira-color.c (allocno_hard_regs_hasher): Likewise. * lto-streamer.h (string_slot_hasher): Likewise. * lto-streamer.c (tree_entry_hasher): Likewise. * plugin.c (event_hasher): Likewise. * postreload-gcse.c (expr_hasher): Likewise. * store-motion.c (st_expr_hasher): Likewise. * tree-sra.c (uid_decl_hasher): Likewise. * tree-ssa-coalesce.c (coalesce_pair_hasher): Likewise. (ssa_name_var_hash): Likewise. * tree-ssa-live.c (tree_int_map_hasher): Likewise. * tree-ssa-loop-im.c (mem_ref_hasher): Likewise. * tree-ssa-pre.c (pre_expr_d): Likewise. * tree-ssa-sccvn.c (vn_nary_op_hasher): Likewise. * vtable-verify.h (registration_hasher): Likewise. * vtable-verify.c (vtbl_map_hasher): Likewise. * config/arm/arm.c (libcall_hasher): Likewise. * config/i386/winnt.c (wrapped_symbol_hasher): Likewise. * config/ia64/ia64.c (bundle_state_hasher): Likewise. * config/sol2.c (comdat_entry_hasher): Likewise. * fold-const.c (fold): Use nofree_ptr_hash instead of pointer_hash. (print_fold_checksum, fold_checksum_tree): Likewise. (debug_fold_checksum, fold_build1_stat_loc): Likewise. (fold_build2_stat_loc, fold_build3_stat_loc): Likewise. (fold_build_call_array_loc): Likewise. * tree-ssa-ccp.c (gimple_htab): Likewise. * tree-browser.c (tree_upper_hasher): Inherit from nofree_ptr_hash rather than pointer_type. gcc/c/ * c-decl.c (detect_field_duplicates_hash): Use nofree_ptr_hash instead of pointer_hash. (detect_field_duplicates): Likewise. gcc/cp/ * class.c (fixed_type_or_null_ref_ht): Inherit from nofree_ptr_hash rather than pointer_hash. (fixed_type_or_null): Use nofree_ptr_hash instead of pointer_hash. * semantics.c (nrv_data): Likewise. * tree.c (verify_stmt_tree_r, verify_stmt_tree): Likewise. gcc/java/ * jcf-io.c (charstar_hash): Inherit from nofree_ptr_hash rather than typed_noop_remove. Remove redudant typedefs. gcc/lto/ * lto.c (tree_scc_hasher): Inherit from nofree_ptr_hash rather than typed_noop_remove. Remove redudant typedefs. gcc/objc/ * objc-act.c (decl_name_hash): Inherit from nofree_ptr_hash rather than typed_noop_remove. Remove redudant typedefs. libcc1/ * plugin.cc (string_hasher): Inherit from nofree_ptr_hash rather than typed_noop_remove. Remove redudant typedefs. (plugin_context): Use nofree_ptr_hash rather than pointer_hash. (plugin_context::mark): Likewise. From-SVN: r224957
2015-06-25decl.c (value_annotation_hasher::handle_cache_entry): Delete.Richard Sandiford1-3/+23
gcc/ada/ * gcc-interface/decl.c (value_annotation_hasher::handle_cache_entry): Delete. (value_annotation_hasher::keep_cache_entry): New function. * gcc-interface/utils.c (pad_type_hasher::handle_cache_entry): Delete. (pad_type_hasher::keep_cache_entry): New function. gcc/ * hash-table.h (hash_table): Add gt_cleare_cache as a friend. (gt_cleare_cache): Check here for deleted and empty entries. Replace handle_cache_entry with a call to keep_cache_entry. * hash-traits.h (ggc_cache_hasher::handle_cache_entry): Delete. (ggc_cache_hasher::keep_cache_entry): New function. * trans-mem.c (tm_wrapper_hasher::handle_cache_entry): Delete. (tm_wrapper_hasher::keep_cache_entry): New function. * tree.h (tree_decl_map_cache_hasher::handle_cache_entry): Delete. (tree_vec_map_cache_hasher::keep_cache_entry): New function. * tree.c (type_cache_hasher::handle_cache_entry): Delete. (type_cache_hasher::keep_cache_entry): New function. (tree_vec_map_cache_hasher::handle_cache_entry): Delete. (tree_vec_map_cache_hasher::keep_cache_entry): New function. * ubsan.c (tree_type_map_cache_hasher::handle_cache_entry): Delete. (tree_type_map_cache_hasher::keep_cache_entry): New function. * varasm.c (tm_clone_hasher::handle_cache_entry): Delete. (tm_clone_hasher::keep_cache_entry): New function. * config/i386/i386.c (dllimport_hasher::handle_cache_entry): Delete. (dllimport_hasher::keep_cache_entry): New function. From-SVN: r224954
2015-06-25hash-table.h: Include hash-traits.h.Richard Sandiford1-138/+2
gcc/ * hash-table.h: Include hash-traits.h. (typed_free_remove, typed_noop_remove, pointer_hash, ggc_hasher) (ggc_cache_hasher): Move to... * hash-traits.h: ...this new file. From-SVN: r224953
2015-06-10Fix BITMAP identifier clash.Martin Liska1-2/+2
PR bootstrap/66471 * mem-stats-traits.h (enum mem_alloc_origin): Add _ORIGIN suffix for all enum values in mem_alloc_origin. * alloc-pool.c (dump_alloc_pool_statistics): Use newly changed enum name. * alloc-pool.h (pool_allocator::pool_allocator): Likewise. * bitmap.c (bitmap_register): Likewise. (dump_bitmap_statistics): Likewise. * ggc-common.c (dump_ggc_loc_statistics): Likewise. (ggc_record_overhead): Likewise. * hash-map.h: Likewise. * hash-set.h: Likewise. * hash-table.c (void dump_hash_table_loc_statistics): Likewise. * hash-table.h: Likewise. * vec.c (vec_prefix::register_overhead): Likewise. (vec_prefix::release_overhead): Likewise. (dump_vec_loc_statistics): Likewise. From-SVN: r224315