Commit d41c087a authored by Matt Mastracci's avatar Matt Mastracci

Remove all #[inline] and #[inline(always)] annotations

parent c2ba8396
......@@ -386,7 +386,6 @@ impl<'a> Scanner<'a> {
}
/// Check whether a byte range `[start, end)` overlaps any output range.
#[inline]
fn overlaps_output(&self, start: usize, end: usize) -> bool {
// Ranges are sorted and there are typically ≤6, so linear scan
// is faster than binary search for the common case.
......
......@@ -117,7 +117,6 @@ fn init() {
create_custom_tokio_runtime(rt);
}
#[inline]
fn get_compiler() -> Compiler {
let cm = Arc::new(SourceMap::new(FilePathMapping::empty()));
......
......@@ -563,7 +563,6 @@ impl<K: StoreKey + Send + Sync, S: ParallelScheduler, const FAMILIES: usize>
}
}
#[inline(always)]
const fn usize_from_u32(value: u32) -> usize {
// This should always be true, as we assume at least a 32-bit width architecture for Turbopack.
// Since this is a const expression, we expect it to be compiled away.
......
......@@ -86,7 +86,6 @@ pub(crate) fn new_atom<T: AsRef<str> + Into<String>>(text: T) -> RcStr {
}
}
#[inline(always)]
pub(crate) fn new_static_atom(string: &'static PrehashedString) -> RcStr {
let mut entry = string as *const PrehashedString;
debug_assert!(0 == entry as u8 & TAG_MASK);
......@@ -130,7 +129,6 @@ const SEED1: u64 = 0x243f6a8885a308d3;
const SEED2: u64 = 0x13198a2e03707344;
const PREVENT_TRIVIAL_ZERO_COLLAPSE: u64 = 0xa4093822299f31d0;
#[inline]
const fn multiply_mix(x: u64, y: u64) -> u64 {
#[cfg(target_pointer_width = "64")]
{
......@@ -175,7 +173,6 @@ const fn multiply_mix(x: u64, y: u64) -> u64 {
// Const compatible helper function to read a u64 from a byte array at a given
// offset
// SAFETY: The caller must ensure that `bytes.len() >= offset + 8`
#[inline(always)]
const unsafe fn read_u64_le(bytes: &[u8], offset: usize) -> u64 {
debug_assert!(offset + 8 <= bytes.len());
// Reinterpret the pointer as an array of length 8 at the given offset
......@@ -189,7 +186,6 @@ const unsafe fn read_u64_le(bytes: &[u8], offset: usize) -> u64 {
// Const compatible helper function to read a u32 from a byte array at a given
// offset
// SAFETY: The caller must ensure that `bytes.len() >= offset + 4`
#[inline(always)]
const unsafe fn read_u32_le(bytes: &[u8], offset: usize) -> u32 {
debug_assert!(offset + 4 <= bytes.len());
// SAFETY: it is our callers responsibility to ensure the offset is in range
......@@ -216,7 +212,6 @@ const unsafe fn read_u32_le(bytes: &[u8], offset: usize) -> u32 {
///
/// We don't bother avalanching here as we'll feed this hash into a
/// multiplication after which we take the high bits, which avalanches for us.
#[inline]
#[doc(hidden)]
pub const fn hash_bytes(bytes: &[u8]) -> u64 {
let len = bytes.len();
......
......@@ -102,11 +102,9 @@ const LEN_OFFSET: usize = 4;
const LEN_MASK: u8 = 0xf0;
impl RcStr {
#[inline(always)]
fn tag(&self) -> u8 {
self.unsafe_data.tag_byte() & TAG_MASK
}
#[inline(always)]
fn location(&self) -> u8 {
self.unsafe_data.tag_byte() & LOCATION_MASK
}
......@@ -295,7 +293,6 @@ impl From<RcStr> for PathBuf {
}
impl Clone for RcStr {
#[inline(always)]
fn clone(&self) -> Self {
let alias = self.unsafe_data;
// We only need to increment the ref count for DYNAMIC_TAG values
......@@ -418,7 +415,6 @@ pub const fn inline_atom(s: &str) -> Option<RcStr> {
}
#[doc(hidden)]
#[inline(always)]
pub fn from_static(s: &'static PrehashedString) -> RcStr {
dynamic::new_static_atom(s)
}
......@@ -458,7 +454,6 @@ macro_rules! rcstr {
/// noop
impl ShrinkToFit for RcStr {
#[inline(always)]
fn shrink_to_fit(&mut self) {}
}
......
......@@ -50,7 +50,6 @@ pub(crate) struct TaggedValue {
}
impl TaggedValue {
#[inline(always)]
pub fn new_ptr<T>(value: NonNull<T>) -> Self {
#[cfg(any(
target_pointer_width = "32",
......@@ -78,7 +77,6 @@ impl TaggedValue {
}
}
#[inline(always)]
pub const fn new_tag(value: NonZeroU8) -> Self {
let value = value.get() as RawTaggedValue;
Self {
......@@ -87,7 +85,6 @@ impl TaggedValue {
}
}
#[inline(always)]
pub fn get_ptr(&self) -> *const c_void {
#[cfg(any(
target_pointer_width = "32",
......@@ -111,12 +108,10 @@ impl TaggedValue {
}
}
#[inline(always)]
fn get_value(&self) -> RawTaggedValue {
unsafe { std::mem::transmute(Some(self.value)) }
}
#[inline(always)]
pub fn tag_byte(&self) -> u8 {
(self.get_value() & 0xff) as u8
}
......
......@@ -920,7 +920,6 @@ impl Drop for TaskGuardImpl<'_> {
impl TaskGuardImpl<'_> {
/// Verify that the task guard restored the correct category
/// before accessing the data.
#[inline]
#[track_caller]
fn check_access(&self, category: crate::backend::storage::SpecificTaskDataCategory) {
match category {
......@@ -1020,7 +1019,6 @@ impl TaskStorageAccessors for TaskGuardImpl<'_> {
&mut self.task
}
#[inline(always)]
fn track_modification(
&mut self,
category: crate::backend::storage::SpecificTaskDataCategory,
......
......@@ -296,7 +296,6 @@ pub struct StorageWriteGuard<'a> {
impl StorageWriteGuard<'_> {
/// Tracks mutation of this task
#[inline(always)]
pub fn track_modification(
&mut self,
category: SpecificTaskDataCategory,
......
......@@ -15,7 +15,6 @@ macro_rules! deterministic_hash_number {
macro_rules! impl_write_number {
($(($ty:ident, $meth:ident),)*) => {$(
/// Writes a single `$ty` to this hasher
#[inline]
fn $meth(&mut self, i: $ty) {
// Apple silicon and Intel chips both use little endian, so this should be fast.
let little_endian = i.to_le_bytes();
......@@ -47,13 +46,11 @@ pub trait DeterministicHasher {
fn write_bytes(&mut self, bytes: &[u8]);
/// Writes a single `u8` to this hasher
#[inline]
fn write_u8(&mut self, i: u8) {
self.write_bytes(&[i]);
}
/// Writes a single `usize` to this hasher
#[inline]
fn write_usize(&mut self, i: usize) {
// usize can be 4 or 8 bytes, standardize on the larger.
// As long as the original value is smaller than 4 bytes, the two will hash
......@@ -62,7 +59,6 @@ pub trait DeterministicHasher {
}
/// Writes a single `isize` to this hasher
#[inline]
fn write_isize(&mut self, i: isize) {
// isize can be 4 or 8 bytes, standardize on the larger.
// As long as the original value is smaller than 4 bytes, the two will hash
......
......@@ -103,7 +103,6 @@ impl TurboMalloc {
}
/// Get the allocator for this platform that we should wrap with TurboMalloc.
#[inline]
fn base_alloc() -> &'static impl GlobalAlloc {
#[cfg(all(feature = "custom_allocator", not(target_family = "wasm")))]
return &mimalloc::MiMalloc;
......
......@@ -130,7 +130,6 @@ pub mod macro_helpers {
/// Blanket impl: uses synchronous `Display::to_string()` for owned values.
impl<T: Display + Send + Sync> ValueToStringify<1> for &ValueToStringifyWrap<&T> {
#[inline(always)]
fn to_stringify(&self) -> impl Future<Output = Result<StringifyType>> + Send {
let s = (self.0).to_string();
async move { Ok(StringifyType::String(s)) }
......@@ -141,7 +140,6 @@ pub mod macro_helpers {
where
T: ValueToString,
{
#[inline(always)]
fn to_stringify(&self) -> impl Future<Output = Result<StringifyType>> + Send {
let vc = self.0;
async move {
......@@ -155,7 +153,6 @@ pub mod macro_helpers {
where
T: ValueToString,
{
#[inline(always)]
fn to_stringify(&self) -> impl Future<Output = Result<StringifyType>> + Send {
let vc = self.0;
async move {
......@@ -169,7 +166,6 @@ pub mod macro_helpers {
where
T: ValueToStringRef,
{
#[inline(always)]
fn to_stringify(&self) -> impl Future<Output = Result<StringifyType>> {
let s = self.0.to_string_ref();
async move { Ok(StringifyType::RcStr(s.await?)) }
......
......@@ -37,7 +37,6 @@ pub struct EventDescription {
}
impl EventDescription {
#[inline(always)]
pub fn new<InnerFn>(#[allow(unused_variables)] description: impl FnOnce() -> InnerFn) -> Self
where
InnerFn: Fn() -> String + Sync + Send + 'static,
......@@ -86,7 +85,6 @@ impl Event {
///
/// The outer closure allows avoiding extra lookups (e.g. task type info) that may be needed to
/// capture information needed for constructing (moving into) the inner closure.
#[inline(always)]
pub fn new(#[allow(unused_variables)] description: impl EventDescriptor) -> Self {
#[cfg(not(feature = "hanging_detection"))]
return Self {
......
......@@ -68,7 +68,6 @@ macro_rules! stringify_path {
/// Rexport std::ptr::metadata so not every crate needs to enable the feature when they use our
/// macros.
#[inline(always)]
pub const fn metadata<T: ?Sized>(ptr: *const T) -> <T as std::ptr::Pointee>::Metadata {
// Ideally we would just `pub use std::ptr::metadata;` but this doesn't seem to work.
std::ptr::metadata(ptr)
......
......@@ -292,7 +292,6 @@ where
/// Upcasts the given `Vc<T>` to a `Vc<Box<dyn K>>`.
///
/// This is also available as an `Into`/`From` conversion.
#[inline(always)]
pub fn upcast<K>(vc: Self) -> Vc<K>
where
T: UpcastStrict<K>,
......@@ -319,7 +318,6 @@ where
/// `UpcastStrict<...>` instead of `Upcast<...>` you would disallow calling this function if you
/// already had a `ResolvedVc<Box<dyn MyTrait>>`. So this function has a looser type constraint
/// to make these functions easier to write and use.
#[inline(always)]
pub fn upcast_non_strict<K>(vc: Self) -> Vc<K>
where
T: Upcast<K>,
......
......@@ -95,7 +95,6 @@ impl<T: ?Sized> OperationVc<T> {
/// Upcasts the given `OperationVc<T>` to a `OperationVc<Box<dyn K>>`.
///
/// This is also available as an `Into`/`From` conversion.
#[inline(always)]
pub fn upcast<K>(vc: Self) -> OperationVc<K>
where
T: UpcastStrict<K>,
......
......@@ -202,7 +202,6 @@ where
/// Upcasts the given `ResolvedVc<T>` to a `ResolvedVc<Box<dyn K>>`.
///
/// See also: [`Vc::upcast`].
#[inline(always)]
pub fn upcast<K>(this: Self) -> ResolvedVc<K>
where
T: UpcastStrict<K>,
......@@ -216,7 +215,6 @@ where
/// This has a loose type constraint which would allow upcasting to the same type, prefer using
/// [`ResolvedVc::upcast`] when possible. See also: [`Vc::upcast_non_strict`]. This is
/// useful for extension traits and other more generic usecases.
#[inline(always)]
pub fn upcast_non_strict<K>(this: Self) -> ResolvedVc<K>
where
T: Upcast<K>,
......@@ -230,7 +228,6 @@ where
/// Upcasts the given `Vec<ResolvedVc<T>>` to a `Vec<ResolvedVc<K>>`.
///
/// See also: [`Vc::upcast`].
#[inline(always)]
pub fn upcast_vec<K>(vec: Vec<Self>) -> Vec<ResolvedVc<K>>
where
T: UpcastStrict<K>,
......
......@@ -4,7 +4,6 @@ use std::borrow::Cow;
/// Converts system paths into Unix paths. This is a noop on Unix systems, and replaces backslash
/// directory separators with forward slashes on Windows.
#[inline]
pub fn sys_to_unix(path: &str) -> Cow<'_, str> {
#[cfg(not(target_family = "windows"))]
{
......@@ -18,7 +17,6 @@ pub fn sys_to_unix(path: &str) -> Cow<'_, str> {
/// Converts Unix paths into system paths. This is a noop on Unix systems, and replaces forward
/// slash directory separators with backslashes on Windows.
#[inline]
pub fn unix_to_sys(path: &str) -> Cow<'_, str> {
#[cfg(not(target_family = "windows"))]
{
......
......@@ -2617,7 +2617,6 @@ impl CodeGenResultComments {
const CONTINUATION_BIT: u32 = 1 << 31;
const SIGN_EXTENSION_BIT: u32 = 1 << 30;
#[inline]
fn encode_bytepos_impl(
modules_header_width: u32,
module: u32,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment