Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Commit

Permalink
Mark a few methods with NoInline attribute (#6001)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkotas authored and MichalStrehovsky committed Jun 23, 2018
1 parent 7502b18 commit 6c2368b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ public bool Join(int millisecondsTimeout)
return JoinInternal(millisecondsTimeout);
}

[MethodImpl(MethodImplOptions.NoInlining)] // Slow path method. Make sure that the caller frame does not pay for PInvoke overhead.
public static void Sleep(int millisecondsTimeout) => SleepInternal(VerifyTimeoutMilliseconds(millisecondsTimeout));

/// <summary>
Expand All @@ -382,6 +383,8 @@ public bool Join(int millisecondsTimeout)
internal static readonly int OptimalMaxSpinWaitsPerSpinIteration = 64;

public static void SpinWait(int iterations) => RuntimeImports.RhSpinWait(iterations);

[MethodImpl(MethodImplOptions.NoInlining)] // Slow path method. Make sure that the caller frame does not pay for PInvoke overhead.
public static bool Yield() => RuntimeImports.RhYield();

public void Start() => StartInternal(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
// See the LICENSE file in the project root for more information.

using System;
using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;
using Interlocked = System.Threading.Interlocked;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;

namespace Internal.Runtime.CompilerHelpers
{
Expand Down Expand Up @@ -208,6 +209,7 @@ internal static unsafe IntPtr ResolvePInvoke(MethodFixupCell* pCell)
return ResolvePInvokeSlow(pCell);
}

[MethodImpl(MethodImplOptions.NoInlining)]
internal static unsafe IntPtr ResolvePInvokeSlow(MethodFixupCell* pCell)
{
ModuleFixupCell* pModuleCell = pCell->Module;
Expand Down

0 comments on commit 6c2368b

Please sign in to comment.