3 ms·
The author of that compiler used that book as a reference in developing it; that book was open on his desk daily. It had an immutable IR and literally every on
by titzer 1y ago
The author of that compiler used that book as a reference in developing it; that book was open on his desk daily.
It had an immutable IR and literally every one of the dozens of passes made basically an entire copy of it. Needless to say, that was slow and memory hungry. It was difficult to follow the transformation passes unless well-versed in CPS.
We replaced that with a clone of the C1 compiler, C1X, which was basically just a Java rewrite. C1X supposedly still exists in MaxineVM, but has been superceded by the Graal compiler in Truffle/Graal, which is a hybrid CFG/sea-of-nodes style compiler based on SSA.
- pizlonator 1y ago> It had an immutable IR and literally every one of the dozens of passes made basically an entire copy of it. Yeah, this is what CPS is really all about. It's not like SSA at all. Also, it's just a dumb way to write a compiler, and so nobody does that to themselves anymore, now that SSA is widely known. The goofy "hot" takes about how CPS and SSA are the same are usually written by CPS apologists who want to make the rest of us believe that their work on CPS is somehow relevant when it really isn't
- antonvs 1y agoAs I pointed out in another comment, the equivalence is really just about the fact that SSA, CPS, and ANF all name each intermediate value once and avoid mutation. The rest is implementation details. That's certainly true of "every one of the dozens of passes made basically an entire copy of it" - that's just a choice of how to implement it, which is an obvious choice if one is coming at it from a functional angle. These kinds of approaches aren't always as inefficient as one might naively imagine, because there are usually tradeoffs involved - look at Haskell for example, which is capable of producing very performant code despite being largely purely functional. Often, the performance is gained because of the purely functional source code allowing for optimizations during compilation, like stream fusion and so on.