3 ms·
What do you suppose a decompiled chunk of optimized Haskell would look like?
by tedunangst 16y ago
What do you suppose a decompiled chunk of optimized Haskell would look like?
- eru 16y agoWithout a very clever decompiler, I'd say `ugly'.
- jerf 16y agoHeck, you don't even need that. Put this in a file named "Hello.hs": module Hello where main = print "Hello world!" and run "ghc -fvia-C -keep-hc-files Hello.hs". Compilation may fail with linker errors, but today we don't care about that. We just want to look at the resulting Hello.hc file, which is the C representation of the Haskell, and generally looks like: II_(rhG_closure); II_(si4_closure); FN_(Hello_main_entry) { FB_ if ((W_)(((W_)Sp - 0x10UL) < (W_)SpLim)) goto _cip; Hp=Hp+2; if ((W_)((W_)Hp > (W_)HpLim)) goto _cip; Hp[-1] = (W_)&stg_CAF_BLACKHOLE_info; ;EF_(newCAF); {void (*ghcFunPtr)(void *); and so on for quite a while longer. Passing this through a compile and decompile step might actually clean it up a bit....