[LLVMdev] Efficient implementation of closures?

me22 me22.ca at gmail.com
Sun Dec 28 10:49:29 PST 2008


On Sun, Dec 28, 2008 at 13:42, Jon Harrop <jon at ffconsultancy.com> wrote:
>
> Previous generation languages like OCaml compile this into a completely
> generic representation where polymorphism is handled at run-time.
> Consequently, even though the polymorphism is buried in the fold function
> (not visible at all in our "sum" function) it still incurs massive
> performance degradation.
>
> JIT compilation makes it easy to avoid the cost of polymorphism by generating
> code for each permutation of type variables that a definition is used with.
> That immediately removes the cost of polymorphism because we get a version of
> fold specialized for float arrays.
>

I'm fairly certain that MLton does this during static compilation.



More information about the llvm-dev mailing list