diff options
| author | Sl1mb0 <tmaloney@pdx.edu> | 2021-09-16 18:58:07 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-16 20:58:07 -0500 |
| commit | 4e4e1f4a310af0252cfccd5c9dc405f8e3e7221e (patch) | |
| tree | 5cfcd8c5169a694c4f3561bfc4373fb8bab79f9a /src/doc/rustc-dev-guide | |
| parent | 8e42e56dd678855ce16dd9add73ce8fa333ce749 (diff) | |
| download | rust-4e4e1f4a310af0252cfccd5c9dc405f8e3e7221e.tar.gz rust-4e4e1f4a310af0252cfccd5c9dc405f8e3e7221e.zip | |
Parallel codegen (#1206)
* Described underlying data structures in parallel code generation and crates they are used in * Added links * replace crate information with description of types
Diffstat (limited to 'src/doc/rustc-dev-guide')
| -rw-r--r-- | src/doc/rustc-dev-guide/src/parallel-rustc.md | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/doc/rustc-dev-guide/src/parallel-rustc.md b/src/doc/rustc-dev-guide/src/parallel-rustc.md index 38230377be1..2ee302d244c 100644 --- a/src/doc/rustc-dev-guide/src/parallel-rustc.md +++ b/src/doc/rustc-dev-guide/src/parallel-rustc.md @@ -10,15 +10,24 @@ These next few sections describe where and how parallelism is currently used, and the current status of making parallel compilation the default in `rustc`. The underlying thread-safe data-structures used in the parallel compiler -can be found in `rustc_data_structures/sync.rs`. Some of these data structures -use the `parking_lot` API. +can be found in the `rustc_data_structures::sync` module. Some of these data structures +use the `parking_lot` crate as well. ## Codegen +There are two underlying thread safe data structures used in code generation: + +- `Lrc` + - Which is an [`Arc`][Arc] if `parallel_compiler` is true, and a [`Rc`][Rc] + if it is not. +- `MetadataRef` -> [`OwningRef<Box<dyn Erased + Send + Sync>, [u8]>`][OwningRef] + - This data structure is specific to `rustc`. + During [monomorphization][monomorphization] the compiler splits up all the code to be generated into smaller chunks called _codegen units_. These are then generated by independent instances of LLVM running in parallel. At the end, the linker -is run to combine all the codegen units together into one binary. +is run to combine all the codegen units together into one binary. This process +occurs in the `rustc_codegen_ssa::base` module. ## Query System @@ -92,3 +101,6 @@ are a bit out of date): [tracking]: https://github.com/rust-lang/rust/issues/48685 [monomorphization]:https://rustc-dev-guide.rust-lang.org/backend/monomorph.html [parallel-rustdoc]:https://github.com/rust-lang/rust/issues/82741 +[Arc]:https://doc.rust-lang.org/std/sync/struct.Arc.html +[Rc]:https://doc.rust-lang.org/std/rc/struct.Rc.html +[OwningRef]:https://doc.rust-lang.org/nightly/nightly-rustc/rustc_data_structures/owning_ref/index.html |
