@@ -119,28 +119,10 @@ mod pointer;
119
119
mod queries;
120
120
mod value;
121
121
122
- use std:: fmt;
123
- use std:: io;
124
- use std:: io:: { Read , Write } ;
125
- use std:: num:: NonZero ;
126
- use std:: sync:: atomic:: { AtomicU32 , Ordering } ;
127
-
128
- use rustc_ast:: LitKind ;
129
- use rustc_data_structures:: fx:: FxHashMap ;
130
- use rustc_data_structures:: sync:: { HashMapExt , Lock } ;
131
- use rustc_data_structures:: tiny_list:: TinyList ;
132
- use rustc_errors:: ErrorGuaranteed ;
133
- use rustc_hir:: def_id:: { DefId , LocalDefId } ;
134
- use rustc_macros:: { HashStable , TyDecodable , TyEncodable , TypeFoldable , TypeVisitable } ;
135
- use rustc_middle:: ty:: print:: with_no_trimmed_paths;
136
- use rustc_serialize:: { Decodable , Encodable } ;
137
- use rustc_target:: abi:: { AddressSpace , Endian , HasDataLayout } ;
138
-
139
- use crate :: mir;
140
- use crate :: ty:: codec:: { TyDecoder , TyEncoder } ;
141
- use crate :: ty:: GenericArgKind ;
142
- use crate :: ty:: { self , Instance , Ty , TyCtxt } ;
143
-
122
+ pub use self :: allocation:: {
123
+ alloc_range, AllocBytes , AllocError , AllocRange , AllocResult , Allocation , ConstAllocation ,
124
+ InitChunk , InitChunkIter ,
125
+ } ;
144
126
pub use self :: error:: {
145
127
BadBytesAccess , CheckAlignMsg , CheckInAllocMsg , ErrorHandled , EvalStaticInitializerRawResult ,
146
128
EvalToAllocationRawResult , EvalToConstValueResult , EvalToValTreeResult , ExpectedKind ,
@@ -149,15 +131,28 @@ pub use self::error::{
149
131
ScalarSizeMismatch , UndefinedBehaviorInfo , UnsupportedOpInfo , ValidationErrorInfo ,
150
132
ValidationErrorKind ,
151
133
} ;
152
-
134
+ pub use self :: pointer :: { CtfeProvenance , Pointer , PointerArithmetic , Provenance } ;
153
135
pub use self :: value:: Scalar ;
154
136
155
- pub use self :: allocation:: {
156
- alloc_range, AllocBytes , AllocError , AllocRange , AllocResult , Allocation , ConstAllocation ,
157
- InitChunk , InitChunkIter ,
158
- } ;
159
-
160
- pub use self :: pointer:: { CtfeProvenance , Pointer , PointerArithmetic , Provenance } ;
137
+ use crate :: mir;
138
+ use crate :: ty:: codec:: { TyDecoder , TyEncoder } ;
139
+ use crate :: ty:: GenericArgKind ;
140
+ use crate :: ty:: { self , Instance , Ty , TyCtxt } ;
141
+ use rustc_ast:: LitKind ;
142
+ use rustc_data_structures:: fx:: FxHashMap ;
143
+ use rustc_data_structures:: sync:: { HashMapExt , Lock } ;
144
+ use rustc_errors:: ErrorGuaranteed ;
145
+ use rustc_hir:: def_id:: { DefId , LocalDefId } ;
146
+ use rustc_macros:: { HashStable , TyDecodable , TyEncodable , TypeFoldable , TypeVisitable } ;
147
+ use rustc_middle:: ty:: print:: with_no_trimmed_paths;
148
+ use rustc_serialize:: { Decodable , Encodable } ;
149
+ use rustc_target:: abi:: { AddressSpace , Endian , HasDataLayout } ;
150
+ use smallvec:: { smallvec, SmallVec } ;
151
+ use std:: fmt;
152
+ use std:: io;
153
+ use std:: io:: { Read , Write } ;
154
+ use std:: num:: NonZero ;
155
+ use std:: sync:: atomic:: { AtomicU32 , Ordering } ;
161
156
162
157
/// Uniquely identifies one of the following:
163
158
/// - A constant
@@ -266,8 +261,8 @@ type DecodingSessionId = NonZero<u32>;
266
261
#[ derive( Clone ) ]
267
262
enum State {
268
263
Empty ,
269
- InProgressNonAlloc ( TinyList < DecodingSessionId > ) ,
270
- InProgress ( TinyList < DecodingSessionId > , AllocId ) ,
264
+ InProgressNonAlloc ( SmallVec < [ DecodingSessionId ; 1 ] > ) ,
265
+ InProgress ( SmallVec < [ DecodingSessionId ; 1 ] > , AllocId ) ,
271
266
Done ( AllocId ) ,
272
267
}
273
268
@@ -337,17 +332,15 @@ impl<'s> AllocDecodingSession<'s> {
337
332
// If this is an allocation, we need to reserve an
338
333
// `AllocId` so we can decode cyclic graphs.
339
334
let alloc_id = decoder. interner ( ) . reserve_alloc_id ( ) ;
340
- * entry =
341
- State :: InProgress ( TinyList :: new_single ( self . session_id ) , alloc_id) ;
335
+ * entry = State :: InProgress ( smallvec ! [ self . session_id] , alloc_id) ;
342
336
Some ( alloc_id)
343
337
}
344
338
AllocDiscriminant :: Fn
345
339
| AllocDiscriminant :: Static
346
340
| AllocDiscriminant :: VTable => {
347
341
// Fns and statics cannot be cyclic, and their `AllocId`
348
342
// is determined later by interning.
349
- * entry =
350
- State :: InProgressNonAlloc ( TinyList :: new_single ( self . session_id ) ) ;
343
+ * entry = State :: InProgressNonAlloc ( smallvec ! [ self . session_id] ) ;
351
344
None
352
345
}
353
346
}
@@ -357,7 +350,7 @@ impl<'s> AllocDecodingSession<'s> {
357
350
bug ! ( "this should be unreachable" ) ;
358
351
} else {
359
352
// Start decoding concurrently.
360
- sessions. insert ( self . session_id ) ;
353
+ sessions. insert ( 0 , self . session_id ) ;
361
354
None
362
355
}
363
356
}
@@ -367,7 +360,7 @@ impl<'s> AllocDecodingSession<'s> {
367
360
return alloc_id;
368
361
} else {
369
362
// Start decoding concurrently.
370
- sessions. insert ( self . session_id ) ;
363
+ sessions. insert ( 0 , self . session_id ) ;
371
364
Some ( alloc_id)
372
365
}
373
366
}
0 commit comments