Skip to content

Optimize compiler dataflows and register allocation - #502

Merged
Milky2018 merged 30 commits into
mainfrom
dev
Aug 12, 2026
Merged

Optimize compiler dataflows and register allocation#502
Milky2018 merged 30 commits into
mainfrom
dev

Conversation

@Milky2018

Copy link
Copy Markdown
Owner

Summary

  • replace nonlinear compiler analyses and register-allocation scans with indexed, worklist-based, and cursor-based implementations
  • remove the Fast allocator, unused rematerialization planner, obsolete e-graph rematerialization metadata, and the test-only regalloc/planning package
  • keep cheap MilkIR materialization recipes local, fold AArch64 constant memory displacements, and unify environment-field materialization policy across targets
  • fix sparse and resident tied-operand allocation cases and refine principled split-benefit accounting
  • make algorithm sweeps cold-cache single runs, move JIT artifacts to platform cache directories, refresh issue state, and bump every module by one patch version

Why

The compiler accumulated repeated scans, copied prefixes, dense structures, heuristic allocation fallbacks, and several planning implementations that production never called. These changes consolidate behavior in the production allocator and optimizer, remove shadow implementations, and prevent cheap constants from becoming function-long live ranges.

The benchmark workflow also now compares one freshly compiled Wasmoon/Wasmtime pair per workload with separate isolated caches, so cold compilation and generated-code performance are no longer mixed with user-global cache state.

Impact

  • the constant-address stress fixture now scales linearly at about 12 bytes per operation with zero spill, reload, or address-constant edits
  • the completed cold-cache 70-workload sweep had zero execution failures; guest-time geometric mean was 0.968x and cold wall-time geometric mean was 2.501x versus Wasmtime
  • the branch removes more code than it adds: 3,058 insertions and 6,009 deletions relative to main
  • all twelve MoonBit modules advance by one patch version, with Milky2018/wasmoon at 0.12.1

Validation

  • moon info
  • moon fmt
  • moon check --target native --warn-list +73
  • moon test --target native (2606/2606)
  • python3 scripts/audit_module_boundaries.py
  • python3 scripts/benchmark_algorithms_parity.py (70/70 completed, zero failures)
  • git diff --check

@Milky2018
Milky2018 marked this pull request as ready for review August 12, 2026 09:52
@Milky2018
Milky2018 merged commit 1b52bd1 into main Aug 12, 2026
2 checks passed
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.

1 participant