24 ms·
GHC currently has an excellent semi-whole program optimizer for Haskell-level code. And it has LLVM for optimizing the generated assembly. What is missing is an
by dons 14y ago
GHC currently has an excellent semi-whole program optimizer for Haskell-level code. And it has LLVM for optimizing the generated assembly. What is missing is an intermediate level optimizer that optimizes asm prior to LLVM, and has awareness of the properties of the Haskell runtime: e.g. immutability, lack of aliasing (properties LLVM can't see). With this last piece, all aspects of code generation are getting heavy duty optimizer treatment.
The new code gen is also pluggable, so you can add new optimizer passes easily (e.g. by implementing text book algorithms)
- tikhonj 14y agoHeh, 'semi-whole' seems to be a bit of an oxymoron. Could you explain exactly what that means? Do you just mean that it looks at your whole program but not the libraries you use?
- Locke1689 14y agoAs far as I know it looks at out-of-module calls and does some optimization, but can't run the full optimization suite on outside modules.
- batterseapower 14y agoBasically, it inlines across module boundaries (except where such modules are mutually recursive).
- Locke1689 14y agoI don't think cyclic imports are allowed in Haskell.
- dons 14y agoSure they are, and full cross-module inlining too
- tinco 14y agoSince when? I just merged 3 files together because GHC complained of the cyclic imports. I would love to pull them apart again.
- walrus 14y agohttp://www.haskell.org/haskellwiki/Mutually_recursive_modules#GHC http://www.haskell.org/haskellwiki/Mutually_recursive_module...
- Locke1689 14y agoRight, .hs-boot files. I was being naive and trusting the compiler warnings.