aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils.c
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2022-10-18 09:33:38 +0200
committerMarc Poulhiès <poulhies@adacore.com>2022-11-07 09:36:36 +0100
commitbcb3f09ec6cb9b2c6e58243d05b5a0fc33e909f1 (patch)
tree4df5daefb657713802fe88277389dedcf84e9a63 /gcc/ada/gcc-interface/utils.c
parentdc3208e698b2f424d892d3c9e5d5562ccde9e4cf (diff)
downloadgcc-bcb3f09ec6cb9b2c6e58243d05b5a0fc33e909f1.zip
gcc-bcb3f09ec6cb9b2c6e58243d05b5a0fc33e909f1.tar.gz
gcc-bcb3f09ec6cb9b2c6e58243d05b5a0fc33e909f1.tar.bz2
ada: Tune hash function for cross-reference entries
Tune the hash function that combines entity identifiers with source locations of where those entities are referenced. Previously the source location was multiplied by 2 ** 7 (i.e. shifted left by 7 bits), then added to the entity identifier, and finally divided modulo 2 ** 16 (i.e. masked to only use the lowest 16 bits). This hash routine caused collisions that could make some tests up to twice slower. With a large entity number the source location was only contributing few bits to the hash value. This large entity number might correspond to entity like Ada.Characters.Latin_1.NUL that occurs thousands of times in generated code. gcc/ada/ * lib-xref.adb (Hash): Tune hash function.
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
0 files changed, 0 insertions, 0 deletions