Second backend target, first-class closures, and a wave of new optimizer and
tooling work.
BREAKING CHANGE
- The
functionkeyword is nowfn. Existing sources usingfunctionwill not
compile; rename tofn. All docs and examples have been updated.
AArch64 backend (new target)
--emit-arm64compiles scalar Mettle to AArch64 ELF that runs under QEMU:
from-scratch instruction encoder, AAPCS64 ABI, and executable emit layer.- Direct
ir_aarch64backend plus a MIR->AArch64 lowering path with vreg
stack allocation and parameter homing. - Supported: pointers, arrays, narrow ints, full scalar floats, string
literals, and write-syscall I/O.
Closures and lambdas
- Anonymous
fn(...)lambda expressions. - Capturing closures with mutations that persist across calls.
- Cross-boundary closures and revived expression-calls.
- Closures and function pointers stored in and called from struct fields.
- A plain function or non-capturing lambda flows anywhere an
Fn(...)closure
type is expected.
Optimizer and IR
- Zero-run PGO (
--pgo): interpretsmain()at compile time to drive
hot-callee inlining and hotness-aware optimizer thresholds. - Tail-recursion elimination and layout factorization passes.
- New prefetch and if-conversion IR passes.
- ML-guided IR optimization pass (
--ml-opt). - Per-pass translation validation with automatic quarantine of unsound passes.
Compile-time testing and diagnostics
@testfunctions withmettle test(interpreted, assert diagnostics, leak
detection) andmettle trace.mettle explaincommand, new warnings, richer diagnostics, and multi-error
recovery.- Codegen annotation and profiling views in the VS Code extension.
Language
- Local
constnow accepts float, string, and aggregate values.
Correctness fixes
- Fixed a gather-sum miscompile.
- Fixed float global variables reading back as 0 in the direct-object backend.
- Fixed two aggregate-by-value truncation bugs.
- Const-pool sinking now dominates all uses (#40).
Other
- New benchmark suite and examples; contributor guide; installer and Linux
build-flag fixes; dead-code cleanup.
What's Changed
- Backend, optimizer, and tooling overhaul: AArch64 target, closures, PGO/TRE, compile-time testing, and ML-guided IR opt by @marquisburg in #44
Full Changelog: v0.12.0...v0.13.0