Skip to content

Add interpreter, portable AOT, and tiered native JIT engines - #21

Merged
Neonwave175 merged 11 commits into
mainfrom
feat/tell-bytecode-jit-engine
Nov 19, 2026
Merged

Neonwave175 merged 11 commits into
mainfrom
feat/tell-bytecode-jit-engine

Conversation

@KernelGhost-gif

@KernelGhost-gif KernelGhost-gif commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

This adds a first native JIT tier to the production Go bytecode VM while preserving the current interpreter as the compatibility path and the existing .tbc build as portable AOT bytecode.

Three execution paths

  • Interpreter: remains the default for source and bytecode execution.
  • AOT: tell build compiles the supported source subset to the portable tell-bytecode-v1 artifact. It is not a standalone native executable.
  • JIT: --engine jit compiles eligible typed numeric functions to native Linux/amd64 machine code on first call.
  • Auto: --engine auto interprets hot functions during warm-up (default threshold 24), then compiles eligible functions and caches the machine code.

JIT scope and safety

  • Initial native subset: straight-line typed number/decimal functions using numeric constants, parameter loads, unary plus/minus, addition, subtraction, multiplication, and return.
  • Division intentionally remains interpreted so division-by-zero preserves Tell's language error rather than producing IEEE infinity.
  • Control flow, recursion, closures, collections, I/O, methods, calls, comparisons, dynamic values, variadics and default arguments remain interpreter-fallback cases.
  • Linux/amd64 has the native backend. Other platforms keep the interpreter; explicit --engine jit reports the platform limitation.
  • Executable code pages are emitted writable and then changed to read/execute. Native mappings are released when the bytecode execution finishes.
  • Per-function cache keys are assigned once per artifact, avoiding serialization and hashing of the full function on every hot invocation.

CLI

  • tell --engine interp program.tell
  • tell --engine jit program.tell
  • tell --engine auto --jit-threshold 24 --jit-stats program.tell
  • The same engine choices work for existing .tbc artifacts.

Validation and benchmark

  • Linux JIT tests, race detector, and vet pass.
  • Full Linux, Windows, and macOS runtime validation passed on the core engine implementation.
  • The focused JIT CI workflow passes and benchmarks a 159-operation typed numeric function.

Initial Ubuntu 24.04 / Go 1.23.x CI benchmark (warmed-up calls):

Engine Time per call Allocations per call
Interpreter 6,362 ns 167
Native JIT 608 ns 9
Auto 623 ns 9

This is a synthetic compute-heavy function benchmark, not a guarantee for all Tell programs. The benchmark excludes the JIT's one-time compilation cost and does not measure whole-program startup or I/O.

This is an initial JIT backend, not an LLVM ORC integration, whole-program optimizer, or native machine-code AOT compiler. tell build remains AOT to portable VM bytecode.

@Neonwave175
Neonwave175 merged commit 95aad80 into main Nov 19, 2026
4 checks passed
@KernelGhost-gif
KernelGhost-gif deleted the feat/tell-bytecode-jit-engine branch November 19, 2026 13:04
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.

2 participants