fix!: use allocation-unit terminology for memory layouts by jinchuntan · Pull Request #1111 · 8f4e/8f4e · GitHub
Skip to content

fix!: use allocation-unit terminology for memory layouts - #1111

Merged
irimias57 merged 1 commit into
8f4e:mainfrom
jinchuntan:fix/allocation-unit-terminology
Oct 19, 2026
Merged

irimias57 merged 1 commit into
8f4e:mainfrom
jinchuntan:fix/allocation-unit-terminology

Conversation

@jinchuntan

@jinchuntan jinchuntan commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Closes #712.

Renames the four-byte allocation grid and its layout fields to allocation-unit terminology, including the starting-memory option and planner helpers. All compiler, CLI, worker, editor and runtime callers use the new names. Typed element widths and memory-access-width APIs keep their existing names.

This is an intentional breaking API change, with no compatibility aliases. The migration mapping is in the compiler docs.

Validation on Node 24.16.0:

  • npx nx run-many --target=typecheck --all --parallel=1 — all 37 projects passed.
  • npx nx run-many --target=test --projects=@8f4e/cli,@8f4e/language-spec,@8f4e/memory-default-resolver,@8f4e/memory-planner,@8f4e/memory-reference-resolver,@8f4e/semantic-reference-resolver,@8f4e/semantic-utils,@8f4e/stack-analyzer,@8f4e/sub-program,@8f4e/wasm-codegen,@8f4e/compiler,@8f4e/compiler-worker,@8f4e/editor-state,@8f4e/web-ui,@8f4e/editor-core,@8f4e/runtime-audio-worklet --parallel=1 --update — 2,389 tests passed across 16 packages.
  • Compared 101 fixture programs at starting offsets 1, 2 and 5 before and after the rename: all 303 compilations produced identical Wasm, layout values, required memory, defaults and initialized bytes.
  • Parsed and compared all 81 changed snapshots after mapping the renamed keys; values and array ordering are unchanged. Biome and the active-source search also passed.

Rename layout fields, compile options and planner helpers across the compiler,
CLI, editor and runtime consumers. Document the migration and keep typed
word widths separate from the fixed four-byte allocation grid.

BREAKING CHANGE: Replace GLOBAL_ALIGNMENT_BOUNDARY with ALLOCATION_UNIT_BYTE_SIZE,
startingMemoryWordAddress with startingMemoryAllocationUnitAddress, and
wordAlignedAddress/wordAlignedSize/wordAlignedByteLength with
allocationUnitAddress/allocationUnitCount/allocatedByteLength. Consumers must
use the new names; no compatibility aliases are provided.

@irimias57 irimias57 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @jinchuntan — this is an exceptionally thorough implementation of the allocation-unit terminology change. The rename is consistent across the compiler and its consumers, the typed-word concepts remain correctly scoped, and the preserved snapshot semantics give strong confidence that the memory layout behavior is unchanged. This makes the compiler API much clearer and will prevent future confusion between allocation units and typed words. Excellent work!

@irimias57
irimias57 merged commit 451a6f3 into 8f4e:main Oct 19, 2026
2 checks passed
@andorthehood andorthehood added compiler Compiler, tokenizer, codegen, and language-semantics work contributor labels Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler Compiler, tokenizer, codegen, and language-semantics work contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rename compiler allocation-grid metadata to allocation-unit terminology

3 participants