Duplo: A framework for OCaml post-link optimisation
View / Open Files
Publication Date
2020-08-02Journal Title
Proceedings of the ACM on Programming Languages
Conference Name
International Conference on Functional Programming
ISSN
2475-1421
Publisher
Association for Computing Machinery (ACM)
Volume
4
Issue
ICFP
Type
Conference Object
This Version
AM
Metadata
Show full item recordCitation
Licker, N., & Jones, T. M. (2020). Duplo: A framework for OCaml post-link optimisation. Proceedings of the ACM on Programming Languages, 4 (ICFP) https://doi.org/10.1145/3408980
Abstract
<jats:p>
We present a novel framework,
<jats:italic>Duplo</jats:italic>
, for the low-level post-link optimisation of OCaml programs, achieving a speedup of 7% and a reduction of at least 15% of the code size of widely-used OCaml applications. Unlike existing post-link optimisers, which typically operate on target-specific machine code, our framework operates on a Low-Level Intermediate Representation (LLIR) capable of representing both the OCaml programs and any C dependencies they invoke through the foreign-function interface (FFI). LLIR is analysed, transformed and lowered to machine code by our post-link optimiser, LLIR-OPT. Most importantly, LLIR allows the optimiser to cross the OCaml-C language boundary, mitigating the overhead incurred by the FFI and enabling analyses and transformations in a previously unavailable context. The optimised IR is then lowered to amd64 machine code through the existing target-specific code generator of LLVM, modified to handle garbage collection just as effectively as the native OCaml backend. We equip our optimiser with a suite of SSA-based transformations and points-to analyses capable of capturing the semantics and representing the memory models of both languages, along with a cross-language inliner to embed C methods into OCaml callers. We evaluate the gains of our framework, which can be attributed to both our optimiser and the more sophisticated amd64 backend of LLVM, on a wide-range of widely-used OCaml applications, as well as an existing suite of micro- and macro-benchmarks used to track the performance of the OCaml compiler.
</jats:p>
Relationships
Is supplemented by: https://doi.org/10.17863/CAM.52533
Sponsorship
EPSRC EP/P020011/1, Cambridge Trusts
Funder references
Engineering and Physical Sciences Research Council (EP/P020011/1)
Identifiers
External DOI: https://doi.org/10.1145/3408980
This record's URL: https://www.repository.cam.ac.uk/handle/1810/307551
Rights
All rights reserved
Licence:
http://www.rioxx.net/licenses/all-rights-reserved
Statistics
Total file downloads (since January 2020). For more information on metrics see the
IRUS guide.