2024 at OCamlPro
At OCamlPro, we like to solve issues that have an impact in the real world, so we focus most of our efforts on projects that our customers bring from their domains. We often like to work in the shadows, focusing on the hardest tasks. Fabrice, OCamlPro’s founder, used to say that we are the Commandos of OCaml (and now of Rust too), a team of highly skilled professionals jumping into the most demanding projects. That ability was illustrated several times in the past, from the birth of Opam, the development of the Flambda compilers for Jane Street, the design and development of the Tezos prototype and ICO platform, to the adventurous extension of the GnuCOBOL open-source compiler for French DGFiP, even the port of Flow and Hack to Windows for Meta. Of course, we are always happy to be entrusted with more common projects and tasks also, building a team and training the talents required to master all tasks, from the simplest to the hardest ones. And the hardest ones are often hidden in the middle of the simplest ones, too.
The OCaml language is the greatest tool at hand to fulfil our missions, and we try to contribute back to the OCaml ecosystem when possible. We are always attracted to issues met by OCaml industrial users, as it gives us the opportunity to directly work for the OCaml community. Would you be having such issues, do not hesitate to contact us and discuss what we can do for you!
The beginning of a new year is always a good time to look back at the previous year, and see what we have achieved with OCaml, and sometimes for OCaml, in 2024.
Contributions to the OCaml ecosystem
Sharing Knowledge
In 2024, we made efforts to dedicate more time to write blog posts to share our knowledge on the OCaml tools we work on, so that OCaml developers can use this knowledge in their daily tasks. We wrote a series of articles on mastering Opam from the ground up ( Opam 101: The First Steps, Opam 102: Pinning Packages), on the internals of the Flambda2 compiler ( Behind the Scenes of the OCaml Optimising Compiler Flambda2: Introduction and Roadmap, Flambda2 Ep. 2: Loopifying Tail-Recursive Functions, Flambda2 Ep. 3: Speculative Inlining ) and one on OCaml backtraces ( OCaml Backtraces on Uncaught Exceptions ). More are coming!
Of course, if you are not patient enough to wait for our next articles, you may register for one of our trainings , we have OCaml Beginner , OCaml Expert , Mastering Opam , OCaml Code Optimization and we can build new ones on demand. To be honest, in 2024, we received many more requests for our sessions on Rust (Beginner, Expert and Embedded) than for OCaml, but more for OCaml ones than for COBOL ones
Opam, Maintenance and Evolution
Since we created Opam in 2012, we have always had at least one full time engineer in the Opam team, to maintain it, add new features and review contributions by other members. This was made possible thanks to a partnership with Jane Street, and, since 2024, to a partnership with Tarides.
In 2024, opam had two major releases, opam 2.3.0 release! and opam 2.2.0 release! . The most ground-breaking change is the official native support for Windows, with access to either mingw-w64 gcc compilers or Visual Studio MSVC compilers with automatic detection. This native support is tremendous news for OCaml adoption in general, and it was built thanks to a lot of work from all the community, especially on the opam-repository and packages. An interesting next step to consider for OCaml on Windows would be to have a single OCaml toolchain for all Windows compilers, using an integrated assembler for x86/x64 with elf/coff support, something that we had implemented and tested in OcpWin a long time ago.
Among many fixes and updates, there is the addition of opam tree to get a nice display of the dependencies of an installed package, opam pin –recursive
to look deeper into sub-directories when searching for opam files and many more small improvements. Check the blog posts for more details !
Work on the OCaml Compiler
We have had a long partnership with Jane Street to improve the performance of the code generated by the OCaml compiler. The first outcome of this work was the Flambda backend, which was merged into OCaml 4.03 in 2016. Since then, we have started a new backend, Flambda2 , that is included in the Jane Street OCaml compiler.
In 2024, our team focused its efforts on several new optimizations, like match in match (simplify pattern-matching appearing in another pattern-matching after inlining), unbox free vars of closures (shortcut chains of pointers stored in closures) or the reaper (do not allocate unused fields of blocks). Such optimizations are often much more complex than you would think, as guaranteeing that they can be applied safely is not obvious, requiring escape analysis and other checks. We were also very active at helping the compiler team at Jane Street by reviewing their code and adapting our backend to their needs. If you are interested in this subject, read our blog series on the topic that was mentioned earlier.
In 2024, we also had an intern working on modular explicits, an extension of OCaml first-class modules with module-dependent functions, functions taking first-class modules as arguments. This work can be seen as a first step towards modular implicits, and was presented at the OCaml workshop with Didier Rémy. The main pull-request is still under review, while other smaller ones have already been merged, leading to interesting extensions inside the compiler such as new forms of dependent types.
Optimizing Geneweb, a Webserver for Genealogy
Last year, we also started working on Geneweb, a webserver in OCaml that is used to store family trees by genealogists. Geneweb is a very old piece of OCaml, initially written around 1996 by Daniel De Rauglaudre at Inria. It is used both by Geneanet , a genealogy company recently acquired by Ancestry, and the Roglo association, a French association that administrates a single family tree of more than 10 million persons. One of the issues faced by the Roglo association was that their branch of the software had diverged from the official one maintained by Geneanet, as Roglo had to use specific features on their branch to cope with the huge size of their unique family tree. We helped them by optimizing the official branch, so that it could host the tree while providing the same latencies for requests as before. It required optimizing the representation of stored data (both in OCaml and on disk), how it was accessed through system calls, and a good understanding of the complex algorithms used by Geneweb, typically to traverse family members using various relationships.
Contributions to other languages
Compiling to Wasm and Wasm Symbolic Execution
Since 2021, OCamlPro has actively contributed to the W3C’s efforts on bringing a dedicated Garbage Collector to WebAssembly - an essential feature that has now become reality with the increased use of Wasm (See How Prime Video updates its app for more than 8,000 device types or Introducing the Disney+ Application Development Kit (ADK) ).
Our work ensured the official WasmGC proposal remained fully compatible with the needs of OCaml.
Crucial to this success was Wasocaml, our Flambda-based backend targeting WebAssembly, which helped drive the proposal’s release and subsequent implementation in 2023 across all major browsers.
One of our biggest contributors to this work, Léo Andrès defended his PhD at the end of 2024. The topic was about compiling OCaml to Wasm but also about another tool named Owi, developed in close collaboration with the University of Lisboa. Originally developed as a “Wasm Swissknife”, Owi has evolved into a multi-core, multi-solver, cross-language symbolic engine. Its capabilities include:
- automated, sound, and partially-correct bug-finding (amounting to a proof);
- solver-aided programming (think of Rosette for Rocket, but for any language);
- efficient test-case generation.
Looking ahead, we are excited to combine Wasocaml and Owi, aiming to perform symbolic execution of OCaml programs, and even those with substantial C components! We’ve already applied these techniques successfully to Rust, uncovering a subtle bug in the Rust standard library. If you want to know more about it, have a look at our journal article.
Some of this work was funded by NGI/NLnet.
From Niagara to Kopek, a foot in the Cinema industry
2024 was also a new adventure in entrepreneurship for OCamlPro. In 2023, we won a grant from the CNC, the French Center for the Cinema industry, to work with Antoine Devulder and Denis Mérigoux on the design of a DSL for movie producers. Indeed, distributing earnings is one of the most complex tasks that a producer must do after a movie is released, mostly because of the complexity of contracts. So we designed a DSL, initially called Niagara, that is close enough to contracts to be simple to write, and automatically computes the exact distribution of earnings during the entire life of the movie.
In 2024, we decided to create the Kopek company with Antoine and Denis, to commercialize this product. The DSL itself is hidden behind a no-code interface that makes all interactions with the software easy and intuitive for producers, and the tool can deal with complex contracts that no other software on the market can deal with. For French speakers, the tool was recently presented at a CNC event .
SuperBOL, a powerful LSP for COBOL and Visual Studio Code
For a few years now, OCamlPro has been involved in the COBOL ecosystem, mostly to help the French tax administration to deal with the migration of COBOL code from legacy systems (GCOS mainframes from the 80s) to Cloud-based platforms. Most of our work was to extend the free open-source GnuCOBOL compiler for the needs of the application. Moreover, we spent some time creating an OCaml framework for COBOL to better understand this programming language. We released a large part of this work as an open-source extension for Visual Studio Code called SuperBOL Studio OSS. Backed by our powerful LSP server, this extension empowers its users with all the features that developers expect from a modern editor for editing and navigating COBOL code.
In 2024, we improved the parser to support a larger part of the COBOL language, we added a powerful indentor of code, powerful code completion features derived directly from the COBOL grammar (using the recently added features in Menhir), as well as various ways to display the control-flow graph of programs ; the latter being particularly useful when your job is to navigate and modify code written many decades ago. We built an entire CI/CD system for SuperBOL that automatically releases cross-compiled, statically linked binaries for Linux, Windows and MacOS.
Mlang used at the DGFiP
We have also been involved for some time now in the adaptation of the Mlang compiler to replace the deprecated tooling of the DGFiP (French Public Finances Directorate) to compute the French Income Tax.
2024 was an important milestone for the project, as Mlang was used for the first time in production. It means that we were able to compute the exact same results, with comparable performance. Moreover, as the former compiler used to suffer from overflows that require manual inspections and re-evaluations, the new compiler already provides benefits for DGFiP. We are now involved in improving Mlang to handle multi-year computations, something that used to be performed using hardly maintainable boilerplate in C, and in improving the general environment around the compiler, with CI/CD and code-navigation tools.
Formal methods
The Alt-Ergo SMT Solver
OCamlPro has been developing the Alt-Ergo SMT solver since 2011. Alt-Ergo is usually used behind code verification frameworks such as Why3 , Frama-C , TIS Analyzer or Adacore Spark , we maintain a close relationship with its industrial users through the Alt-Ergo Users’ Club who have access to the most recent features ahead of time. Current members are Adacore , Trust in Soft , Thales , MERCE and CEA List .
In 2024, we released a brand new version, Alt-Ergo 2.6 . The highlights are a better support for bit-vectors, model generation for algebraic data types, optimization of (maximize) and (minimize), FPA support, and many other features and bug fixes. Part of this work was also funded by the Decysif collaborative project where we try to improve Alt-Ergo for use with the Creusot Rust Verifier .
EAL6+ Certification
In 2024, we have again been involved in a high level software certification process (Common Criteria EAL6+ ) where we successfully proved our capacity to formalize security policies on low level code for very important customers, using the Coq proof assistant.
Taming Test Generators for C with SeaCoral
Writing unit tests is a very good practice, particularly when using a weakly-typed language like C. Yet, it is also a cumbersome task, especially when the goal is to reach 100% coverage of the code. Fortunately, part of this task can be automated by test generation tools, based on fuzzing, symbolic execution, and other code analysis techniques. Each of these techniques has its own strengths and weaknesses (in terms of performance, number of generated tests, or targeted coverage criteria), so much so that it often becomes necessary to combine them in order to achieve good results on realistic source code. Moreover, these tools are often hard to understand and configure properly for a project.
In 2024, following previous experimentations (see “An Efficient Black-Box Support of Advanced Coverage Criteria for Klee” ), we started working on Seacoral, a tool that automates the generation of unit tests for C. Seacoral relies on a unified definition of coverage criteria that is based on the notion of coverage labels, and is able to leverage the abilities of many existing test generation techniques by carefully orchestrating the tools to achieve high coverage with as few tests as possible. Seacoral leverages FramaC/LTest LTest to automatically annotate the code with coverage labels. It currently supports libfuzzer , Klee, and CBMC . Seacoral can also detect unreachable code using LUncov, and reports potential runtime errors.
A long time ago
If you have never heard of OCamlPro, here are a few examples of projects that we contributed to the OCaml ecosystem, since the creation of OCamlPro in 2011.
opam
(*): probably the most powerful package manager in terms of constraints optimization, thanks to the work on CUDF by Roberto Di Cosmo’s team. Now the official package manager of OCaml.flambda1
andflambda2
(*): a backend for the native compiler with multiple additionnal optimization passes. Flambda1 was merged into the official OCaml compiler, while Flambda2 is integrated in the Jane Street OCaml compiler.ocp-indent
(*): a tool to automatically indent OCaml code in editors, with modes for Emacs, Vi, Vscode, etc. with per-project configuration. A must-use for collaborative edition instead of ocamlformat.ocp-index
(*): a tool to lookup types and definitions in an OCaml project, with modes for Emacs, Vi, etc. based on cmt files.ocp-memprof
: the most powerful memory profiler for OCaml to ever exist. With almost no impact on runtime performance, it was able to dump compressed memory dumps of the OCaml heap with full type information.ocp-build
: the first composable build tool for OCaml before dune, it was able to build any OCaml project with full parallelism. It supported additional languages to build cross-language projects.ocp-win
: a full OCaml distribution for Windows, coming with a simple graphical installer. Its compiler could be configured to target any Windows C toolchain, such as MinGW, MSVC or Cygwin, and environment, such as Msys, Cygwin and Windows shells, thanks to the use of an integrated x86/64 and elf/coff assembler in OCaml.
(*) thanks to funding by Jane Street
Your Project, our Expertise
If you’re looking to leverage the power and flexibility of OCaml for your projects, we’d love to collaborate with you. At OCamlPro, we bring years of expertise, innovation, and a deep commitment to enhancing the OCaml ecosystem. Whether you need support with custom development, performance optimization, tooling, or anything in between, we are here to help.
Let’s build something great together—reach out to us today to discuss your project!