Closed
Description
With a single driver building multiple crates we can start running more parts of the compilation process in parallel.
The basic idea is to output the metadata about a crate before code generation so that the next compile can proceed based on that metadata.
rustc gets modified in a few ways:
- Just before trans we serialize the bulk of the metadata and insert a hook to give the multi-crate driver an opportunity to copy it to another task to begin the next compilation phase. There will still be some metadata that needs to be serialized after trans.
- Insert another hook into crate resulotion for reading the metadata binary. The multi-crate driver will use this to receive the metadata output from previous crates and feed them to the next crates.
The end result is that parsing and analysis will be largely done in parallel with code generation for multi-crate builds.
Beyond that we can also parse all crates in parallel.
This would require that we make sure we are using LLVM in a threadsafe way, unless we can get all the trans passes onto a single thread.
Related to #2237