Rename cold_path
to outline
This commit is contained in:
parent
91958e0a74
commit
2c507cae36
@ -37,9 +37,10 @@
|
|||||||
use std::slice;
|
use std::slice;
|
||||||
use std::{cmp, intrinsics};
|
use std::{cmp, intrinsics};
|
||||||
|
|
||||||
|
/// This calls the passed function while ensuring it won't be inlined into the caller.
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
#[cold]
|
#[cold]
|
||||||
fn cold_path<F: FnOnce() -> R, R>(f: F) -> R {
|
fn outline<F: FnOnce() -> R, R>(f: F) -> R {
|
||||||
f()
|
f()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -600,7 +601,7 @@ pub fn alloc_from_iter<T, I: IntoIterator<Item = T>>(&self, iter: I) -> &mut [T]
|
|||||||
unsafe { self.write_from_iter(iter, len, mem) }
|
unsafe { self.write_from_iter(iter, len, mem) }
|
||||||
}
|
}
|
||||||
(_, _) => {
|
(_, _) => {
|
||||||
cold_path(move || -> &mut [T] {
|
outline(move || -> &mut [T] {
|
||||||
let mut vec: SmallVec<[_; 8]> = iter.collect();
|
let mut vec: SmallVec<[_; 8]> = iter.collect();
|
||||||
if vec.is_empty() {
|
if vec.is_empty() {
|
||||||
return &mut [];
|
return &mut [];
|
||||||
|
@ -51,9 +51,10 @@
|
|||||||
|
|
||||||
pub use rustc_index::static_assert_size;
|
pub use rustc_index::static_assert_size;
|
||||||
|
|
||||||
|
/// This calls the passed function while ensuring it won't be inlined into the caller.
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
#[cold]
|
#[cold]
|
||||||
pub fn cold_path<F: FnOnce() -> R, R>(f: F) -> R {
|
pub fn outline<F: FnOnce() -> R, R>(f: F) -> R {
|
||||||
f()
|
f()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,8 +81,8 @@
|
|||||||
//!
|
//!
|
||||||
//! [mm]: https://github.com/rust-lang/measureme/
|
//! [mm]: https://github.com/rust-lang/measureme/
|
||||||
|
|
||||||
use crate::cold_path;
|
|
||||||
use crate::fx::FxHashMap;
|
use crate::fx::FxHashMap;
|
||||||
|
use crate::outline;
|
||||||
|
|
||||||
use std::borrow::Borrow;
|
use std::borrow::Borrow;
|
||||||
use std::collections::hash_map::Entry;
|
use std::collections::hash_map::Entry;
|
||||||
@ -697,7 +697,7 @@ pub fn start(
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn finish_with_query_invocation_id(self, query_invocation_id: QueryInvocationId) {
|
pub fn finish_with_query_invocation_id(self, query_invocation_id: QueryInvocationId) {
|
||||||
if let Some(guard) = self.0 {
|
if let Some(guard) = self.0 {
|
||||||
cold_path(|| {
|
outline(|| {
|
||||||
let event_id = StringId::new_virtual(query_invocation_id.0);
|
let event_id = StringId::new_virtual(query_invocation_id.0);
|
||||||
let event_id = EventId::from_virtual(event_id);
|
let event_id = EventId::from_virtual(event_id);
|
||||||
guard.finish_with_override_event_id(event_id);
|
guard.finish_with_override_event_id(event_id);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
#[cfg(parallel_compiler)]
|
#[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.
|
/// A pointer to the `RegistryData` which uniquely identifies a registry.
|
||||||
/// This identifier can be reused if the registry gets freed.
|
/// This identifier can be reused if the registry gets freed.
|
||||||
@ -25,11 +25,7 @@ impl RegistryId {
|
|||||||
fn verify(self) -> usize {
|
fn verify(self) -> usize {
|
||||||
let (id, index) = THREAD_DATA.with(|data| (data.registry_id.get(), data.index.get()));
|
let (id, index) = THREAD_DATA.with(|data| (data.registry_id.get(), data.index.get()));
|
||||||
|
|
||||||
if id == self {
|
if id == self { index } else { outline(|| panic!("Unable to verify registry association")) }
|
||||||
index
|
|
||||||
} else {
|
|
||||||
cold_path(|| panic!("Unable to verify registry association"))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||||
use rustc_data_structures::sync::Lock;
|
use rustc_data_structures::sync::Lock;
|
||||||
#[cfg(parallel_compiler)]
|
#[cfg(parallel_compiler)]
|
||||||
use rustc_data_structures::{cold_path, sync};
|
use rustc_data_structures::{outline, sync};
|
||||||
use rustc_errors::{DiagnosticBuilder, ErrorGuaranteed, FatalError};
|
use rustc_errors::{DiagnosticBuilder, ErrorGuaranteed, FatalError};
|
||||||
use rustc_span::{Span, DUMMY_SP};
|
use rustc_span::{Span, DUMMY_SP};
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
@ -265,7 +265,7 @@ fn wait_for_query<Q, Qcx>(
|
|||||||
match result {
|
match result {
|
||||||
Ok(()) => {
|
Ok(()) => {
|
||||||
let Some((v, index)) = query.query_cache(qcx).lookup(&key) else {
|
let Some((v, index)) = query.query_cache(qcx).lookup(&key) else {
|
||||||
cold_path(|| {
|
outline(|| {
|
||||||
// We didn't find the query result in the query cache. Check if it was
|
// We didn't find the query result in the query cache. Check if it was
|
||||||
// poisoned due to a panic instead.
|
// poisoned due to a panic instead.
|
||||||
let lock = query.query_state(qcx).active.get_shard_by_value(&key).lock();
|
let lock = query.query_state(qcx).active.get_shard_by_value(&key).lock();
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate tracing;
|
extern crate tracing;
|
||||||
|
|
||||||
use rustc_data_structures::{cold_path, AtomicRef};
|
use rustc_data_structures::{outline, AtomicRef};
|
||||||
use rustc_macros::HashStable_Generic;
|
use rustc_macros::HashStable_Generic;
|
||||||
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
|
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
|
||||||
|
|
||||||
@ -1592,7 +1592,7 @@ pub fn lines(&self) -> &[RelativeBytePos] {
|
|||||||
return &lines[..];
|
return &lines[..];
|
||||||
}
|
}
|
||||||
|
|
||||||
cold_path(|| {
|
outline(|| {
|
||||||
self.convert_diffs_to_lines_frozen();
|
self.convert_diffs_to_lines_frozen();
|
||||||
if let Some(SourceFileLines::Lines(lines)) = self.lines.get() {
|
if let Some(SourceFileLines::Lines(lines)) = self.lines.get() {
|
||||||
return &lines[..];
|
return &lines[..];
|
||||||
|
Loading…
Reference in New Issue
Block a user