You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/backend/monomorph.md
+20
Original file line number
Diff line number
Diff line change
@@ -55,8 +55,28 @@ The monomorphization collector is run just before MIR lowering and codegen.
55
55
collection and then partitions them into [codegen
56
56
units](../appendix/glossary.md#codegen-unit).
57
57
58
+
## Codegen Unit (CGU) partitioning
59
+
60
+
For better incremental build times, the CGU partitioner creates two CGU for each source level
61
+
modules. One is for "stable" i.e. non-generic code and the other is more volatile code i.e.
62
+
monoporphized/specialized instances.
63
+
64
+
For depenencies, consider Crate A and Crate B, such that Crate B depends on Crate A.
65
+
The following table lists different scenarios for a function in Crate A that might be used by one
66
+
or more modules in Crate B.
67
+
68
+
| Crate A function | Behavior |
69
+
| - | - |
70
+
| Non-generic function | Crate A function doesn't appear in any codegen units of Crate B |
71
+
| Non-generic `#[inline]` function | Crate A function appears with in a single CGU of Crate B, and exists even after post-inlining stage|
72
+
| Generic function | Regardless of inlining, all monoporphized (specialized) functions <br> from Crate A appear within a single codegen unit for Crate B. <br> The codegen unit exists even after the post inlining stage.|
73
+
| Generic `#[inline]` function | - same - |
74
+
75
+
For more details about the partitioner read the module level [documentation].
0 commit comments