Rename cold_path to outline

This commit is contained in:
John Kåre Alsaker 2023-09-25 03:27:25 +02:00
parent 91958e0a74
commit 2c507cae36
6 changed files with 13 additions and 15 deletions

View file

@ -51,9 +51,10 @@ use std::fmt;
pub use rustc_index::static_assert_size;
/// This calls the passed function while ensuring it won't be inlined into the caller.
#[inline(never)]
#[cold]
pub fn cold_path<F: FnOnce() -> R, R>(f: F) -> R {
pub fn outline<F: FnOnce() -> R, R>(f: F) -> R {
f()
}

View file

@ -81,8 +81,8 @@
//!
//! [mm]: https://github.com/rust-lang/measureme/
use crate::cold_path;
use crate::fx::FxHashMap;
use crate::outline;
use std::borrow::Borrow;
use std::collections::hash_map::Entry;
@ -697,7 +697,7 @@ impl<'a> TimingGuard<'a> {
#[inline]
pub fn finish_with_query_invocation_id(self, query_invocation_id: QueryInvocationId) {
if let Some(guard) = self.0 {
cold_path(|| {
outline(|| {
let event_id = StringId::new_virtual(query_invocation_id.0);
let event_id = EventId::from_virtual(event_id);
guard.finish_with_override_event_id(event_id);

View file

@ -6,7 +6,7 @@ use std::ptr;
use std::sync::Arc;
#[cfg(parallel_compiler)]
use {crate::cold_path, crate::sync::CacheAligned};
use {crate::outline, crate::sync::CacheAligned};
/// A pointer to the `RegistryData` which uniquely identifies a registry.
/// This identifier can be reused if the registry gets freed.
@ -25,11 +25,7 @@ impl RegistryId {
fn verify(self) -> usize {
let (id, index) = THREAD_DATA.with(|data| (data.registry_id.get(), data.index.get()));
if id == self {
index
} else {
cold_path(|| panic!("Unable to verify registry association"))
}
if id == self { index } else { outline(|| panic!("Unable to verify registry association")) }
}
}