Mercurial > hg > CbC > CbC_gcc
comparison gcc/hash-table.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* A type-safe hash table template. | 1 /* A type-safe hash table template. |
2 Copyright (C) 2012-2017 Free Software Foundation, Inc. | 2 Copyright (C) 2012-2018 Free Software Foundation, Inc. |
3 Contributed by Lawrence Crowl <crowl@google.com> | 3 Contributed by Lawrence Crowl <crowl@google.com> |
4 | 4 |
5 This file is part of GCC. | 5 This file is part of GCC. |
6 | 6 |
7 GCC is free software; you can redistribute it and/or modify it under | 7 GCC is free software; you can redistribute it and/or modify it under |
96 gcc_assert (n <= prime_tab[low].prime); | 96 gcc_assert (n <= prime_tab[low].prime); |
97 | 97 |
98 return low; | 98 return low; |
99 } | 99 } |
100 | 100 |
101 mem_alloc_description<mem_usage> hash_table_usage; | 101 /* Return a reference to the lazily initialized hash-table usage description. |
102 This needs to be a function rather than a simple global variable so that it | |
103 is reliably initialized before hash table variables in other files such as | |
104 sem_item::m_type_hash_cache. */ | |
105 mem_alloc_description<mem_usage>& | |
106 hash_table_usage () | |
107 { | |
108 static mem_alloc_description<mem_usage> usage; | |
109 return usage; | |
110 } | |
102 | 111 |
103 /* Support function for statistics. */ | 112 /* Support function for statistics. */ |
104 void dump_hash_table_loc_statistics (void) | 113 void dump_hash_table_loc_statistics (void) |
105 { | 114 { |
106 if (!GATHER_STATISTICS) | 115 if (!GATHER_STATISTICS) |
107 return; | 116 return; |
108 | 117 |
109 for (unsigned i = HASH_TABLE_ORIGIN; i <= HASH_SET_ORIGIN; i++) | 118 for (unsigned i = HASH_TABLE_ORIGIN; i <= HASH_SET_ORIGIN; i++) |
110 { | 119 { |
111 mem_alloc_origin origin = (mem_alloc_origin) i; | 120 mem_alloc_origin origin = (mem_alloc_origin) i; |
112 hash_table_usage.dump (origin); | 121 hash_table_usage ().dump (origin); |
113 } | 122 } |
114 } | 123 } |
115 |