Skip to content

v0.5.0

Choose a tag to compare

@tymon5368 tymon5368 released this 20 Nov 10:04
· 5 commits to main since this release
3788879

Rul (.rl) v0.5.0 — Turing-Complete Core (60-Opcode ISA)

Milestone 1 (v0.5.0) takes Rul from a 29-opcode columnar SIMD compute engine to a 60-opcode Turing-complete 128-bit binary programming language with zero-LLVM microsecond Linux x86_64 ELF64 compilation, single-pass O(N) verification, host-independent fail-closed recursion/stack bounds, and a linear-scan scalar register allocator that beats the <= 2.0x vs rustc -O performance gate across all five exit programs.


Highlights

  1. Structured Control Flow, Typed Scalar Locals & CAP_DIVERGE (v0-5-tc-core-1, PR #20)

    • Added WASM-style single-pass structured control flow (Block, Loop, If, Else, End, Br, BrIf), ConstI64, and 64 definitely-initialized typed scalar locals (LocalGet, LocalSet) with BlockSig / LoopBound witnesses.
    • Termination as a Capability Policy (CAP_DIVERGE = 0x08): Without CAP_DIVERGE, every Loop requires a verified LoopBound proof and recursive calls are rejected at load time (guaranteed termination for sandboxes/UDFs). With CAP_DIVERGE, unbounded loops and general recursion are permitted.
  2. I64/U8 Arithmetic, Declared Growable Regions & Byte I/O (v0-5-tc-core-2, PR #21)

    • Added ElemType::U8, bitwise/shift/cast/checked Div/Rem, CmpLtU, and MaskNot with deterministic fail-closed traps (exit 72 int div/rem error, exit 73 cast out of range).
    • Added statically declared growable regions (RegionDecl, RegionNew, RegionGrow, RegionLen, RegionLoad, RegionStore, RegionFree) backed by Linux SYS_mmap/SYS_mremap/SYS_munmap, declarative byte input/output regions (u8:input / u8:output), default runtime bounds checks (exit 71), and RegionIndexInBounds proof-based bounds-check elision.
  3. Modular Function Table, Recursion, Host-Independent Stack Budget & Brainf*ck Proof (v0-5-tc-core-3, PR #22)

    • Added Func..End modular scopes (Func, Return, Call, CallArg, ProofRuleKind::FuncSig = 5) with function-id indexing (>255 functions, >65,536 total nodes) and function-relative node operands.
    • Enforced host-independent deterministic limits (MAX_CALL_DEPTH = 4096, MAX_STACK_UNITS = 1 << 20, private mmap stack with bottom PROT_NONE guard page, fail-closed exit 75 even under ulimit -s 64).
    • Shipped all five v0.5 exit programs passing Tier 0 == ELF64 AOT bit-for-bit: Brainf*ck interpreter, recursive fib, in-place quicksort, prime sieve, and FIPS 180-4 sha256.
  4. Single-Pass Linear-Scan Scalar Register Allocator & Performance Gate (v0-5-tc-core-4, PR #23)

    • Replaced the one-stack-slot-per-node structured emitter in src/aot.rs with a single-pass linear-scan allocator over 10 GPRs (rdi/rsi/rdx/rcx, rbx/r12/r13/r8/r9/r10) and 14 XMM registers (xmm2..=xmm15), reusing spill slots strictly within 8 * func_frame_units(f) bytes.
    • Codegen Linearity: stress_6k (6,000 nodes) compiles in 158–190 µs (26–32 ns/node) and stress_60k (60,000 nodes) in 1.60–1.93 ms (27–32 ns/node, ~10.1x scaling for 10x nodes).
    • v0.5 Exit Performance Gate (ELF64 AOT vs rustc -O, byte-identical stdout, <= 2.0x target):
      Benchmark Rul ELF64 vs rustc -O Binary Size Codegen Time
      fib(40) 1.73x–1.98x 1,262 B ~3.6–4.3 µs
      quicksort (2M I64s) 1.46x 2,084 B ~6.6–8.5 µs
      sieve (N = 50M) 1.13x 1,752 B ~5.0–6.1 µs
      sha256 (64 MiB) 1.41x–1.66x 5,368 B ~23.7–30.1 µs
      brainfuck (3x nested loop) 1.55x–1.57x 2,964 B ~8.3–10.0 µs
  5. Columnar SIMD Upgrades & Safety Hardening (Phases P0, P1, P1b — PRs #17, #19)

    • Linear-scan 256-bit AVX2 YMM register allocator (ymm2..ymm13) + explicit Opcode::Fma (0x27) (BM-HORNER-50: 3.33x faster than hand-written 8-acc C/Rust, 2,877 B ELF64 compiled in 10.07 µs).
    • Branchless 4-lane AVX2 + FMA3 vectorized Ln/Exp (< 1e-13 relative error vs libm).
    • Hardened ArenaSlice/Gather effective bounds, exact IEEE-754 integer index validation, SYS_lseek file-size checks (zero SIGBUS), and 1 GiB arena input limit.

Install Prebuilt Linux x86_64 Binaries

curl -fsSL https://raw.githubusercontent.com/rul-lang/rul/main/install.sh | sh

Or build from source:

cargo install --git https://github.com/rul-lang/rul --tag v0.5.0 --bins --force

Full Changelog: v0.4.0...v0.5.0