Skip to content
Success

Changes

Summary

  1. Is_in_value_area is always true in no-naked-pointers mode (commit: 6e9d39b) (details)
  2. Remove some `#ifndef NO_NAKED_POINTERS` that are now redundant (commit: 247c1da) (details)
  3. weak.[ch]: use Is_in_value_area instead of Is_in_heap_or_young. (commit: 55fcf9f) (details)
  4. Is_in_heap_or_young is always true in no-naked-pointers mode (commit: 8c06218) (details)
  5. Replace some uses of Is_in_heap with !Is_young (commit: 2aa502e) (details)
  6. Is_in_static_data is not available in no-naked-pointers mode (commit: 40a55c7) (details)
Commit 6e9d39bb264e1fa0d53e94fa0f1101ed394fe699 by xavier.leroy
Is_in_value_area is always true in no-naked-pointers mode

Since there are no naked pointers, all pointers are to well-formed
OCaml blocks.
(commit: 6e9d39b)
The file was modifiedruntime/caml/address_class.h (diff)
Commit 247c1da515fbbce23596113afdd77c7f73497072 by xavier.leroy
Remove some `#ifndef NO_NAKED_POINTERS` that are now redundant

Having Is_in_value_area always true in no-naked-pointers mode
achieves the same result as the `#ifndef NO_NAKED_POINTERS` removed here.
(commit: 247c1da)
The file was modifiedruntime/hash.c (diff)
The file was modifiedruntime/extern.c (diff)
The file was modifiedruntime/compare.c (diff)
Commit 55fcf9fa893d022c622f75c014a85c0f66c20e6f by xavier.leroy
weak.[ch]: use Is_in_value_area instead of Is_in_heap_or_young.

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).
(commit: 55fcf9f)
The file was modifiedruntime/weak.c (diff)
The file was modifiedruntime/caml/weak.h (diff)
Commit 8c062185cc422d759d7084afcb732d1b9bec5bf8 by xavier.leroy
Is_in_heap_or_young is always true in no-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 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.
(commit: 8c06218)
The file was modifiedruntime/caml/address_class.h (diff)
Commit 2aa502e1b99eb2a94ecb682e66df6614ee27f8ae by xavier.leroy
Replace some uses of Is_in_heap with !Is_young

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.
(commit: 2aa502e)
The file was modifiedruntime/weak.c (diff)
The file was modifiedruntime/major_gc.c (diff)
Commit 40a55c71a1f32e1988f52e15b8178c7771c76239 by xavier.leroy
Is_in_static_data is not available in no-naked-pointers mode

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.
(commit: 40a55c7)
The file was modifiedtestsuite/tests/asmcomp/is_static.ml (diff)
The file was modifiedruntime/caml/address_class.h (diff)