The OCaml team has the pleasure of celebrating the birthday of Jacques de Vaucanson
by announcing the joint releases of OCaml version 4.12.0 and 4.11.2 .
Some of the highlights in the 4.12.0 release are:
- Major progress in reducing the difference between the mainline and
multicore runtime - A new configuration option
ocaml-option-nnpchecker
which emits an alarm
when the garbage collector finds out-of-heap pointers that could cause a crash
in the multicore runtime - Support for macOS/arm64
- Mnemonic names for warnings
- Many quality of life improvements
- Many bug fixes
The 4.11.2 release is a collection of safe bug fixes, cherry-picked from the 4.12.0 development
cycle. If you were using OCaml 4.11.1 and cannot yet upgrade to 4.12.0, this release is for you.
The full list of changes can be found in the changelogs below.
Those releases are available as OPAM switches, and as a source download here:
https://github.com/ocaml/ocaml/archive/4.12.0.tar.gz
The Caml Language
and there:
https://github.com/ocaml/ocaml/archive/4.11.2.tar.gz
The Caml Language
Happy hacking,
â Florian Angeletti for the OCaml team.
OCaml 4.11.2 (24 February 2021)
Build system:
-
9938, 9939: Define __USE_MINGW_ANSI_STDIO=0 for the mingw-w64 ports to
prevent their C99-compliant snprintf conflicting with ours.
(David Allsopp, report by Michael Soegtrop, review by Xavier Leroy)
Runtime system:
-
10056: Memprof: ensure young_trigger is within the bounds of the minor
heap in caml_memprof_renew_minor_sample (regression from 8684)
(David Allsopp, review by Guillaume Munch-Maccagnoni and
Jacques-Henri Jourdan) -
9654: More efficient management of code fragments.
(Xavier Leroy, review by Jacques-Henri Jourdan, Damien Doligez, and
Stephen Dolan)
Tools:
-
9606, 9635, 9637: fix performance regression in the debugger
(behaviors quadratic in the size of the debugged program)
(Xavier Leroy, report by Jacques Garrigue and Virgile Prevosto,
review by David Allsopp and Jacques-Henri Jourdan)
Code generation and optimizations:
-
9969, 9981: Added mergeable flag to ELF sections containing mergeable
constants. Fixes compatibility with the integrated assembler in clang 11.0.0.
(Jacob Young, review by NicolĂĄs Ojeda BĂ€r)
Bug fixes:
-
9970, 10010: fix the declaration scope of extensible-datatype constructors.
A regression that dates back to 4.08 makes extensible-datatype constructors
with inline records very fragile, for example:
type 'a t += X of {x : 'a}
(Gabriel Scherer, review by Thomas Refis and Leo White,
report by NicolĂĄs Ojeda BĂ€r) -
9096, 10096: fix a 4.11.0 performance regression in classes/objects
declared within a function
(Gabriel Scherer, review by Leo White, report by Sacha Ayoun) -
9326, 10125: Gc.set incorrectly handles the three
custom_*
fields,
causing a performance regression
(report by Emilio JesĂșs Gallego Arias, analysis and fix by Stephen Dolan,
code by Xavier Leroy, review by Hugo Heuzard and Gabriel Scherer)
OCaml 4.12.0 (24 February 2021)
Supported platforms (highlights):
-
9699: add support for iOS and macOS on ARM 64 bits
(Eduardo Rafael, review by Xavier Leroy, NicolĂĄs Ojeda BĂ€r
and Anil Madhavapeddy, additional testing by Michael Schmidt)
Standard library (highlights):
-
9797: Add Sys.mkdir and Sys.rmdir.
(David Allsopp, review by NicolĂĄs Ojeda BĂ€r, SĂ©bastien Hinderer and
Xavier Leroy)
-
[breaking change] 9765: add init functions to Bigarray.
(Jeremy Yallop, review by Gabriel Scherer, NicolĂĄs Ojeda BĂ€r, and
Xavier Leroy) -
[breaking change] 9668: List.equal, List.compare
(This could break code using âopen Listâ by shadowing
Stdlib.{equal,compare}.)
(Gabriel Scherer, review by NicolĂĄs Ojeda BĂ€r, Daniel BĂŒnzli and Alain Frisch)
-
9066: a new Either module with
type 'a Either.t = Left of 'a | Right of 'b
(Gabriel Scherer, review by Daniel BĂŒnzli, Thomas Refis, Jeremy Yallop) -
9066: List.partition_map :
('a â ('b, 'c) Either.t) â 'a list â 'b list * 'c list
(Gabriel Scherer, review by Jeremy Yallop) -
9865: add Format.pp_print_seq
(Raphaël Proust, review by Nicolås Ojeda BÀr)
Compiler user-interface and warnings (highlights):
-
9657: Warnings can now be referred to by their mnemonic name. The names are
displayed using-warn-help
and can be utilized anywhere where a warning list
specification is expected.
ocamlc -w +fragile-match
âŠ[@@ocaml.warning â-fragile-matchâ]
Note that only a single warning name at a time is supported for now:
â-w +foo-barâ does not work, you must use â-w +foo -w -barâ.
(NicolĂĄs Ojeda BĂ€r, review by Gabriel Scherer, Florian Angeletti and
Leo White) -
8939: Command-line option to save Linear IR before emit.
(Greta Yorsh, review by Mark Shinwell, Sébastien Hinderer and Frédéric Bour) -
9003: Start compilation from Emit when the input file is in Linear IR format.
(Greta Yorsh, review by Jérémie Dimino, Gabriel Scherer and Frédéric Bour)
Language features (highlights):
- [breaking change] 9500, 9727, 9866, 9870, 9873: Injectivity annotations
One can now mark type parameters as injective, which is useful for
abstract types:
module Vec : sig type !'a t end = struct type 'a t = 'a array end
On non-abstract types, this can be used to check the injectivity of
parameters. Since all parameters of record and sum types are by definition
injective, this only makes sense for type abbreviations:
type !'a t = 'a list
Note that this change required making the regularity check stricter.
(Jacques Garrigue, review by Jeremy Yallop and Leo White)
Runtime system (highlights):
-
9534, 9947: Introduce a naked pointers checker mode to the runtime
(configure option --enable-naked-pointers-checker). Alarms are printed
when the garbage collector finds out-of-heap pointers that could
cause a crash in no-naked-pointers mode.
(Enguerrand Decorne, KC Sivaramakrishnan, Xavier Leroy, Stephen Dolan,
David Allsopp, NicolĂĄs Ojeda BĂ€r review by Xavier Leroy, NicolĂĄs Ojeda BĂ€r)
-
[breaking change] 1128, 7503, 9036, 9722, 10069: EINTR-based signal handling.
When a signal arrives, avoid running its OCaml handler in the middle
of a blocking section. Instead, allow control to return quickly to
a polling point where the signal handler can safely run, ensuring that
I/O locks are not held while it runs. A polling point was removed from
caml_leave_blocking_section, and one added to caml_raise.
(Stephen Dolan, review by Goswin von Brederlow, Xavier Leroy, Damien
Doligez, Anil Madhavapeddy, Guillaume Munch-Maccagnoni and Jacques-
Henri Jourdan) -
[breaking change] 5154, 9569, 9734: Add
Val_none
,Some_val
,Is_none
,Is_some
,
caml_alloc_some
, andTag_some
. As these macros are sometimes defined by
authors of C bindings, this change may cause warnings/errors in case of
redefinition.
(NicolĂĄs Ojeda BĂ€r, review by Stephen Dolan, Gabriel Scherer, Mark Shinwell,
and Xavier Leroy) -
[breaking change] 9674: Memprof: guarantee that an allocation callback is always run
in the same thread the allocation takes place
(Jacques-Henri Jourdan, review by Stephen Dolan)
-
10025: Track custom blocks (e.g. Bigarray) with Memprof
(Stephen Dolan, review by Leo White, Gabriel Scherer and Jacques-Henri
Jourdan) -
9619: Change representation of function closures so that code pointers
can be easily distinguished from environment variables
(Xavier Leroy, review by Mark Shinwell and Damien Doligez) -
9654: More efficient management of code fragments.
(Xavier Leroy, review by Jacques-Henri Jourdan, Damien Doligez, and
Stephen Dolan)
Other libraries (highlights):
-
9573: reimplement Unix.create_process and related functions without
Unix.fork, for better efficiency and compatibility with threads.
(Xavier Leroy, review by Gabriel Scherer and Anil Madhavapeddy) -
9575: Add Unix.is_inet6_addr
(NicolĂĄs Ojeda BĂ€r, review by Xavier Leroy) -
9930: new module Semaphore in the thread library, implementing
counting semaphores and binary semaphores
(Xavier Leroy, review by Daniel BĂŒnzli and Damien Doligez,
additional suggestions by Stephen Dolan and Craig Ferguson)
- [breaking change] 9206, 9419: update documentation of the threads library;
deprecate Thread.kill, Thread.wait_read, Thread.wait_write,
and the whole ThreadUnix module.
(Xavier Leroy, review by Florian Angeletti, Guillaume Munch-Maccagnoni,
and Gabriel Scherer)
Manual and documentation (highlights):
-
9755: Manual: post-processing the html generated by ocamldoc and
hevea. Improvements on design and navigation, including a mobile
version, and a quick-search functionality for the API.
(San VĆ© Ngá»c, review by David Allsopp and Florian Angeletti) -
9468: HACKING.adoc: using dune to get merlin support
(Thomas Refis, review by Gabriel Scherer) -
9684: document in address_class.h the runtime value model in
naked-pointers and no-naked-pointers mode
(Xavier Leroy and Gabriel Scherer)
Internal/compiler-libs changes (highlights):
-
9464, 9493, 9520, 9563, 9599, 9608, 9647: refactor
the pattern-matching compiler
(Thomas Refis and Gabriel Scherer, review by Florian Angeletti) -
9696: ocamltest now shows its log when a test fails. In addition, the log
contains the output of executed programs.
(NicolĂĄs Ojeda BĂ€r, review by David Allsopp, SĂ©bastien Hinderer and Gabriel
Scherer)
Build system (highlights):
-
9824, 9837: Honour the CFLAGS and CPPFLAGS variables.
(SĂ©bastien Hinderer, review by David Allsopp) -
10063: (Re-)enable building on illumos (SmartOS, OmniOS, âŠ) and
Oracle Solaris; x86_64/GCC and 64-bit SPARC/Sun PRO C compilers.
(partially revert 2024).
(TÔivo LeedjÀrv and Konstantin Romanov,
review by Gabriel Scherer, SĂ©bastien Hinderer and Xavier Leroy)