[PATCH] Have clang list the imported modules in the debug info

Adrian Prantl aprantl at apple.com
Wed May 6 14:45:52 PDT 2015


> On May 6, 2015, at 2:35 PM, Eric Christopher <echristo at gmail.com> wrote:
> 
> 
> 
> On Wed, May 6, 2015 at 2:26 PM Adrian Prantl <aprantl at apple.com <mailto:aprantl at apple.com>> wrote:
> 
> > On May 5, 2015, at 8:07 PM, David Blaikie <dblaikie at gmail.com <mailto:dblaikie at gmail.com>> wrote:
> >
> > If we believe hash collisions to be an issue - then type units are broken and I'd like to figure out how to fix them, then use the same feature here.
> >
> 
> This led me to perform a little experiment: I had a python script calculate the MD5 sum of ~60.000 unique mangled type names that I extracted from the IR of a clang LTO build. There was not a single collision in the abbreviated 64-bit hashes, and I had to truncate the length of the hash values to 32 bits before I was able to produced even a single collision.
> 
> I think now that hash collisions might be a red herring and a calculable risk that we can decide to ignore.
> 
> The only thing that we cannot ignore here is that for ODR-less languages two types may legally have the same mangled name (and thus hash) when they are defined in two different modules. This means we can’t use type units for these languages and external type reference must be a pair of mangled name and module.
> 
> 
> If it's a new language then you designed your language poorly ;)

I was actually referring to Objective-C(++) here :-)

> 
> That said, add enough to the name for hashing purposes to make it hash uniquely? Or you can go down the path of hashing the type similar to the fission CU hashing (which is what type units were arguably designed to do in the first place if you take a look at the standard, we just only use them for ODR compliant languages etc right now).

I suppose one could hash the entire module configuration + the mangled name and get something that is relatively stable.
For implementation reasons it would be terrible to do the full fission hashing because that would mean that we would actually have to look up (and deserialize the type) in order to get to its ID when emitting an external type reference, which would void at least some of the performance gains we want from module debugging.

-- adrian
> 
> -eric
>  
> -- adrian

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150506/69b228f3/attachment.html>


More information about the cfe-commits mailing list