Signal handlers sometimes need to know whether the signal occurred
in ocamlopt-generated code, as opposed to runtime or C library code.
Today this determination uses a page table lookup to keep track
of dynamically-loaded modules, plus ad-hoc tests for the main program.
This PR uses the code fragment table instead. That's more reliable,
less ad-hoc, and independent of the page table.
i386nt.asm: add caml_system__code_{begin,end}, ,like in the other ports.
* Introducing codefrag: a new runtime module to work with code fragments
This module collects all the operations on code fragments performed in
various places of the runtime systems. Applies both to bytecode and
to native code.
The implementation is based on skiplists, so that "lookup fragment by
PC" and "lookup fragment by number" are efficient (logarithmic in the
number of code fragments). "Lookup fragment by digest" remains
linear-time.
The new module also improves the handling of digests: now it is
possible to mark a code fragment as "no digest" i.e. not marshal-able.
* Use the new "codefrag" runtime module for marshaling and for the
debugger interface
Replace the previous handling of code fragments with calls to the
functions provided by the "codefrag" runtime module.
The instrumentation code in the instrumented runtime was replaced
with new APIs to gather runtime statistics and output them in a new format
(Common Trace Format).
This commit also exposes new functions in the Gc module to pause or resume
instrumentation during a program execution (Gc.eventlog_pause and
Gc.eventlog_resume).
The variables are caml_debug_info and caml_atom_table.
The multiple definitions look like a cut-and-paste error.
They cause problems with C compilers that don't follow the "common" model.
Fixes: #9144