Skip to content

Unify evaluation backends under compile.runner.run#9270

Draft
lukewilliamboswell wants to merge 1 commit intomainfrom
unify-runners
Draft

Unify evaluation backends under compile.runner.run#9270
lukewilliamboswell wants to merge 1 commit intomainfrom
unify-runners

Conversation

@lukewilliamboswell
Copy link
Copy Markdown
Collaborator

Summary

  • Adds a single compile.runner.run entry point that dispatches to all four evaluation backends (interpreter, dev/llvm JIT, wasm), removing ~170 lines of duplicated runViaDev boilerplate from cli/main.zig and glue/glue.zig
  • Adds .wasm to EvalBackend (previously only .dev, .interpreter, .llvm)
  • Propagates roc_ops.env in runViaDev so hosted functions that read the env pointer (e.g. sysml-style platforms) work correctly through the dev backend
  • Threads app_module_env through WasmEvaluator.generateWasm for platform requires clause resolution

Changes

File Change
src/backend/dev/mod.zig Add .wasm to EvalBackend + fromString
src/eval/mod.zig Re-export EvalBackend and WasmCodeResult
src/compile/runner.zig Add RunResult, EvalBackend re-export, unified run(), private runViaDev
src/cli/main.zig Replace backend switch with compile.runner.run; add .wasm arms; remove local runViaDev
src/glue/glue.zig Replace backend switch with compile.runner.run; remove local runViaDev
src/build/modules.zig Add sljmp dep + link_libc to compile module tests
src/eval/wasm_evaluator.zig Add app_module_env param to generateWasm
src/eval/test/helpers.zig Update generateWasm call site

Test plan

  • zig build — clean
  • zig build test-eval --summary all — 1224 passed, 3 skipped
  • zig build test-compile --summary all — 61 passed

🤖 Generated with Claude Code

Add a single compile.runner.run entry point that dispatches to all four
evaluation backends (interpreter, dev/llvm JIT, wasm), removing ~170 lines
of duplicated runViaDev boilerplate from cli/main.zig and glue/glue.zig.

Changes:
- Add .wasm variant to EvalBackend enum with fromString support
- Re-export EvalBackend and WasmCodeResult from eval/mod.zig
- Add RunResult union (.executed / .wasm) and unified run() to compile/runner.zig
- Move runViaDev logic into compile/runner.zig (single canonical impl)
- Propagate roc_ops.env in runViaDev so hosted fns using the env pointer work correctly
- Replace per-call-site backend switches in cli/main.zig and glue/glue.zig with run()
- Add .wasm arm to remaining exhaustive EvalBackend switches in main.zig
- Add sljmp dep + link_libc to compile module so tests link setjmp/longjmp
- Thread app_module_env through WasmEvaluator.generateWasm for platform requires clauses

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lukewilliamboswell
Copy link
Copy Markdown
Collaborator Author

Just parking this here... I don't think this is the right direction entirely but will update this PR with the right approach later.

@lukewilliamboswell lukewilliamboswell added the blocked Prevents this PR from auto-closing after 30 days of inactivity label Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked Prevents this PR from auto-closing after 30 days of inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant