Moby is an experiment in language design and implementation. Our goal is to combine support for class-based object-oriented programming and higher-order concurrency with the desirable features of ML-like languages: advanced module systems, parametric polymorphism, inductive datatypes, pattern matching, and first-class functions.
Internally, the Moby compiler uses a higher-order, direct-style IR
called BOL (lexical average of ANF and CPS). A cluster conversion
phase transforms a general BOL program into BOL clusters, which is a
first-order, direct-style IR with no nested-functions (hence, explicit
closures). A BOL cluster
is
comprised of an entry fragment and a set of internal fragments
satisfying
Code-generation is via MLRISC. Each cluster becomes one machine procedure; control transfer within a cluster is implemented as jumps with local variables. The conclusion is we want clusters as big as possible - this enables better loop optimizations, register allocation, and instruction scheduling; it also eliminates the overhead of creating closures and making full-fledged function calls.