Add hint when a module is used instead of a module type or when a
module type is used instead of a module or when a class type is
used instead of a class.
This pull request eliminates some more uses of the page table in the runtime system when built in no-naked-pointers mode, in preparation for Multicore OCaml, which has no page table.
This is another classification macro that requires the page table.
Its only uses in the whole OPAM universe is two of our own tests
(tests/asmcomp/is_static.ml and tests/lib-obj/reachable_words_np.ml)
which are now run only in naked-pointers mode.
This is in preparation for the complete removal of the page table.
Without the page table, there is no way to distinguish pointers into
the major heap from pointers to structured constants statically
allocated by ocamlopt. The only distinction we can make between pointers
is whether they point to the minor heap (Is_young) or not.
However, we cannot (yet) define Is_in_heap(v) as !Is_young(v), because
Is_in_heap with its current meaning is used
- in the compactor
- in many assertions.
Yet, there are a few places, mostly in the handling of ephemerons,
where Is_in_heap(v) can safely be replaced with !Is_young(v).
This is done in this commit.
This is in preparation for the complete removal of the page table.
Without the page table, there is no way to distinguish pointers into
the heaps (minor or major) from pointers outside the heaps,
e.g. structured constants statically allocated by ocamlopt.
Hence, the difference between Is_in_heap_or_young and Is_in_value_area
(behavior on static data) disappears, and both should always return true.
All uses of Is_in_heap_or_young but one are in assertions, which
therefore become useless, but not wrong.
The one use inside the code is when registering a finalisation with
`Gc.finalise`. Today, `Invalid_argument` is raised if the value to be
finalised is statically allocated. With this commit and in
no-naked-pointers mode, `GC.finalise` succeeds, but the finalisation
function will never be called.
In weak.c there are two tests determining whether a value is a custom
block or not. The original code, using Is_in_heap_or_young, would
conclude "not a custom block" for statically-allocated custom blocks
like int64 literals.
In weak.h there is one test Is_in_heap_or_young (child) that guards
1- a test for forward blocks
2- a test for white blocks.
Both guarded tests are false for a statically-allocated block:
- test 1 because lazy values are not statically allocated normally
- test 2 because statically-allocated blocks must have black headers.
Hence it makes no difference to test Is_in_value_area (child).