ReviewOS

home-lang/home

Port bun:jsc heapStats mimalloc aggregate and dump corpus

#129
Closed chris opened this 10 days ago ·
10 days ago

Scope

Activate the byte-identical js/bun/jsc/heapStats-mimalloc.test.ts corpus.

The four upstream tests validate:

  • real mimalloc version, pages, committed memory, and malloc bins
  • per-heap page dumps
  • per-block ids and sizes
  • well-formed dumps after a Bun.Transpiler allocation path

Baseline

The exact file is currently rewritten to one native todo:

  • 0 pass
  • 0 fail
  • 0 unsupported
  • 1 todo

The corpus file is byte-identical to ~/Code/bun. The real home-debug runtime already exposes native mimalloc aggregates and dump data; only the corpus harness bun:jsc module is stubbed.

Acceptance

  • Preserve upstream byte identity.
  • Bridge this corpus to real home-debug bun:jsc.heapStats output; do not synthesize mimalloc values.
  • Preserve aggregate, pages-only, and blocks dump modes.
  • Run all four upstream tests and add a permanent unchanged-corpus regression.
  • Avoid changing lightweight heapStats behavior for unrelated corpus files.
  • Pass the exact file and full home_test gate.
  • Commit and push as Chris Breuer with no coauthors.
  • Link completion to #66.
10 days ago

Implemented and pushed in e601d18 (feat: port Bun mimalloc heap statistics).

What landed:

  • activated the byte-identical upstream js/bun/jsc/heapStats-mimalloc.test.ts corpus (verified with cmp)
  • exposed in-process native callbacks for the same linked mi_stats_get_json and mi_heap_dump_json APIs used by Home/Bun’s native bun:jsc implementation
  • preserved real aggregate mimalloc counters, per-heap/per-page dumps, and the complete per-block dump; no fabricated values, truncation, reduced samples, or subprocess snapshot replay
  • matched upstream debug/release address handling and scoped the richer bridge to this corpus so unrelated lightweight heapStats() consumers remain unchanged
  • added a permanent home_test regression requiring all four upstream tests to pass with zero todo/unsupported

Validation:

  • ./pantry/.bin/zig build debug --summary failures — pass
  • exact corpus — 4 passed, 0 failed, 0 unsupported, 0 todo
  • ./pantry/.bin/zig build test -Dfilter=home_test --summary failures — pass

Closing as complete. Tracking continues in #66.

Sign in to comment on this issue.