Hostname: page-component-cd9895bd7-gvvz8 Total loading time: 0 Render date: 2024-12-26T07:20:39.012Z Has data issue: false hasContentIssue false

OCaml-Java: The Java Virtual Machine as the target of an OCaml compiler*

Published online by Cambridge University Press:  17 May 2016

XAVIER CLERC*
Affiliation:
(e-mail: xclerc@ocamljava.org)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

This article presents how the compiler from the OCaml-Java project generates Java bytecode from OCaml sources. Targeting the Java Virtual Machine (JVM) is a technological challenge, but gives access to a platform where OCaml can leverage multiple cores and access numerous libraries. We present the main design choices regarding the runtime and the various optimizations performed by the compiler that are crucial to get decent performance on a JVM. The challenge is indeed not only to generate bytecode but to generate efficient bytecode, and to provide a runtime library whose memory footprint does not impede the efficiency of the garbage collector. We focus on the strategies that differ from the original OCaml compiler, as the constraints are quite different on the JVM when compared to native code. The level of performance reached by the OCaml-Java compiler is assessed through benchmarks, comparing with both the original OCaml implementation and the Scala language.

Type
Articles
Copyright
Copyright © Cambridge University Press 2016 

References

Balat, V., Vouillon, J. & Yakobowski, B. (2009) Experience report: Ocsigen, a web programming framework. Sigplan not. 44 (9), 311316.Google Scholar
Benton, N. & Kennedy, A. (1999) Interlanguage working without tears: Blending SML with Java. In Proceedings of the 4th ACM SIGPLAN International Conference on Functional Programming, ICFP '99. New York, NY, USA: ACM, pp. 126137.Google Scholar
Benton, N., Kennedy, A. & Russell, G. (1998) Compiling Standard ML to Java bytecodes. In Proceedings of the 3rd ACM SIGPLAN International Conference on Functional Programming, ICFP '98. New York, NY, USA: ACM, pp. 129140.Google Scholar
Benton, N., Kennedy, A. & Russo, C. V. (2004) Adventures in interoperability: The SML.net experience. In Proceedings of the 6th ACM SIGPLAN International Conference on Principles and Practice of Declarative Programming. New York, NY, USA: ACM, pp. 215226.Google Scholar
Chailloux, E., Canou, B. & Wang, P. (2009) OCaml for Multicore Architectures. Available at: http://www.algo-prog.info/ocmc/web/.Google Scholar
Chailloux, E. & Henry, G. (2004) O'Jacaré, une interface objet entre Objective Caml et Java. L'objet.Google Scholar
Chailloux, E., Henry, G. & Montelatici, R. (2004) Mixing the Objective Caml and C# programming models in the .NET framework. In Workshop on Multiparadigm Programming with Object-Oriented Languages (MPOOL), Oslo, Norway.Google Scholar
Clerc, X. (2007) The Barista library. Available at: http://barista.x9c.fr.Google Scholar
Clerc, X. (2012a) OCaml-Java: From OCaml sources to Java bytecodes. In Implementation and Application of Functional Languages. IFL 2012, pp. 71–85.Google Scholar
Clerc, X. (2012b) OCaml-Java: OCaml on the JVM. In Trends in Functional Programming. TFP 2012, pp. 167–181.Google Scholar
Clerc, X. (2013a) OCaml-Java: An ML implementation for the Java ecosystem. In International Conference on Principles and Practices of Programming on the Java Platform, PPPJ 2013, New York, NY, USA: ACM, pp. 4556.Google Scholar
Clerc, X. (2013b) OCaml-Java: Typing Java accesses from OCaml programs. In Implementation and Application of Functional Languages. IFL 2013, pp. 167–181.Google Scholar
Danelutto, M. & Di Cosmo, R. (2011) Parmap: minimalistic library for multicore programming. Available at: https://gitorious.org/parmap.Google Scholar
Filliâtre, J.-C. & Kalyanasundaram, K. (2011) Functory: A Distributed Computing Library for Objective Caml. In Trends in Functional Programming, TFP 2011, pp. 65–81.Google Scholar
Fournet, C., Le Fessant, F., Maranget, L. & Schmitt, A. (2003) JoCaml: A language for concurrent distributed and mobile programming. In Advanced Functional Programming, Jeuring, J. & Jones, S. (eds), vol. 2638. Berlin/Heidelberg: Springer, pp. 19481948. 10.1007/978-3-540-44833-4.Google Scholar
Hickey, R. (2008) The Clojure programming language. In Proceedings of the 2008 Symposium on Dynamic Languages, DLS '08. New York, NY, USA: ACM. Available at: http://dl.acm.org/citation.cfm?id=1408681 Google Scholar
Leroy, X. (1990) The ZINC Experiment: An Economical Implementation of the ML Language. Technical Report, INRIA.Google Scholar
Leroy, X. (2004) The Camljava Project. Available at: http://forge.ocamlcore.org/projects/camljava.Google Scholar
Leroy, X., Doligez, D., Frisch, A., Garrigue, J., Rémy, D. & Vouillon, J. (2013) The OCaml System Release 4.01. Documentation and User's Manual. Available at: http://caml.inria.fr/pub/docs/manual-ocaml/ Google Scholar
Mauny, M. & Vaugon, B. (2012) OCamlCC–Raising low-level bytecode to high-level C. OCaml Users Developers. Copenhagen, Denmark (http://oud.ocaml.org/2012/).Google Scholar
Microsoft. (2000) The C# language a collective Microsoft project.Google Scholar
Montelatici, R., Chailloux, E., Pagano, B. et al. (2005) Objective Caml on .NET: The ocamil compiler and toplevel. In Proceedings of the 3rd International Conference on .NET Technologies. Open-source project: main developers are Charles Oliver Nutter, Thomas Enebo, Ola Bini and Nick Sieger.Google Scholar
Nutter, C. et al. (2008) JRuby a Java-Powered Ruby Implementation. Available at: http://jruby.org.Google Scholar
Odersky, M. et al. (2003) The Scala Language. Available at: http://www.scala-lang.org/.Google Scholar
Stolpmann, G. (2012) Plama: Map/Reduce and Distributed Filesystem. Available at: http://plasma.camlcity.org/.Google Scholar
Syme, D. et al. (2005) The F# Language. Available at: http://fsharp.org.Google Scholar
Vouillon, J. & Balat, V. (2014) From bytecode to JavaScript: The js_of_ocaml compiler. In Software: Practice and Experience, 44 (8), 951972.Google Scholar
Submit a response

Discussions

No Discussions have been published for this article.