File tree Expand file tree Collapse file tree 6 files changed +13
-15
lines changed
rustc_data_structures/src
rustc_query_system/src/query Expand file tree Collapse file tree 6 files changed +13
-15
lines changed Original file line number Diff line number Diff line change @@ -37,9 +37,10 @@ use std::ptr::{self, NonNull};
3737use std:: slice;
3838use std:: { cmp, intrinsics} ;
3939
40+ /// This calls the passed function while ensuring it won't be inlined into the caller.
4041#[ inline( never) ]
4142#[ cold]
42- fn cold_path < F : FnOnce ( ) -> R , R > ( f : F ) -> R {
43+ fn outline < F : FnOnce ( ) -> R , R > ( f : F ) -> R {
4344 f ( )
4445}
4546
@@ -600,7 +601,7 @@ impl DroplessArena {
600601 unsafe { self . write_from_iter ( iter, len, mem) }
601602 }
602603 ( _, _) => {
603- cold_path ( move || -> & mut [ T ] {
604+ outline ( move || -> & mut [ T ] {
604605 let mut vec: SmallVec < [ _ ; 8 ] > = iter. collect ( ) ;
605606 if vec. is_empty ( ) {
606607 return & mut [ ] ;
Original file line number Diff line number Diff line change @@ -51,9 +51,10 @@ use std::fmt;
5151
5252pub use rustc_index:: static_assert_size;
5353
54+ /// This calls the passed function while ensuring it won't be inlined into the caller.
5455#[ inline( never) ]
5556#[ cold]
56- pub fn cold_path < F : FnOnce ( ) -> R , R > ( f : F ) -> R {
57+ pub fn outline < F : FnOnce ( ) -> R , R > ( f : F ) -> R {
5758 f ( )
5859}
5960
Original file line number Diff line number Diff line change 8181//!
8282//! [mm]: https://github.com/rust-lang/measureme/
8383
84- use crate :: cold_path;
8584use crate :: fx:: FxHashMap ;
85+ use crate :: outline;
8686
8787use std:: borrow:: Borrow ;
8888use std:: collections:: hash_map:: Entry ;
@@ -697,7 +697,7 @@ impl<'a> TimingGuard<'a> {
697697 #[ inline]
698698 pub fn finish_with_query_invocation_id ( self , query_invocation_id : QueryInvocationId ) {
699699 if let Some ( guard) = self . 0 {
700- cold_path ( || {
700+ outline ( || {
701701 let event_id = StringId :: new_virtual ( query_invocation_id. 0 ) ;
702702 let event_id = EventId :: from_virtual ( event_id) ;
703703 guard. finish_with_override_event_id ( event_id) ;
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ use std::ptr;
66use std:: sync:: Arc ;
77
88#[ cfg( parallel_compiler) ]
9- use { crate :: cold_path , crate :: sync:: CacheAligned } ;
9+ use { crate :: outline , crate :: sync:: CacheAligned } ;
1010
1111/// A pointer to the `RegistryData` which uniquely identifies a registry.
1212/// This identifier can be reused if the registry gets freed.
@@ -25,11 +25,7 @@ impl RegistryId {
2525 fn verify ( self ) -> usize {
2626 let ( id, index) = THREAD_DATA . with ( |data| ( data. registry_id . get ( ) , data. index . get ( ) ) ) ;
2727
28- if id == self {
29- index
30- } else {
31- cold_path ( || panic ! ( "Unable to verify registry association" ) )
32- }
28+ if id == self { index } else { outline ( || panic ! ( "Unable to verify registry association" ) ) }
3329 }
3430}
3531
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ use rustc_data_structures::sharded::Sharded;
1818use rustc_data_structures:: stack:: ensure_sufficient_stack;
1919use rustc_data_structures:: sync:: Lock ;
2020#[ cfg( parallel_compiler) ]
21- use rustc_data_structures:: { cold_path , sync} ;
21+ use rustc_data_structures:: { outline , sync} ;
2222use rustc_errors:: { DiagnosticBuilder , ErrorGuaranteed , FatalError } ;
2323use rustc_span:: { Span , DUMMY_SP } ;
2424use std:: cell:: Cell ;
@@ -265,7 +265,7 @@ where
265265 match result {
266266 Ok ( ( ) ) => {
267267 let Some ( ( v, index) ) = query. query_cache ( qcx) . lookup ( & key) else {
268- cold_path ( || {
268+ outline ( || {
269269 // We didn't find the query result in the query cache. Check if it was
270270 // poisoned due to a panic instead.
271271 let lock = query. query_state ( qcx) . active . get_shard_by_value ( & key) . lock ( ) ;
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ extern crate rustc_macros;
3333#[ macro_use]
3434extern crate tracing;
3535
36- use rustc_data_structures:: { cold_path , AtomicRef } ;
36+ use rustc_data_structures:: { outline , AtomicRef } ;
3737use rustc_macros:: HashStable_Generic ;
3838use rustc_serialize:: { Decodable , Decoder , Encodable , Encoder } ;
3939
@@ -1592,7 +1592,7 @@ impl SourceFile {
15921592 return & lines[ ..] ;
15931593 }
15941594
1595- cold_path ( || {
1595+ outline ( || {
15961596 self . convert_diffs_to_lines_frozen ( ) ;
15971597 if let Some ( SourceFileLines :: Lines ( lines) ) = self . lines . get ( ) {
15981598 return & lines[ ..] ;
You can’t perform that action at this time.
0 commit comments