Sunday, January 26, 2014

Devirtualization in C++, part 2 (low-level middle-end devirtualization by forwarding stores to loads)

In the first part of the series we saw low level implementation of a polymorphic call. It is a common belief that devirtualization can be done well by the generic middle-end optimization techniques - combination of the constant propagation, store-to-load forwarding and indirect call removal. (See, for example, this post on llvm-dev, GCC developers tends to share similar sentiments.) This time I show how this is implemented and why one needs special purpose devirtualization code in the middle-end to really optimize well.

Sunday, January 19, 2014

Devirtualization in C++, part 1

Devirtualization is an optimization turning polymorphic calls into direct calls. In these series I would like to describe of calls in C++ programs.  This area of compiler optimization is not really well covered by literature (it seems like all research is done on Java or interpreted languages). I will explain in detail how devirtualization works in GCC. Later I will also show some statistics collected from bigger applications, like Firerox or Libreoffice and it is quite clear that C++ programmers tends to abuse the use of virtual keyword in C++ and have various (non)-realistic assumptions on the resulting code.

Saturday, January 18, 2014

Hello World!

This is freshly created blog of Honza Hubička. I plan to write here on compilers, math, history of photography and perhaps more.

Why I am creating a blog? 

This week I moved to Calgary for a post-doc in mathematics. In addition to that I am also co-running Šechtl & Voseček Museum of Photography and develop GCC. These activities usually keeps me busy. For some reason I believe that after my move I will have plenty time to sit down and write something interesting here.

Last time I did something similar was in 90's when the word "blog" did not exist. Here is what remained from my activity back then. Lets see if I find enough of persistence to get this going.