]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
libctf, dedup: reclaim space wasted by duplicate hidden types
authorNick Alcock <nick.alcock@oracle.com>
Tue, 3 Jun 2025 11:01:45 +0000 (12:01 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Wed, 4 Jun 2025 11:51:28 +0000 (12:51 +0100)
commitd4e9d956572a7bbf96a5500d70ddfe5a33f23ced
tree6d03076555a2e09219f2607a468daea3d365f9ad
parentcedf6f8702e53a9575db8abec25925578271d11d
libctf, dedup: reclaim space wasted by duplicate hidden types

In normal deduplicating links, we insert every type (identified by its
unique hash) precisely once.  But conflicting types appear in multiple
dicts, so for those, we loop, inserting them into every target dict
in turn (each corresponding to an input dict that type appears in).
But in cu-mapped links, some of those dicts may have been merged into
one: now that we are hiding duplicate conflicting types more
aggressively in such links, we are getting duplicate identical hidden
types turning up in large numbers.

Fix this by eliminating them in cu-mapping phase 1 (the phase in which this
merging takes place), by checking to see if a type with this hash has
already been inserted in this dict and skipping it if so.  This is
redundant and a waste of time in other cu-mapping phases and in normal
links, but in cu-mapped links it saves a few tens to hundreds of kilobytes
in kernel-sized links.

libctf/
PR libctf/33047
* ctf-dedup.c (ctf_dedup_emit_type): Check for already-emitted
types in cu-mapping phase 1.
libctf/ctf-dedup.c