Skip to content

Wrap: follow-ups of #913 - #918

Merged
balat merged 3 commits into
masterfrom
wrap-follow-ups
Sep 27, 2026
Merged

balat merged 3 commits into
masterfrom
wrap-follow-ups

Conversation

@balat

@balat balat commented Sep 27, 2026

Copy link
Copy Markdown
Member

Follow-ups of #913 in Wrap.

  • Allocate the markers of the traversal. This is the commit of Wrap: allocate the markers of the traversal #916, which was merged into test-unit-more after Test suite, step 2a: more unit tests; fix double wrapping after a GC #913 had been merged into master, so it never reached master. The markers none, unchanged and modified were the immediates 0, 1 and 2, which the result of a wrapper can also be: a shared value whose wrapper returned 0, None or [] was wrapped twice, 1 or true failed to marshal, 2 failed an assertion. They are now allocated blocks compared physically, with the test wrap / immediate results and an entry in CHANGES.
  • Remove debugging output from Tbl.get_index. It printed on stderr whether a block missing from the table was marked, before failing an assertion that already reports the broken invariant.
  • Disable compaction only where it is automatic. The traversal indexes blocks by address and only detects minor collections, so it disables compaction through max_overhead. OCaml 5 ignores max_overhead and compacts only on an explicit Gc.compact, so the GC settings are now left untouched there. The reason is documented. The OCaml 4 path is unchanged and is exercised by the wrap / wrapper exception test in the OCaml 4 CI jobs.

The markers none, unchanged and modified were the immediates 0, 1 and 2,
which the result of a wrapper can also be. The wrapper of a shared value
returning 0, None or [] ran again; a value whose wrapper returned 1 or
true was sent unwrapped, and failed to marshal; a wrapper returning 2
failed an assertion. The markers are now blocks allocated once and
compared physically.
When a block could not be found in the table of the traversal, even
after a rehash, get_index printed whether the block was marked on
stderr, and checked that the block was nowhere in the table, before
failing its assertion. The assertion alone reports the broken
invariant.
The traversal indexes blocks by their addresses and only detects the
minor collections that move them, so it disables heap compaction by
setting max_overhead. OCaml 5 ignores max_overhead and only compacts the
heap on an explicit call to Gc.compact: the settings are now left
untouched there. The reason for disabling compaction is documented.
@balat
balat merged commit 62bcd5f into master Sep 27, 2026
5 checks passed
@balat
balat deleted the wrap-follow-ups branch September 27, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant