From 73cd44abf8fb24759f50955ae71506195e8f81b4 Mon Sep 17 00:00:00 2001 From: Timothy Maloney Date: Mon, 13 Sep 2021 12:02:30 -0700 Subject: [PATCH 1/6] Described underlying data structures in parallel code generation and crates they are used in --- src/parallel-rustc.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/parallel-rustc.md b/src/parallel-rustc.md index 38230377b..d61a678c8 100644 --- a/src/parallel-rustc.md +++ b/src/parallel-rustc.md @@ -10,15 +10,27 @@ 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` crate. 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. +The crates they are used in are listed below: + +- `Lrc` -> `Arc` + - `rustc_codegen_llvm::debuginfo::DebugLoc` + - `rustc_codegen_ssa::back::write` + - `rustc_codegen_ssa` +- `MetadataRef` -> `OwningRef, [u8]>` + - `rustc_codegen_ssa::traits::backend` + - `rustc_codegen_ssa::back::metadata` + 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` crate. ## Query System From 6d263bf88d8d08e655c2ede7bc884d188ea17705 Mon Sep 17 00:00:00 2001 From: Timothy Maloney Date: Mon, 13 Sep 2021 12:08:17 -0700 Subject: [PATCH 2/6] Added links --- src/parallel-rustc.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/parallel-rustc.md b/src/parallel-rustc.md index d61a678c8..68fb7449b 100644 --- a/src/parallel-rustc.md +++ b/src/parallel-rustc.md @@ -18,11 +18,11 @@ use the `parking_lot` crate as well. There are two underlying thread safe data structures used in code generation. The crates they are used in are listed below: -- `Lrc` -> `Arc` +- `Lrc` -> [`Arc`][Arc] - `rustc_codegen_llvm::debuginfo::DebugLoc` - `rustc_codegen_ssa::back::write` - `rustc_codegen_ssa` -- `MetadataRef` -> `OwningRef, [u8]>` +- `MetadataRef` -> [`OwningRef, [u8]>`][OwningRef] - `rustc_codegen_ssa::traits::backend` - `rustc_codegen_ssa::back::metadata` @@ -104,3 +104,5 @@ 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 +[OwningRef]:https://kimundi.github.io/owning-ref-rs/owning_ref/struct.OwningRef.html From d3fdd46ebe7fa0029a058d075ded005b3118711b Mon Sep 17 00:00:00 2001 From: Timothy Maloney Date: Wed, 15 Sep 2021 11:23:45 -0700 Subject: [PATCH 3/6] Made suggested changes --- src/parallel-rustc.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/parallel-rustc.md b/src/parallel-rustc.md index 68fb7449b..531b72733 100644 --- a/src/parallel-rustc.md +++ b/src/parallel-rustc.md @@ -11,7 +11,7 @@ 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 the `rustc_data_structures::sync` crate. Some of these data structures -use the `parking_lot` crate as well. +use the `parking_lot` module as well. ## Codegen @@ -30,7 +30,7 @@ During [monomorphization][monomorphization] the compiler splits up all the code 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. This process -occurs in the `rustc_codegen_ssa::base` crate. +occurs in the `rustc_codegen_ssa::base` module. ## Query System @@ -105,4 +105,4 @@ are a bit out of date): [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 -[OwningRef]:https://kimundi.github.io/owning-ref-rs/owning_ref/struct.OwningRef.html +[OwningRef]:https://doc.rust-lang.org/beta/nightly-rustc/rustc_data_structures/owning_ref/index.html From 9afa8fb59a2ae143ad6d491e34c8ff4c41ff7825 Mon Sep 17 00:00:00 2001 From: Timothy Maloney Date: Wed, 15 Sep 2021 11:35:26 -0700 Subject: [PATCH 4/6] Made some more suggested changes --- src/parallel-rustc.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/parallel-rustc.md b/src/parallel-rustc.md index 531b72733..f0f4f7fb2 100644 --- a/src/parallel-rustc.md +++ b/src/parallel-rustc.md @@ -10,8 +10,8 @@ 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 the `rustc_data_structures::sync` crate. Some of these data structures -use the `parking_lot` module as well. +can be found in the `rustc_data_structures::sync` module. Some of these data structures +use the `parking_lot` crate as well. ## Codegen @@ -105,4 +105,4 @@ are a bit out of date): [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 -[OwningRef]:https://doc.rust-lang.org/beta/nightly-rustc/rustc_data_structures/owning_ref/index.html +[OwningRef]:https://doc.rust-lang.org/nightly/nightly-rustc/rustc_data_structures/owning_ref/index.html From 4c3e3e75b12400101192180c81aff9c3b4952467 Mon Sep 17 00:00:00 2001 From: Timothy Maloney Date: Thu, 16 Sep 2021 14:56:02 -0700 Subject: [PATCH 5/6] replace crate information with description of types --- src/parallel-rustc.md | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/parallel-rustc.md b/src/parallel-rustc.md index f0f4f7fb2..ad37061a4 100644 --- a/src/parallel-rustc.md +++ b/src/parallel-rustc.md @@ -15,16 +15,13 @@ use the `parking_lot` crate as well. ## Codegen -There are two underlying thread safe data structures used in code generation. -The crates they are used in are listed below: +There are two underlying thread safe data structures used in code generation: -- `Lrc` -> [`Arc`][Arc] - - `rustc_codegen_llvm::debuginfo::DebugLoc` - - `rustc_codegen_ssa::back::write` - - `rustc_codegen_ssa` +- `Lrc` + - Which is an [`Arc`][Arc] if `parallel_compiler` is true, and a [`Rc`][Rc] + if it is not. - `MetadataRef` -> [`OwningRef, [u8]>`][OwningRef] - - `rustc_codegen_ssa::traits::backend` - - `rustc_codegen_ssa::back::metadata` + - 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 From 7f7ef1591f2fb41c0d6226f2ac331b52d041e5f5 Mon Sep 17 00:00:00 2001 From: Timothy Maloney Date: Thu, 16 Sep 2021 15:00:03 -0700 Subject: [PATCH 6/6] Added links --- src/parallel-rustc.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/parallel-rustc.md b/src/parallel-rustc.md index ad37061a4..2ee302d24 100644 --- a/src/parallel-rustc.md +++ b/src/parallel-rustc.md @@ -102,4 +102,5 @@ are a bit out of date): [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