Walter:

> http://drdobbs.com/blogs/cpp/231902461
> 
> Anyone want to do the reddit honors?

On Reddit I see the discussion is a bit about merging of templates that produce 
the same function code. This is already possible in D, compiling with the LDC1 
(and maybe LDC2 too) compiler using the -mergefunc switch.

I think according to the C standard all functions must have different function 
pointers, and I presume D has the same rule (even if I don't remember reading 
it in the D specs). This problem is solved leaving a tiny stub that just 
contains a jump instruction for the removed duplicated functions. This jump is 
probably nearly always correctly "predicted" by the CPU, because it's 
hard-coded.

As far as I know this -mergefunc is not able to remove partially duplicated 
functions, this is left to future improvements of the LLVM back-end.

Bye,
bearophile

Reply via email to