@@ -119,28 +119,10 @@ mod pointer;
119119mod queries;
120120mod value;
121121
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+ } ;
144126pub use self :: error:: {
145127 BadBytesAccess , CheckAlignMsg , CheckInAllocMsg , ErrorHandled , EvalStaticInitializerRawResult ,
146128 EvalToAllocationRawResult , EvalToConstValueResult , EvalToValTreeResult , ExpectedKind ,
@@ -149,15 +131,28 @@ pub use self::error::{
149131 ScalarSizeMismatch , UndefinedBehaviorInfo , UnsupportedOpInfo , ValidationErrorInfo ,
150132 ValidationErrorKind ,
151133} ;
152-
134+ pub use self :: pointer :: { CtfeProvenance , Pointer , PointerArithmetic , Provenance } ;
153135pub use self :: value:: Scalar ;
154136
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 } ;
161156
162157/// Uniquely identifies one of the following:
163158/// - A constant
@@ -266,8 +261,8 @@ type DecodingSessionId = NonZero<u32>;
266261#[ derive( Clone ) ]
267262enum State {
268263 Empty ,
269- InProgressNonAlloc ( TinyList < DecodingSessionId > ) ,
270- InProgress ( TinyList < DecodingSessionId > , AllocId ) ,
264+ InProgressNonAlloc ( SmallVec < [ DecodingSessionId ; 1 ] > ) ,
265+ InProgress ( SmallVec < [ DecodingSessionId ; 1 ] > , AllocId ) ,
271266 Done ( AllocId ) ,
272267}
273268
@@ -337,17 +332,15 @@ impl<'s> AllocDecodingSession<'s> {
337332 // If this is an allocation, we need to reserve an
338333 // `AllocId` so we can decode cyclic graphs.
339334 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) ;
342336 Some ( alloc_id)
343337 }
344338 AllocDiscriminant :: Fn
345339 | AllocDiscriminant :: Static
346340 | AllocDiscriminant :: VTable => {
347341 // Fns and statics cannot be cyclic, and their `AllocId`
348342 // is determined later by interning.
349- * entry =
350- State :: InProgressNonAlloc ( TinyList :: new_single ( self . session_id ) ) ;
343+ * entry = State :: InProgressNonAlloc ( smallvec ! [ self . session_id] ) ;
351344 None
352345 }
353346 }
@@ -357,7 +350,7 @@ impl<'s> AllocDecodingSession<'s> {
357350 bug ! ( "this should be unreachable" ) ;
358351 } else {
359352 // Start decoding concurrently.
360- sessions. insert ( self . session_id ) ;
353+ sessions. insert ( 0 , self . session_id ) ;
361354 None
362355 }
363356 }
@@ -367,7 +360,7 @@ impl<'s> AllocDecodingSession<'s> {
367360 return alloc_id;
368361 } else {
369362 // Start decoding concurrently.
370- sessions. insert ( self . session_id ) ;
363+ sessions. insert ( 0 , self . session_id ) ;
371364 Some ( alloc_id)
372365 }
373366 }
0 commit comments