@@ -10,15 +10,24 @@ These next few sections describe where and how parallelism is currently used,
1010and the current status of making parallel compilation the default in ` rustc ` .
1111
1212The 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+
1826During [ monomorphization] [ monomorphization ] the compiler splits up all the code to
1927be generated into smaller chunks called _ codegen units_ . These are then generated by
2028independent 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