Before a7b5bb6f06 from #8713, includes of compatibility.h used to be
all guarded by `#ifndef CAML_NAME_SPACE`. The solution at a7b5bb6f06
required to change two of those guard into `#ifndef CAML_INTERNALS`.
The solution finally retained for 4.10 at #9253 (646d30404e in
trunk) does not depend on this change anymore, and one of the two
guards was changed back into `#ifndef CAML_NAME_SPACE`. This patch
changes the second one back as before.
Since a second CAML_NAME_SPACE guard is contained in compatibility.h,
the potential impact is limited to two of the macros that are not
guarded in this way: caml_stat_top_heap_size and caml_stat_heap_size,
and limited to programs that somehow came to rely on this in 4.10.
Since this patch reverts the situation as in 4.09, the current patch
is preferable to include in 4.10, and it is very low risk.
No Changes needed.
They are somewhat difficult to handle for native allocations, and it is not clear how useful they are. Moreover, they are easy to add back since [Gc.Memprof.allocation] is a private record.
In debug builds, the minor GC now asserts that young_ptr points to
a valid minor heap header before starting GC. Since very few bit
patterns are valid minor heap headers, this is unlikely to be true
by coincidence.
This patch also ensures that minor allocations have color 0. This
was inconsistent between backends before.
* Removed the function 'caml_init_alloc_from_heap' from memory.h, as well as it's definition in memory.c, and the calling code in gc_ctrl.c. The function was unconditionally returning zero with no other functionality, as explained in issue #8709.
No change entry needed.
The domain state structure (caml_domain_state) uses certaing field names
(young_start, young_limit, etc.) that conflict with the macro
definitions in compatibility.h that use the same names. These macro
definitions are made only when CAML_NAME_SPACE is not defined. To avoid
conflict, when CAML_NAME_SPACE is not defined, we prefix the field names
in caml_domain_state with an underscore.
Update .depend files.
The finalizers and all the other asynchronous callbacks (including
signal handlers, memprof callbacks and finalizers) are now called in a
common function, [caml_async_callbacks]. It is called in
[caml_check_urgent_gc] and wherever [caml_process_pending_signals] was
called.
This makes it possible to simplify the [caml_gc_dispatch] logic by
removing the loop it contains, since it no longer calls finalizers.
Allocations ignored by this version
- Marshalling
- In the minor heap by natively-compiled OCaml code
Allocations potentially sampled
- In the major heap
- In the minor heap by C code and OCaml code in bytecode mode