Re:Stuxnet is now on GitHub
by tedunangst on Sunday February 13, 2011 @12:31PM
(#2213232)
What do you suppose a decompiled chunk of optimized Haskell would look like?
[ Parent
| on HN ]
Heck, 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....Without a very clever decompiler, I'd say `ugly'.
I admit to basing this on nothing more than a gut feeling, but a "sufficiently smart decompiler" seems even less plausible than a "sufficiently smart compiler".