rnk wrote:

> Or we think no one else does this anchor business, and in that case... why 
> are we doing it?

Anchoring debug information out of a header and into a .cpp file can be a 
powerful optimization. I added a key method to Sema in 
586f65d31f32ca6bc8cfdb8a4f61bee5057bf6c8 and it resulted in significant object 
file size savings (-17.0%). I didn't measure time, but these things are often 
visible in `-ftime-trace` if you go looking.

That said, nobody is maintaining the placement of these anchor methods. It's 
totally ad-hoc, and the gains can easily be erased by adding inline virtual 
methods ahead of the anchor. Also, vtable slots aren't free. They cost dynamic 
relocations and negatively impact startup time (yuck). Homing constructors and 
destructors in cpp files is another way to achieve similar ends, but those tend 
to matter more for inlining. Chromium has that style rule, and they removed (or 
are removing) it.

https://github.com/llvm/llvm-project/pull/139614
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to