Part of the raw, on-disk .cmx format (but not a complete description)
A more convenient form of the .cmx format (but not the conversion from on-disk)
Part of the raw, on-disk .cmxa format (but not a complete description)
Notably, no nicer form of the .cmxa format
The full details of how to read and write .cmx and .cmxa files are left to be implemented (and reimplemented) elsewhere (six times in the compiler alone). This is particularly bad for an input_value-based implementation, where things getting out of sync can trivially violate memory safety. Also, everything that reads the .cmxa format (including downstream tools like odoc) has to deal with the on-disk representation of dependencies of library components as bitfields.
This PR changes cmx_format.mli to expose only convenient datatypes for programming against, with fully-encapsulated read and write operations for performing disk I/O. All such disk I/O code is harvested from various parts into the new cmx_format.ml. As a bonus, cmx_format.mli is now much closer to its upstream form for easier upstreaming.
Currently, the
Cmx_format
module exports:The full details of how to read and write .cmx and .cmxa files are left to be implemented (and reimplemented) elsewhere (six times in the compiler alone). This is particularly bad for an
input_value
-based implementation, where things getting out of sync can trivially violate memory safety. Also, everything that reads the .cmxa format (including downstream tools like odoc) has to deal with the on-disk representation of dependencies of library components as bitfields.This PR changes
cmx_format.mli
to expose only convenient datatypes for programming against, with fully-encapsulatedread
andwrite
operations for performing disk I/O. All such disk I/O code is harvested from various parts into the newcmx_format.ml
. As a bonus,cmx_format.mli
is now much closer to its upstream form for easier upstreaming.