@@ -117,23 +117,23 @@ impl<'tcx> Partition<'tcx> for DefaultPartitioning {
117
117
// njn: type ann?
118
118
let total_size: usize = codegen_units. iter ( ) . map ( |cgu| cgu. size_estimate ( ) ) . sum ( ) ;
119
119
let target_size = total_size / cx. target_cgu_count ;
120
- eprintln ! ( "----" ) ;
121
- eprintln ! ( "SPLIT0: total:{} target:{}" , total_size, target_size) ;
120
+ // eprintln!("----");
121
+ // eprintln!("SPLIT0: total:{} target:{}", total_size, target_size);
122
122
// njn: need a while loop because we're modifying codegen_units as we go
123
123
// njn: make it a for loop?
124
124
// njn: explain all this
125
125
let mut i = 0 ;
126
126
let mut j = 0 ; // njn: explain
127
127
let n = codegen_units. len ( ) ;
128
128
while i < n {
129
- let old_cgu = & mut codegen_units[ i] ;
129
+ let old_cgu = & mut codegen_units[ i] ;
130
130
if old_cgu. size_estimate ( ) > target_size && old_cgu. items ( ) . len ( ) > 1 {
131
- eprintln ! ( "SPLIT1: old:{} old:{}" , old_cgu. size_estimate( ) , old_cgu. name( ) ) ;
131
+ // eprintln!("SPLIT1: old:{} old:{}", old_cgu.size_estimate(), old_cgu.name());
132
132
133
133
// njn: too big; split
134
134
// njn: explain how a very big CGU will be split multiple
135
135
// times
136
-
136
+
137
137
let mut new_name = old_cgu. name ( ) . to_string ( ) ;
138
138
new_name += & format ! ( "-split{}" , j) ;
139
139
let mut new_cgu = CodegenUnit :: new ( Symbol :: intern ( & new_name) ) ;
@@ -144,13 +144,17 @@ impl<'tcx> Partition<'tcx> for DefaultPartitioning {
144
144
145
145
// njn: what if this empties old_cgu?
146
146
147
+ // njn: non-deterministic iteration results in
148
+ // non-deterministic splitting, which messes up incremental
149
+ // compilation
150
+
147
151
// njn: nicer way to do this?
148
152
// njn: don't move if it's the last item
149
153
old_cgu. items_mut ( ) . drain_filter ( |item, rest| {
150
154
// njn: true->remove
151
155
if moved_size < target_size {
152
156
let item_size = item. size_estimate ( cx. tcx ) ;
153
- eprintln ! ( "MOVE: {}" , item_size) ;
157
+ // eprintln!("MOVE: {}", item_size);
154
158
moved_size += item_size;
155
159
new_cgu. items_mut ( ) . insert ( * item, * rest) ;
156
160
true
@@ -161,7 +165,7 @@ impl<'tcx> Partition<'tcx> for DefaultPartitioning {
161
165
new_cgu. increase_size_estimate ( moved_size) ;
162
166
old_cgu. decrease_size_estimate ( moved_size) ;
163
167
164
- eprintln ! ( "SPLIT2: old:{} -> new:{} new:{}" , old_cgu. size_estimate( ) , new_cgu. size_estimate( ) , new_cgu. name( ) ) ;
168
+ // eprintln!("SPLIT2: old:{} -> new:{} new:{}", old_cgu.size_estimate(), new_cgu.size_estimate(), new_cgu.name());
165
169
166
170
codegen_units. push ( new_cgu) ;
167
171
// njn: explain lack of `i += 1`;
0 commit comments