-
-
Notifications
You must be signed in to change notification settings - Fork 26
Reuse one prepared frontend program for multiple emit outputs #775
Copy link
Copy link
Open
Labels
help wantedThe issue requires extra attention or help from others.The issue requires extra attention or help from others.needs testingIssues that require additional testing or verification.Issues that require additional testing or verification.performanceIssues related to performance or optimization.Issues related to performance or optimization.refactorIssues that require code refactoring without changing functionality.Issues that require code refactoring without changing functionality.
Description
Activity
Metadata
Metadata
Assignees
Labels
help wantedThe issue requires extra attention or help from others.The issue requires extra attention or help from others.needs testingIssues that require additional testing or verification.Issues that require additional testing or verification.performanceIssues related to performance or optimization.Issues related to performance or optimization.refactorIssues that require code refactoring without changing functionality.Issues that require code refactoring without changing functionality.
Problem
Each Wave artifact emitter prepares the frontend again. Emitting AST, IR, bitcode, assembly and object for one source repeats tokenization five times, whereas object-only emission tokenizes once.
Starting points: src/cli.rs, src/runner.rs.
Reproduction and measurement
Tested at
6257ba3eb4b9f1ab6c247a920c6e0c4b5d699331on Linux amd64 with LLVM 21.1.8 and a compiler built from that checkout. Build it withLLVM_SYS_211_PREFIX=/usr/lib64/llvm21 cargo build --locked --jobs 2.Save
fun main() -> i32 { return 0; }asrepro.wave, then run:One run of each command showed 1 versus 5 token-stream dumps. Source inspection confirms each emitter calls frontend preparation again. These are invocation counts, not a measured speedup.
Results
Object-only: 1 frontend token stream. Combined five-artifact emit: 5 token streams. Output generation itself succeeds.
Scope
Share one prepared frontend result per source/target/options combination across emitters. Keep LLVM module/pass mutation concerns separate; reusing typed HIR must not accidentally share mutable backend state or cross configuration boundaries.
Difficulty: hard.
Completion criteria