Unify evaluation backends under compile.runner.run#9270
Draft
lukewilliamboswell wants to merge 1 commit intomainfrom
Draft
Unify evaluation backends under compile.runner.run#9270lukewilliamboswell wants to merge 1 commit intomainfrom
lukewilliamboswell wants to merge 1 commit intomainfrom
Conversation
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>
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
compile.runner.runentry point that dispatches to all four evaluation backends (interpreter, dev/llvm JIT, wasm), removing ~170 lines of duplicatedrunViaDevboilerplate fromcli/main.zigandglue/glue.zig.wasmtoEvalBackend(previously only.dev,.interpreter,.llvm)roc_ops.envinrunViaDevso hosted functions that read the env pointer (e.g. sysml-style platforms) work correctly through the dev backendapp_module_envthroughWasmEvaluator.generateWasmfor platformrequiresclause resolutionChanges
src/backend/dev/mod.zig.wasmtoEvalBackend+fromStringsrc/eval/mod.zigEvalBackendandWasmCodeResultsrc/compile/runner.zigRunResult,EvalBackendre-export, unifiedrun(), privaterunViaDevsrc/cli/main.zigcompile.runner.run; add.wasmarms; remove localrunViaDevsrc/glue/glue.zigcompile.runner.run; remove localrunViaDevsrc/build/modules.zigsljmpdep +link_libcto compile module testssrc/eval/wasm_evaluator.zigapp_module_envparam togenerateWasmsrc/eval/test/helpers.ziggenerateWasmcall siteTest plan
zig build— cleanzig build test-eval --summary all— 1224 passed, 3 skippedzig build test-compile --summary all— 61 passed🤖 Generated with Claude Code