v0.0.3 PREVIEW Rust Microprocess Runtime + Cranelift 0.118 Native AOT

Managed AOT Microprocess VM for Stateful Concurrency

Wings compiles the statically typed, immutable-value language wings-lang ahead-of-time into native machine code with compiler-enforced safepoints and exact GC roots—combining BEAM-grade fault isolation, preemptive fairness, and three-tier resource quotas with compact native value layouts.

cargo cargo install wings-compile wings-vm wings-lsp --version 0.0.3 --locked
Zero Shared State · Typed Contracts
struct Command { session_id: int, prompt: str }
  struct Reply   { session_id: int, turn: int, output: str }

  actor Worker {
    state turns = 0

    on step(cmd: Command) -> Reply {
      turns += 1
      Reply {
        session_id: cmd.session_id,
        turn: turns,
        output: f"s{cmd.session_id}#{turns}:{cmd.prompt}",
      }
    }
  }

  actor Supervisor {
    state worker: pid<Worker> = null
    state restarts = 0

    on boot -> bool {
      if worker.is_null() {
        let child = spawn(Worker)
        worker = child
        child.monitor(on_down)
        send_after(1000, tick(1))
      }
      true
    }

    on tick(n: int) { /* periodic heartbeat */ }

    on on_down(dead: pid<Worker>, reason: int) {
      if dead == worker && reason != 0 {
        restarts += 1
        let next = spawn(Worker)
        worker = next
        next.monitor(on_down)
      }
    }
  }
  1. wings-lang AST
  2. SSA + Exact Root Liveness
  3. Cranelift Native AOT
  4. wings-vm M:N Runtime
0 B
IDLE STACK
Idle Native Stack

Dormant actors hold zero native stack, borrowing 256 KiB pooled stacks only while running

O(1)
SLOT + GEN
Capability Addressing

Direct slot index + generation guard prevents stale PID reuse after termination

16-node
CHUNKED GC
Chunked Precise GC

Explicit ShadowFrame root chains, budget-polled mark-sweep, zero C-ABI unwind

3-Tier
QUOTA LEDGER
Resource Admission

Atomic VM → Tenant → Process reservation across 4 dimensions with clean rollback

CO-DESIGNED COMPILER & RUNTIME

End-to-End Managed AOT Execution Pipeline

Frontend semantics, AOT codegen, and runtime scheduling are co-designed around a narrow managed C ABI—making preemption, exact GC roots, and quota accounting deterministic.

STAGE 01 · FRONTEND

wings-lang Static Frontend

  • actor / struct / multi-state
  • Nullable pid<Actor> contracts
  • Zero-backend-dep wings-lsp
STAGE 02 · AOT COMPILER

SSA + Cranelift 0.118

  • Exact CFG root liveness
  • Backedge & call safepoints
  • manifest.json / bundle.json
STAGE 03 · MANAGED ABI

Narrow C ABI Boundary

  • Explicit ShadowFrame root chain
  • Zero Rust panic/unwind across ABI
  • Atomic state commit on return
STAGE 04 · MICROPROCESS VM

wings-vm Preemptive Runtime

  • Lock-free mailboxes (batch ≤ 32)
  • 256 KiB stack pool + timers/monitors
  • VM → Tenant → Process ledger
CORE MECHANISMS

Core Mechanisms & Design Boundaries

Co-evolving language, compiler, and runtime—never sacrificing preemption or admission safety for synthetic benchmark numbers.

Language & LSP
Zero Blocking Receive

Static Immutable Values & Typed Protocols

First-class actors, shared immutable structs, multi-state bindings, nullable pid<Actor>, str / bytes / [int], and bounded recursion—paired with non-blocking .ask(..., timeout, then) continuations and wings-lsp.

Cranelift AOT & Precise GC
Exact CFG Roots

Exact CFG Root Liveness & Chunked Mark-Sweep

Automatically instruments loop backedges, calls, and allocations with reduction/stack checks and explicit ShadowFrame chains; per-process GC polls budget every 16 nodes with zero unwind across C ABI.

Stack Pool & M:N Scheduler
256 KiB Pooled Stacks

Zero Idle Native Stack & Lock-Free Mailboxes

