3 ms·
Can you expand on some of the problems? I was going to write an inliner for a Lisp I was working on for a couple years. Emacs seems to have a decent one. But I
by sillysaurus3 8y ago
Can you expand on some of the problems?
I was going to write an inliner for a Lisp I was working on for a couple years. Emacs seems to have a decent one. But I know there are tricky corner cases.
- nappy-doo 8y agoWriting a simple inliner isn't too bad, writing a good one is hard. Let's pretend you just "copy/paste" the code into place, there's the question of deciding when/if to copy/paste the code in -- what heuristic do you use. Now there's constant propagation, possibly more doing dead code (from constant propagation), dependency reanalysis (because you've changed the basic block, possibly adding more basic blocks). There are reasons the resultant code could even be less efficient (register pressure for locals for the inline code comes to mind), and there's i-cache complexities that come from blowing up your code size. Inlining is really hard.
- bjoli 8y agonappy-doo answered the question very well. One thing that should be mentioned is that a bad inliner actually removes information that might be useful for future optimisations. Reading the inliners of languages like chez scheme or ghc is enough to give me a hardon.