* 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).
* Don't include stdio.h in caml/misc.h
There is no need to include stdio.h in caml/misc.h
This seems to have happened by accident in commit cddec18fde
On OpenBSD, stderr and stdout are macros defined in stdio.h
ppx_expect uses stderr and stdout as identifiers in
collector/expect_test_collector_stubs.c where caml/misc.h is included.
This confuses the C compiler, because the macro will get expanded where an identifier is expected.
* Remove fallback NULL definition in caml/misc.h
ISO C guarantees that NULL is defined in <stddef.h>
* include missing stdio in tests/compatibility/stub.c
The `CAML_STATIC_ASSERT` declares a global variable which was neither `static` nor `extern`. Multiple uses of the macro cause multiple variables with the same name, which are accepted under the "common" C model but are rejected in C++ and in some C compilers that don't use the "common" model. The fix is to declare the variable `extern`.
Since the new stack overflow detection system (#8670), ASAN was confused.
We fix the issue by telling ASAN to not use a sigaltstack, and by disabling
ASAN on functions used by the stack overflow handler.
The typedef was guarded by CAML_INTERNALS, but given its accidental use
in the public Is_young macro, mark the typedef as deprecated in case
CAML_INTERNALS is being defined "in the wild" to workaround this.
* Fix free identifiers in spacetime
* Fix free identifiers in tools/gdb-macros
* [minor] Fix Caml_state fields in comments, and other comment updates
* Changes
Since we cannot access backtrace position in cmmgen.ml anymore,
Cmm.raise_kind in removed. Instead, we use Lambda.raise_kind. When
assembly code is generated, we reset the backtrace position to 0 in the
case of regular raise. Importantly, the semantics remains the same.
This commit adds dynlink support for ocamldebug. As a side effect, it also:
- factorizes the various functions searching for a code fragment into one,
called [caml_find_code_fragment];
- removes the [caml_register_code_fragment], which does not seem to
be used anywhere, and which clearly should not be used by external code.
GPR#8691 refactored the signal/async callback system, and introduced
new data races to `caml_something_to_do` and friends. These data races
morally already existed and are "benign", in the sense that they can
only cause more checks for async callbacks.
The corresponding functions are now marked with a special attribute
for whitelisting them. We do no longer use -fsanitize-blacklist, which
seemed to fail preventing warnings (???).
Earlier documentation comments suggested that major GC hooks can do things with the GC-managed heap. This is problematic and not used in practice.
This commit changes the documentation comments to make it clear that major GC hools are not allowed to interact with the GC-managed heap.
The workaround used for ignoring samples in the minor heap in native
mode now makes allocation very slow (or non-terminating) when the
sampling rate is not small enough. This will be fixed when sampling in
the minor heap in native mode will be implemented.
The mechanism complicates the runtime system and is not very general
(only a few system functions are instrumented). There are other ways
to intercept system calls that are more general and require no
modification to the source code of the runtime system.