Defunctionalization is generally considered a whole-program transformation
and thus incompatible with separate compilation. In this paper, we formalize
a modular variant of defunctionalization which can support separate
compilation for a functional programming language with parametric
polymorphism. Our technique allows modules in a Haskell-like language to be
separately defunctionalized and compiled, then linked together to generate
an executable program. We provide a prototype implementation of our modular
defunctionalization technique and we discuss the experiences of its
application in compiling a large subset of Haskell to low-level C code,
based on the intensional transformation.
Pointers in the AMD64 architecture contain unused space, a feature often exploited by modern programming language implementations. We use this property in a defunctionalizing compiler for a subset of Haskell, generating fast programs having a compact memory representation of their runtime structures. We demonstrate that, in most cases, the compact representation is faster, uses less memory and has better cache characteristics. Our prototype shows competitive performance when compared to GHC with full optimizations on.
scite is a Brooklyn-based organization that helps researchers better discover and understand research articles through Smart Citations–citations that display the context of the citation and describe whether the article provides supporting or contrasting evidence. scite is used by students and researchers from around the world and is funded in part by the National Science Foundation and the National Institute on Drug Abuse of the National Institutes of Health.