diff options
author | Jan Hubicka <jh@suse.cz> | 2006-07-27 19:10:07 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2006-07-27 17:10:07 +0000 |
commit | 3050098b161a9f830a4f4d38154bf139584f7330 (patch) | |
tree | 14266ba8c54052b56789938ae15882d061451a22 | |
parent | 96d0cc8186a650f653ec0bb47168b3ccb6426ce2 (diff) | |
download | gcc-3050098b161a9f830a4f4d38154bf139584f7330.zip gcc-3050098b161a9f830a4f4d38154bf139584f7330.tar.gz gcc-3050098b161a9f830a4f4d38154bf139584f7330.tar.bz2 |
re PR middle-end/28071 (A file that can not be compiled in reasonable time/space)
PR rtl-optimization/28071
* hashtab.c (htab_empty): Clear out n_deleted/n_elements;
downsize the hashtable.
From-SVN: r115779
-rw-r--r-- | libiberty/ChangeLog | 6 | ||||
-rw-r--r-- | libiberty/hashtab.c | 23 |
2 files changed, 28 insertions, 1 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 00c3089..745a2f4 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,9 @@ +2006-07-27 Jan Hubicka <jh@suse.cz> + + PR rtl-optimization/28071 + * hashtab.c (htab_empty): Clear out n_deleted/n_elements; + downsize the hashtable. + 2006-07-04 Peter O'Gorman <peter@pogma.com> * Makefile.in: chmod 644 before ranlib during install. diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c index a5671a0..bf34a6d 100644 --- a/libiberty/hashtab.c +++ b/libiberty/hashtab.c @@ -421,7 +421,28 @@ htab_empty (htab_t htab) if (entries[i] != HTAB_EMPTY_ENTRY && entries[i] != HTAB_DELETED_ENTRY) (*htab->del_f) (entries[i]); - memset (entries, 0, size * sizeof (PTR)); + /* Instead of clearing megabyte, downsize the table. */ + if (size > 1024*1024 / sizeof (PTR)) + { + int nindex = higher_prime_index (1024 / sizeof (PTR)); + int nsize = prime_tab[nindex].prime; + + if (htab->free_f != NULL) + (*htab->free_f) (htab->entries); + else if (htab->free_with_arg_f != NULL) + (*htab->free_with_arg_f) (htab->alloc_arg, htab->entries); + if (htab->alloc_with_arg_f != NULL) + htab->entries = (PTR *) (*htab->alloc_with_arg_f) (htab->alloc_arg, nsize, + sizeof (PTR *)); + else + htab->entries = (PTR *) (*htab->alloc_f) (nsize, sizeof (PTR *)); + htab->size = nsize; + htab->size_prime_index = nindex; + } + else + memset (entries, 0, size * sizeof (PTR)); + htab->n_deleted = 0; + htab->n_elements = 0; } /* Similar to htab_find_slot, but without several unwanted side effects: |