Skip to content

feat(t27b): native AArch64 backend for a subset of t27, no LLVM - #5979

Merged
gHashTag merged 1 commit into
masterfrom
claude/t27b-native-backend
Oct 4, 2026
Merged

gHashTag merged 1 commit into
masterfrom
claude/t27b-native-backend

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Summary

A new workspace crate, cli/t27b, compiles a subset of t27 straight to AArch64 machine code. LLVM, zig, clang and rustc are not involved.

  • Front end: t27c's own Parser and typecheck_ast, mounted by path and unchanged. The sealed compiler is not modified.
  • Pipeline: front (typed AST) -> lower (t27b IR) -> codegen (A64 words) -> one of two outputs:
    • jit: MAP_JIT, run in-process;
    • macho: a MH_OBJECT file.
  • Oracle: eval is a reference interpreter over the same IR.
  • Defined integer semantics: overflow traps or wraps (--overflow trap|wrap). A shift amount outside [0, width) traps.
  • Portability: the JIT is arm64 macOS only. On other hosts the crate builds (cargo check --target x86_64-unknown-linux-gnu -p t27b --all-targets passes) and Jit::load returns an error.

Measured

The machine was heavily loaded, so treat the speed figures as approximate.

result
JIT vs interpreter, 2500 random programs per overflow mode 0 mismatches
JIT vs clang, up to 5M calls 0 mismatches
vs t27c gen + zig test, median 381x faster (N=100), 103x (N=1000), 23x (N=5000)
vs t27c gen-c + clang 5-65x faster
generated code speed about clang -O0; 1.55-1.83x slower than clang -O2
cargo test --release -p t27b on this branch 7/7
t27b corpus specs on this branch 37 supported (36 pass; 1 fails, ternary_model, a real spec bug fixed in #5975), 0 JIT/interpreter mismatches

Bugs it found

Follow-up

Wider coverage is #5977: structs, string literals, enums, invariant blocks and casts. It will come as a separate PR.

Closes #5976. Part of #5905.

🤖 Generated with Claude Code

New workspace crate cli/t27b. It mounts t27c's front end
(bootstrap/src/compiler.rs, use_resolve.rs) unchanged, lowers the typed
AST to its own IR, and compiles that IR to A64 machine code. The code is
run in-process from a MAP_JIT region (`t27b test`) or written as a
Mach-O MH_OBJECT (`t27b build`).

Integer semantics are defined: overflow traps or wraps (--overflow) and
a shift amount outside [0, width) traps. A reference interpreter
(eval.rs) is the oracle for a seeded differential test of 2500 random
programs per overflow mode; there are 0 mismatches.

The JIT is arm64 macOS only. On other hosts the crate still builds and
Jit::load returns an error; the differential test is compiled only on
arm64 macOS.

Coverage is 37 of 1174 specs; widening it is #5977.

Closes #5976

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-04 09:24:53 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 43
PRs with All Checks Green 7
READY 2
FAILING 43
PENDING 0
NO CHECKS YET 0

These columns do not partition: 2 + 43 + 0 + 0 = 45, and there are 50 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=f4a1fbade08e != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

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.

t27b: native AArch64 backend for a subset of t27 (no LLVM)

1 participant