@@ -10,15 +10,24 @@ These next few sections describe where and how parallelism is currently used,
10
10
and the current status of making parallel compilation the default in ` rustc ` .
11
11
12
12
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 .
15
15
16
16
## Codegen
17
17
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
+
18
26
During [ monomorphization] [ monomorphization ] the compiler splits up all the code to
19
27
be generated into smaller chunks called _ codegen units_ . These are then generated by
20
28
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.
22
31
23
32
## Query System
24
33
@@ -92,3 +101,6 @@ are a bit out of date):
92
101
[ tracking ] : https://github.com/rust-lang/rust/issues/48685
93
102
[ monomorphization ] :https://rustc-dev-guide.rust-lang.org/backend/monomorph.html
94
103
[ 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