aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/UpdateTestChecks/common.py
diff options
context:
space:
mode:
authorSchrodinger ZHU Yifan <yifanzhu@rochester.edu>2023-12-05 12:06:48 -0500
committerGitHub <noreply@github.com>2023-12-05 09:06:48 -0800
commit86e99e11e50da254ddaf73fbb9ea24028756bdd7 (patch)
treeeb437ca8eec6d601ae4770357ba802e8e38ea7e1 /llvm/utils/UpdateTestChecks/common.py
parent67f9b5ae7d7a256a547d97386d67e9a55fc3fe6a (diff)
downloadllvm-86e99e11e50da254ddaf73fbb9ea24028756bdd7.zip
llvm-86e99e11e50da254ddaf73fbb9ea24028756bdd7.tar.gz
llvm-86e99e11e50da254ddaf73fbb9ea24028756bdd7.tar.bz2
[libc] [search] improve hsearch robustness (#73896)
Following up the discussion at https://github.com/llvm/llvm-project/pull/73469#discussion_r1409593911 by @nickdesaulniers. According to FreeBSD implementation (https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/upstream-freebsd/lib/libc/stdlib/hcreate.c), `hsearch` is able to handle the cases where the global table is not properly initialized. To do this, FreeBSD actually allows hash table to be dynamically resized. If the global table is uninitialized at the first call, the table will be initialized with a minimal size; hence subsequent insertion will be reasonable as the table grows automatically. This patch mimic such behaviors. More precisely, this patch introduces: 1. a full table iterator that scans each element in the table, 2. a resize routine that is automatically triggered whenever the load factor is reached where it iterates the old table and insert the entries into a new one, 3. more tests that cover the growth of the table.
Diffstat (limited to 'llvm/utils/UpdateTestChecks/common.py')
0 files changed, 0 insertions, 0 deletions