3 ms·
It's true that whole program compilation doesn't cover speculation (and many other cases of dynamicism, like running code that you download or construct at runt
by gsg 12y ago
It's true that whole program compilation doesn't cover speculation (and many other cases of dynamicism, like running code that you download or construct at runtime). But it does allow inlining through a function pointer as in the OP, which you suggested is impossible for a static compiler.
The classic paper on defunctionalisation is Reynolds' "Definitional Interpreters for Higher-Order Programming Languages". There's also a huge whack of papers at http://mlton.org/References http://mlton.org/References, some of which go into MLton's compilation strategy (I don't remember which ones to point you at, though).