3 ms·
This book looks fun. But I'm still waiting for a worthy successor of The Dragon Book, discussing optimizations for modern CPUs (and perhaps GPUs), and also disc
by amelius 3y ago
This book looks fun. But I'm still waiting for a worthy successor of The Dragon Book, discussing optimizations for modern CPUs (and perhaps GPUs), and also discusses how to design/write a modern VM with a fast concurrent GC (something that some might say is even harder than writing the compiler!)
- tralarpa 3y agoI remember that I didn't like the Dragon Book when I was a student. But I don't remember anymore why :) (I think I found it poorly structured, and with too many details for some topics and not enough details for others). If you already have some base knowledge, you might like this: https://www.cs.cmu.edu/~janh/courses/411/18/schedule.html https://www.cs.cmu.edu/~janh/courses/411/18/schedule.html I particularly liked how they introduced SSA form. More advanced topics: https://www.cs.cmu.edu/~15745/handouts.html https://www.cs.cmu.edu/~15745/handouts.html
- tomcam 3y agoFantastic resource, thank you.
- kopecs 3y agoI also disliked the Dragon Book as a student. I found it to have too much of an emphasis on lexing/parsing and not enough discussion for optimizations/analysis for my liking. I liked Advanced Compiler Design and Implementation by Muchnick, although it does have some warts (ICAN; less discussion of SSA than I would've liked) and I think it is a bit dated now. FYI: replacing the 18 with 23 in your link to 411 gets you a slightly updated version.
- mst 3y agoI suspect that the emphasis is an artifact when the Dragon Book was written - getting a decent parser was rather more of a challenge, and heavily optimising compilers a lot less common. Tis one of those things, I guess.
- trealira 3y ago> heavily optimising compilers a lot less common. Not just that, but the theory that drives modern compilers, like graph coloring register allocation and static single assignment form, weren't conceived until the mid 1980s (1984 and 1986 each), and better implementations of those theories were written about in the 90s. Linear scan register allocation was first written about in 1999. You can compare these books: Engineering a compiler: VAX-11 code generation and optimization, which was published in 1982, talks about the design and implementation of the PL/I compiler for the DEC VAX-11. You can compare it to Bob Morgan's Building an Optimizing Compiler, which was published in 1997. The techniques he discusses there are a lot closer to how LLVM works today than the 1982 book.
- freedomben 3y agoSame, that's been my hope too. Stuff is getting so complex nowadays with modern microcode/firmware and such, and there's so many things that seem like "magic" to me. Feeling like something is "magic" is my internal signal that somebody figured out some clever way to get around what I think is/was the limitations, and I love discovering people's clever hacks. Recently been reading about Fake Bass (which is how small speakers seemingly violate the laws of physics by producing bigger bass than they are capable of) and how they accomplish this by (ab)using harmonics to trick the brain into hearing deeper notes than are actually tere. Fascinating stuff!
- deleted 3y ago[deleted]
- trealira 3y agoBob Morgan's book Building an Optimizing Compiler is entirely focused on modern compiler optimizations (and it was published in 1997). It goes over building a control flow graph, various optimizations you can do with that, alias analysis, static single assignment form, CFG dominator-based optimizations, instruction scheduling, register allocation, and emitting object code. It doesn't talk about lexing, parsing, NFAs/DFAs, etc. like most compiler books. Static Program Analysis[1] also seems helpful to someone trying to write a compiler that does optimizations that require advanced analyses: https://cs.au.dk/~amoeller/spa/ https://cs.au.dk/~amoeller/spa/ For garbage collection, there's the Garbage Collection handbook[2]. I'm not aware of better additional resources, though. [1]: https://cs.au.dk/~amoeller/spa/ https://cs.au.dk/~amoeller/spa/ [2]: https://gchandbook.org/ https://gchandbook.org/