Skip to content

fix: spill wide live segments beyond the 247-word C bank - #1494

Open
oxura wants to merge 2 commits into
bendlang:mainfrom
oxura:fix/1069-live-bank-spill-20261011
Open

oxura wants to merge 2 commits into
bendlang:mainfrom
oxura:fix/1069-live-bank-spill-20261011

Conversation

@oxura

@oxura oxura commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Fixes #1069.

The limit is on live segment arguments, not just constructor width. Increasing the shared C register bank reintroduces the Clang failure, and an 8-bit logical arity loses large closure/fork arguments.

This keeps the physical bank at 247 words and spills excess segment arguments through the existing evaluator stack. Continuation entry consumes its frame and spill tail before loading locals; closure application appends its final argument after spilled captures. Ordinary native C spins retain their own C parameters, including self jumps. Logical arity is u32; the flat result width and frame/fork flags remain compact. The existing foreign-request width guard is unchanged.

Four permanent consumer regressions cover 248 live boxed fields, a materialized 300-capture callback, a 300-live-value fork, and a weighted 301-word native self-spin which always recurses. Before the change all four are valid interpreter programs but native emission fails with an arity over 247. Generated observation: callback logical arity 301, fork arity 303, physical bank still 247.

Verification on Linux x64:

  • Real standalone compiled CLI built all four permanent inputs to native binaries and executable JS.
  • All four returned the interpreter results under native 1/4 threads, Bun and Node: 16 actual executions.
  • Four existing word-copy/native-spin/wide-record-drop/stale-field consumers matched their expected results in source, native 1/4 threads, Bun and Node: 20 executions.
  • Real namespaced --checkup passes for all four new consumers.
  • bun gates/repo.ts: 54/54 on the rebased branch; permanent token limits and allow-list are unchanged.

Older Clang versions and Metal/CUDA hardware are not available here, so I am not claiming those runs. bend2/bend.ts, the kernel, GUIDE and CHANGELOG are untouched. README documents the bounded bank/spill distinction.

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.

C backend: a segment with more than 247 live one-word values fails to compile

1 participant