Skip to content

Commit d82208c

Browse files
authored
Parallel codegen (rust-lang#1206)
* Described underlying data structures in parallel code generation and crates they are used in * Added links * replace crate information with description of types
1 parent 428670c commit d82208c

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/parallel-rustc.md

+15-3
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,24 @@ These next few sections describe where and how parallelism is currently used,
1010
and the current status of making parallel compilation the default in `rustc`.
1111

1212
The underlying thread-safe data-structures used in the parallel compiler
13-
can be found in `rustc_data_structures/sync.rs`. Some of these data structures
14-
use the `parking_lot` API.
13+
can be found in the `rustc_data_structures::sync` module. Some of these data structures
14+
use the `parking_lot` crate as well.
1515

1616
## Codegen
1717

18+
There are two underlying thread safe data structures used in code generation:
19+
20+
- `Lrc`
21+
- Which is an [`Arc`][Arc] if `parallel_compiler` is true, and a [`Rc`][Rc]
22+
if it is not.
23+
- `MetadataRef` -> [`OwningRef<Box<dyn Erased + Send + Sync>, [u8]>`][OwningRef]
24+
- This data structure is specific to `rustc`.
25+
1826
During [monomorphization][monomorphization] the compiler splits up all the code to
1927
be generated into smaller chunks called _codegen units_. These are then generated by
2028
independent instances of LLVM running in parallel. At the end, the linker
21-
is run to combine all the codegen units together into one binary.
29+
is run to combine all the codegen units together into one binary. This process
30+
occurs in the `rustc_codegen_ssa::base` module.
2231

2332
## Query System
2433

@@ -92,3 +101,6 @@ are a bit out of date):
92101
[tracking]: https://github.com/rust-lang/rust/issues/48685
93102
[monomorphization]:https://rustc-dev-guide.rust-lang.org/backend/monomorph.html
94103
[parallel-rustdoc]:https://github.com/rust-lang/rust/issues/82741
104+
[Arc]:https://doc.rust-lang.org/std/sync/struct.Arc.html
105+
[Rc]:https://doc.rust-lang.org/std/rc/struct.Rc.html
106+
[OwningRef]:https://doc.rust-lang.org/nightly/nightly-rustc/rustc_data_structures/owning_ref/index.html

0 commit comments

Comments
 (0)