Skip to content

feat: establish unified Macintosh runtime foundations - #1364

Merged
benletchford merged 1 commit into
masterfrom
dev/unified-macintosh-runtime
Sep 4, 2026
Merged

feat: establish unified Macintosh runtime foundations#1364
benletchford merged 1 commit into
masterfrom
dev/unified-macintosh-runtime

Conversation

@benletchford

@benletchford benletchford commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • document the refined one-process architecture, ownership laws, audited gap matrix, migration order, and deletion gates
  • add a single address-routing authority for both CPU memory contracts, including atomic mixed and read-only scalar and bulk writes
  • add CPU-free task-owned continuation identity and lifecycle validation, plus transactional cross-ISA completion and callback timing fixes
  • converge TickCount, ordinary NewHandle, and Trap Manager walking slices on shared process authorities
  • require explicit system-memory provenance for privileged permanent trap chains on both ABI paths
  • add a CI ratchet that prevents adapter state, trampoline machinery, and direct native-call construction from growing

Audit status

This is the foundation increment for the tracking issue, not the end of the migration. The migration contract records the remaining concrete work: kernel-owned context banks, resumable MenuSelect and MDEF effects, one CopyBits transfer engine, manager dependency waves, and the final MacintoshProcess composition root. The tracking issue remains open until those deletion gates are complete.

Verification

  • cargo check --lib --no-default-features
  • cargo check --all-features
  • cargo test --lib --no-default-features --features test-support -- --quiet: 4,932 passed, 3 ignored, 0 failed after rebasing onto public master
  • scripts/check-unified-runtime-guardrails.sh
  • shell syntax and diff whitespace checks

Part of #1363.

@benletchford
benletchford force-pushed the dev/unified-macintosh-runtime branch from e600ee3 to a53a4f4 Compare September 4, 2026 17:24
@benletchford
benletchford force-pushed the dev/unified-macintosh-runtime branch from a53a4f4 to ea4a2d5 Compare September 4, 2026 17:30
@benletchford
benletchford merged commit eef89a3 into master Sep 4, 2026
4 checks passed
@benletchford
benletchford deleted the dev/unified-macintosh-runtime branch September 4, 2026 17:42
@rlanday

rlanday commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Heads-up: while re-baselining perf work against current master we found two host-work regressions that trace to this PR (git log -S), and we will send fixes.

  1. TrapDispatcher::trap_table_address now calls bus.protected_code_ownership(), which clones readonly_code_ranges into a ProtectedCodeOwnership on every trap dispatch. On a 3 in Three headless replay (200 M guest instructions, sample at 1 ms), trap_table_address is 22% of self time and the memmove under it another 6%, plus the allocator traffic (madvise, bzero). Before this PR the lookup was two bus reads. The fix is a borrowed check (bus.protected_code_contains(address)) for the immutable-bus callers; the snapshot stays for install_trap_address, which needs the mutable bus.
  2. MacMemoryBus::route is now on every read_word/read_long and shows as 6.5% of self time out of line; we are looking at a fast path for the flat-RAM case.

Scale, with #1220 rebased on master so its single-step effect is excluded: master executes about 3× the host instructions of the pre-#1364 tree on 3 in Three (312 B vs 103 B for the same 200 M guest instructions, identical ticks and screenshots) and 3.8× on SimCity 2000 (192 B vs 51 B per 400 M). A bisect over 3c63ca4..c40588f is running to confirm the split between this PR and #1362; the profile attribution above is from the symbol level.

@rlanday

rlanday commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Follow-up with the fixes and the confirmed attribution.

Bisect (3 in Three headless replay, 200 M guest instructions, host instructions retired, single runs): 5d87791 = 105.9 B; eef89a3 (this PR) = 268.0 B; 305027d (#1362) = 308.6 B; 83af901 = 308.5 B.

Fixes, all against master with #1220 rebased on it so the single-step mode is excluded:

Together with #1421 (the #1362 side), machine idle, 5 pairs each, identical ticks and framebuffer hashes: 3 in Three −60.7% host instructions and −53.0% CPU time (35.4 s → 16.6 s); SimCity 2000 −39.1% and −30.8% (18.6 s → 12.9 s). The pre-#1364 tree is 105.9 B on 3 in Three; the fixed stack is 122.7 B.

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