Skip to content

Port GC checkpoint runtime work for #1090 - #1324

Merged
proggeramlug merged 2 commits into
PerryTS:mainfrom
andrewtdiz:codex/gc-1090-checkpoint-port-20260522
May 22, 2026
Merged

Port GC checkpoint runtime work for #1090#1324
proggeramlug merged 2 commits into
PerryTS:mainfrom
andrewtdiz:codex/gc-1090-checkpoint-port-20260522

Conversation

@andrewtdiz

Copy link
Copy Markdown
Contributor

Summary

This is the substantive runtime GC checkpoint toward #1090. It is intentionally separate from #1322, which only adds exact-head evidence tooling.

This PR ports the completed GC architecture work onto the split runtime tree and keeps the public GC facade/ABI intact while moving the collector toward the #1090 invariant:

minor GC cost = live young objects + dirty old pages/cards + mutable roots
not arena size + malloc table + old sweep + conservative stack guesses

What changed

  • Split the old monolithic GC implementation into owner modules while preserving crate::gc::* and exported C ABI entrypoints.
  • Added/ported mutable runtime root handling and copied-minor root rewriting coverage across shadow/global/runtime/FFI-style roots.
  • Strengthened write-barrier/store-site coverage with dirty page/range tracking, external slot handling, store-site inventory checks, and helper-store tests.
  • Added explicit GC type/layout metadata, pointer-layout/pointer-free scan accounting, typed shape descriptors, and early unboxed-object layout gates.
  • Advanced copied-minor behavior: nursery reset, forwarding/rewrite verification, malloc interaction hardening, fallback telemetry, and survivor/promotion tests.
  • Added old-page accounting/defrag groundwork and target collector architecture gates.
  • Moved/covered small managed allocation paths and tightened runtime helper stores that keep young children alive across copied-minor GC.

Follow-up fix included in the port

While validating the port, I found and fixed a few real split/port gaps:

  • malloc-backed closure capture writes now use the GC-container slot barrier path
  • promise value / reason stores now route through GC-aware slot stores
  • object overflow fields now dirty exact external slots
  • copied-minor test guards reset runtime scanner/cache state so broad GC test runs are deterministic

Verification

Passed locally on branch codex/gc-1090-checkpoint-port-20260522 at 072055c42741f394ab8092c0ef51a1bd7a11a126:

  • cargo fmt --check
  • tests/test_gc_store_site_inventory.sh -> 188 files scanned
  • cargo check -p perry-runtime
  • cargo check -p perry-codegen
  • cargo test -p perry-runtime --release runtime_roots -- --test-threads=1 -> 54 passed
  • cargo test -p perry-runtime --release gc::tests -- --test-threads=1 -> 274 passed
  • cargo test -p perry-codegen --test large_object_barriers -> 3 passed
  • cargo test -p perry-codegen --test typed_shape_descriptors -> 12 passed
  • cargo build --release -p perry
  • scripts/run_memory_stability_tests.sh -> 60 PASS / 0 FAIL
  • git diff --check

Memory stability highlights from the final run:

  • test_memory_json_churn.ts default: 236 MB / 250 MB
  • test_memory_json_churn.ts gen-gc-explicit: 236 MB / 250 MB
  • test_memory_json_churn.ts force-evac+verify: 258 MB / 275 MB
  • target collector architecture stress gates passed
  • copied-minor fallback evidence report passed with top_remaining_reason=none
  • low-pressure benchmark gates passed for 07_object_create, 12_binary_trees, and bench_gc_pressure

Scope

Refs #1090. This is a strong checkpoint toward #1090, not the final closing packet. The remaining closure work is full exact-head benchmark evidence, broader production policy hardening, and the rest of the long-term old-gen/typed-layout roadmap.

@proggeramlug
proggeramlug merged commit e933b89 into PerryTS:main May 22, 2026
9 checks passed
proggeramlug added a commit that referenced this pull request May 22, 2026
…sweep (#1414)

Rolls up 26 PRs that merged to main post-v0.5.1023 without version
bumps:

- node:crypto gap-fixes (#1386 #1393 #1394 #1402 #1405): randomInt,
  timingSafeEqual, getHashes/getCiphers, sha224/sha384, base64 digest,
  Buffer hash input, no-arg digest() → Buffer, pbkdf2Sync digest arg,
  scryptSync.
- node:perf_hooks (#1321 + #1328 #1342 coverage): performance + User
  Timing + PerformanceObserver native impl, granular node-suite +
  edge-case coverage.
- #1090 GC checkpoint runtime work (#1324).
- #1311 geisterhand on iOS (#1316 #1383 #1384 #1385).
- #1312 process.env.X (unset) is nullish undefined (#1314).
- #1319 thread-safety hardening for cross-thread runtime statics.
- #1322 exact-head GC evidence packet.
- #1323 wasm timers dispatch through mem_call bridge (#1329).
- #1317 node:timers/promises shadow-segfault fix (#1326).
- #1330 node:process suite (#1331).
- #1292 bcrypt.hash() returns String (#1307).
- #1293 fastify .json()/.body external-fastify dispatch (#1308).
- #1296 app pattern performance gaps.
- #1297 diagnostics_channel parity.
- #1301 iOS App Groups capability (#1313).
- #1318 #1325 os/methods/modern-methods static dispatch.
- #1315 expanded Node parity test coverage.
- #1382 ui-ios stdlib pump for async fetch.
- #1392 ui-wasm reactive state + setText (#1404).
proggeramlug added a commit that referenced this pull request May 22, 2026
…1422)

PR #1324 ("Port GC checkpoint runtime work for #1090", e933b89)
reverted the 290/315 MB ceiling from v0.5.1022 (#1286 / 4fcfddb)
back to 250/275 while rewriting the surrounding comments. The
v0.5.1024 release-packages compile-smoke job then hit the same Ubuntu
overrun we already fixed once:

  default            268 MB / limit 250 MB  (+7%)
  gen-gc-explicit    268 MB / limit 250 MB  (+7%)
  force-evac+verify  288 MB / limit 275 MB  (+5%)

Restore the wider ceiling and replace the comment with one that
references the actual rebump history (v0.5.1024 measurements + the
#1324 revert) so the next contributor doesn't accidentally undo it
again. Production binaries are stripped by the linker; these RSS
figures are unstripped release-build artefacts used as a regression
signal, not a deployment-size measurement.

Refs #1090 #1286 #1324.
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.

2 participants