News for hackers. Stuff that matters.
Re:A JVM Does That? (2011) [pdf] by yummyfajitas on Friday July 08, 2016 @11:19PM (#12059925)
GCC can get runtime information at compile time? That's a truly advanced compiler.
Re:A JVM Does That? (2011) [pdf] by ahh on Saturday July 09, 2016 @12:01AM (#12060016)
It can in fact make predictions in a number of circumstances. The most common case is FDO (https://gcc.gnu.org/wiki/AutoFDO) - with FDO coverage GCC can easily demonstrate a particular vcall is ~always a particular type and emit exactly the code you describe. (To be clear, this isn't just in theory, but is actually happening in a wide variety of binaries I use.)

This is perhaps not fully "ahead of time", granted, but it's extremely easy to deploy and highly effective, and entirely accessible to C++.

Re:A JVM Does That? (2011) [pdf] by srean on Monday July 11, 2016 @05:59AM (#12069978)
Snark not warranted, profile guidance is a thing. But more likely many of those virtual functions will not be a virtual function in idiomatic C++ for performance oriented design. I have seen that I can get away with compile time polymorphism many a time. For the rest there is compiler devirtualization and profiles.