Suspended microprocesses hold zero native stack memory, borrowing 256 KiB pooled coroutine stacks or direct-stack fast paths on demand, backed by generation-bound lock-free fast mailboxes.

Admission & Supervision
4 Quota Dimensions

3-Tier Ledger & Bounded Crash Recovery

Reserves bytes, processes, messages, and requests across VM → Tenant → Process upfront; discards uncommitted state on fault, fires monitor notifications, and serves stdio / --tcp / --http.

ARCHITECTURE TRADE-OFFS

Runtime Trade-Off Matrix

Trading arbitrary third-party native crate linking inside actors for compact static layouts, compiler safepoints, and exact per-actor memory accounting.

RuntimeExecution ModelPreemption & Quota BoundaryPrimary Engineering Trade-Off
Native Rust Actors (Tokio)
Unrestricted native code Cooperative yield only; no automatic loop preemption or per-actor heap ledger Peak raw throughput, but fairness, memory containment, and state isolation rely on developer discipline
WASM Actors (Wasmtime)
JIT / AOT linear-memory sandbox Hardware/trap isolation designed for untrusted multi-tenant code Per-instance linear memory, tables, and host marshaling add overhead for millions of tiny sessions
BEAM (Erlang / Elixir)
JIT bytecode VM Battle-tested per-process heaps, reduction preemption & OTP supervision Dynamic tagged words and dispatch leave headroom in dense session and compute-mixed workloads
Wings VM
Managed wings-lang Native AOT Compiler safepoints + exact GC + 3-tier admission ledger Purpose-built for trusted first-party workloads (--trusted) needing high session density & fault containment
VERIFICATION & TRANSPARENCY

Engineering Status & Benchmark Boundaries

Every paired benchmark and memory ledger claim states its exact host environment, CPU quota, and remaining boundaries.

VERIFIED IN CI · DUAL-PLATFORM

Implemented & Guarded in Automated Suites

  • Single-actor build, multi-actor build-app bundles, and wings-vm serve over stdio, --tcp, and --http
  • Passes hot-queue, sparse-256 (10k actors), mixed-4k, and fairness vs. BEAM on Linux x86-64 (cgroup v2 2-vCPU hard quota, OTP 28) and local Apple Silicon (OTP 29)
  • 3-tier resource ledger (128 B AccountNode) + zero-RMW WingsAllocator + OS footprint audit (10k sparse actors: ~36.4 MB vs. BEAM ~94.0 MB process-tree PSS on Linux with ~20.2 MB standalone VM peak heap; ~20.1 MB peak heap / ~6.0 MB OS footprint on local Apple Silicon)
  • Inline single-buffer heap (BufferStorage::One), bitmap precise GC, segmented lock-free mailboxes (448 B control / 64 B Envelope), 64 B actor slots & non-blocking Reactor (Linux cgroup v2: hot-queue ~3.4 µs vs. BEAM ~6.6 µs, mixed-4k ~3.9 µs vs. ~32.5 µs, fairness ~2,690.8/s vs. ~126.0/s & heartbeat p99 ~187 µs vs. ~458 µs; Apple Silicon: hot-queue ~5.4 µs vs. ~14.5 µs, heartbeat p99 ~218 µs vs. ~445 µs)
KNOWN BOUNDARIES & NEXT

Honest Caveats & Upcoming Roadmap

  • Pre-release micro-benchmark scope: still in 0.0.x evolution; numbers reflect bounded 3–5s micro-workloads, shared virtualized cloud macOS runners remain subject to hypervisor jitter, and 30s/60s 5-pair scripts remain for dedicated bare-metal sign-off
  • Managed C ABI stabilization: zero backward-compatibility guarantees during 0.0.x; SCALAR_ABI_VERSION acts as an artifact mismatch guard, with formal ABI freeze and v1 reset planned for 0.1.0
  • Dynamic loader metadata: dyld / ld.so structures outside the Rust global allocator are audited via whole-process OS footprint/PSS rather than per-tenant accounts
  • 0.1.0 language & supervision roadmap: general T? optionals, enum / Reply<T>, multi-file module imports, and declarative supervision trees are scheduled for upcoming milestones
CANONICAL DOCS

Explore the 7 Core Documents

Rendered directly from docs/ in the repository—concise, concrete, and free of marketing hype.