Skip to content

Mettle v0.13.0

Latest

Choose a tag to compare

@marquisburg marquisburg released this 06 Jul 18:51
f066ade

Second backend target, first-class closures, and a wave of new optimizer and
tooling work.

BREAKING CHANGE

  • The function keyword is now fn. Existing sources using function will not
    compile; rename to fn. All docs and examples have been updated.

AArch64 backend (new target)

  • --emit-arm64 compiles scalar Mettle to AArch64 ELF that runs under QEMU:
    from-scratch instruction encoder, AAPCS64 ABI, and executable emit layer.
  • Direct ir_aarch64 backend 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): interprets main() 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

  • @test functions with mettle test (interpreted, assert diagnostics, leak
    detection) and mettle trace.
  • mettle explain command, new warnings, richer diagnostics, and multi-error
    recovery.
  • Codegen annotation and profiling views in the VS Code extension.

Language

  • Local const now 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