You've already forked linux-packaging-mono
Imported Upstream version 4.3.2.467
Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
This commit is contained in:
File diff suppressed because it is too large
Load Diff
59
external/referencesource/mscorlib/system/runtime/compilerservices/FormattableStringFactory.cs
vendored
Normal file
59
external/referencesource/mscorlib/system/runtime/compilerservices/FormattableStringFactory.cs
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
// ==++==
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// ==--==
|
||||
/*============================================================
|
||||
**
|
||||
** Class: FormattableStringFactory
|
||||
**
|
||||
**
|
||||
** Purpose: implementation of the FormattableStringFactory
|
||||
** class.
|
||||
**
|
||||
===========================================================*/
|
||||
namespace System.Runtime.CompilerServices
|
||||
{
|
||||
/// <summary>
|
||||
/// A factory type used by compilers to create instances of the type <see cref="FormattableString"/>.
|
||||
/// </summary>
|
||||
public static class FormattableStringFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Create a <see cref="FormattableString"/> from a composite format string and object
|
||||
/// array containing zero or more objects to format.
|
||||
/// </summary>
|
||||
public static FormattableString Create(string format, params object[] arguments)
|
||||
{
|
||||
if (format == null)
|
||||
{
|
||||
throw new ArgumentNullException("format");
|
||||
}
|
||||
|
||||
if (arguments == null)
|
||||
{
|
||||
throw new ArgumentNullException("arguments");
|
||||
}
|
||||
|
||||
return new ConcreteFormattableString(format, arguments);
|
||||
}
|
||||
|
||||
private sealed class ConcreteFormattableString : FormattableString
|
||||
{
|
||||
private readonly string _format;
|
||||
private readonly object[] _arguments;
|
||||
|
||||
internal ConcreteFormattableString(string format, object[] arguments)
|
||||
{
|
||||
_format = format;
|
||||
_arguments = arguments;
|
||||
}
|
||||
|
||||
public override string Format { get { return _format; } }
|
||||
public override object[] GetArguments() { return _arguments; }
|
||||
public override int ArgumentCount { get { return _arguments.Length; } }
|
||||
public override object GetArgument(int index) { return _arguments[index]; }
|
||||
public override string ToString(IFormatProvider formatProvider) { return string.Format(formatProvider, _format, _arguments); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
//
|
||||
// IAsyncStateMachine.cs
|
||||
//
|
||||
// <OWNER>[....]</OWNER>
|
||||
// <OWNER>stoub</OWNER>
|
||||
//
|
||||
// Represents state machines generated for asynchronous methods.
|
||||
//
|
||||
@@ -27,4 +27,4 @@ namespace System.Runtime.CompilerServices
|
||||
/// <param name="stateMachine">The heap-allocated replica.</param>
|
||||
void SetStateMachine(IAsyncStateMachine stateMachine);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
//
|
||||
// INotifyCompletion.cs
|
||||
//
|
||||
// <OWNER>[....]</OWNER>
|
||||
// <OWNER>stoub</OWNER>
|
||||
//
|
||||
// Interfaces used to represent instances that notify listeners of their completion via continuations.
|
||||
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
@@ -40,4 +40,4 @@ namespace System.Runtime.CompilerServices
|
||||
[SecurityCritical]
|
||||
void UnsafeOnCompleted(Action continuation);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// ==++==
|
||||
// ==++==
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
@@ -48,9 +48,7 @@ using System.Security;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Security.Permissions;
|
||||
#if !FEATURE_PAL && !FEATURE_CORECLR // PAL doesn't support eventing
|
||||
using System.Diagnostics.Tracing;
|
||||
#endif
|
||||
|
||||
// NOTE: For performance reasons, initialization is not verified. If a developer
|
||||
// incorrectly initializes a task awaiter, which should only be done by the compiler,
|
||||
@@ -70,9 +68,6 @@ namespace System.Runtime.CompilerServices
|
||||
|
||||
/// <summary>Initializes the <see cref="TaskAwaiter"/>.</summary>
|
||||
/// <param name="task">The <see cref="System.Threading.Tasks.Task"/> to be awaited.</param>
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
internal TaskAwaiter(Task task)
|
||||
{
|
||||
Contract.Requires(task != null, "Constructing an awaiter requires a task to await.");
|
||||
@@ -84,9 +79,6 @@ namespace System.Runtime.CompilerServices
|
||||
/// <exception cref="System.NullReferenceException">The awaiter was not properly initialized.</exception>
|
||||
public bool IsCompleted
|
||||
{
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
get { return m_task.IsCompleted; }
|
||||
}
|
||||
|
||||
@@ -116,9 +108,6 @@ namespace System.Runtime.CompilerServices
|
||||
/// <exception cref="System.NullReferenceException">The awaiter was not properly initialized.</exception>
|
||||
/// <exception cref="System.Threading.Tasks.TaskCanceledException">The task was canceled.</exception>
|
||||
/// <exception cref="System.Exception">The task completed in a Faulted state.</exception>
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
public void GetResult()
|
||||
{
|
||||
ValidateEnd(m_task);
|
||||
@@ -129,9 +118,6 @@ namespace System.Runtime.CompilerServices
|
||||
/// prior to completing the await.
|
||||
/// </summary>
|
||||
/// <param name="task">The awaited task.</param>
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
internal static void ValidateEnd(Task task)
|
||||
{
|
||||
// Fast checks that can be inlined.
|
||||
@@ -224,11 +210,10 @@ namespace System.Runtime.CompilerServices
|
||||
{
|
||||
if (continuation == null) throw new ArgumentNullException("continuation");
|
||||
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
|
||||
|
||||
#if !MONO
|
||||
// If TaskWait* ETW events are enabled, trace a beginning event for this await
|
||||
// and set up an ending event to be traced when the asynchronous await completes.
|
||||
#if !FEATURE_PAL && !FEATURE_CORECLR // PAL and CoreClr don't support eventing
|
||||
if (TplEtwProvider.Log.IsEnabled() || Task.s_asyncDebuggingEnabled)
|
||||
if ( TplEtwProvider.Log.IsEnabled() || Task.s_asyncDebuggingEnabled)
|
||||
{
|
||||
continuation = OutputWaitEtwEvents(task, continuation);
|
||||
}
|
||||
@@ -238,7 +223,6 @@ namespace System.Runtime.CompilerServices
|
||||
task.SetContinuationForAwait(continuation, continueOnCapturedContext, flowExecutionContext, ref stackMark);
|
||||
}
|
||||
|
||||
#if !FEATURE_PAL && !FEATURE_CORECLR // PAL and CoreClr don't support eventing
|
||||
/// <summary>
|
||||
/// Outputs a WaitBegin ETW event, and augments the continuation action to output a WaitEnd ETW event.
|
||||
/// </summary>
|
||||
@@ -255,17 +239,23 @@ namespace System.Runtime.CompilerServices
|
||||
Task.AddToActiveTasks(task);
|
||||
}
|
||||
|
||||
#if !MONO
|
||||
var etwLog = TplEtwProvider.Log;
|
||||
|
||||
if (etwLog.IsEnabled())
|
||||
{
|
||||
// ETW event for Task Wait Begin
|
||||
var currentTaskAtBegin = Task.InternalCurrent;
|
||||
|
||||
// If this task's continuation is another task, get it.
|
||||
var continuationTask = AsyncMethodBuilderCore.TryGetContinuationTask(continuation);
|
||||
etwLog.TaskWaitBegin(
|
||||
(currentTaskAtBegin != null ? currentTaskAtBegin.m_taskScheduler.Id : TaskScheduler.Default.Id),
|
||||
(currentTaskAtBegin != null ? currentTaskAtBegin.Id : 0),
|
||||
task.Id, TplEtwProvider.TaskWaitBehavior.Asynchronous);
|
||||
task.Id, TplEtwProvider.TaskWaitBehavior.Asynchronous,
|
||||
(continuationTask != null ? continuationTask.Id : 0), System.Threading.Thread.GetDomainID());
|
||||
}
|
||||
#endif
|
||||
|
||||
// Create a continuation action that outputs the end event and then invokes the user
|
||||
// provided delegate. This incurs the allocations for the closure/delegate, but only if the event
|
||||
@@ -278,7 +268,7 @@ namespace System.Runtime.CompilerServices
|
||||
{
|
||||
Task.RemoveFromActiveTasks(task.Id);
|
||||
}
|
||||
|
||||
#if !MONO
|
||||
// ETW event for Task Wait End.
|
||||
Guid prevActivityId = new Guid();
|
||||
bool bEtwLogEnabled = etwLog.IsEnabled();
|
||||
@@ -292,19 +282,23 @@ namespace System.Runtime.CompilerServices
|
||||
|
||||
// Ensure the continuation runs under the activity ID of the task that completed for the
|
||||
// case the antecendent is a promise (in the other cases this is already the case).
|
||||
if ((task.Options & (TaskCreationOptions)InternalTaskOptions.PromiseTask) != 0)
|
||||
if (etwLog.TasksSetActivityIds && (task.Options & (TaskCreationOptions)InternalTaskOptions.PromiseTask) != 0)
|
||||
EventSource.SetCurrentThreadActivityId(TplEtwProvider.CreateGuidForTaskID(task.Id), out prevActivityId);
|
||||
}
|
||||
#endif
|
||||
// Invoke the original continuation provided to OnCompleted.
|
||||
continuation();
|
||||
|
||||
if (bEtwLogEnabled && (task.Options & (TaskCreationOptions)InternalTaskOptions.PromiseTask) != 0)
|
||||
#if !MONO
|
||||
if (bEtwLogEnabled)
|
||||
{
|
||||
EventSource.SetCurrentThreadActivityId(prevActivityId);
|
||||
etwLog.TaskWaitContinuationComplete(task.Id);
|
||||
if (etwLog.TasksSetActivityIds && (task.Options & (TaskCreationOptions)InternalTaskOptions.PromiseTask) != 0)
|
||||
EventSource.SetCurrentThreadActivityId(prevActivityId);
|
||||
}
|
||||
#endif
|
||||
});
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>Provides an awaiter for awaiting a <see cref="System.Threading.Tasks.Task{TResult}"/>.</summary>
|
||||
@@ -317,9 +311,6 @@ namespace System.Runtime.CompilerServices
|
||||
|
||||
/// <summary>Initializes the <see cref="TaskAwaiter{TResult}"/>.</summary>
|
||||
/// <param name="task">The <see cref="System.Threading.Tasks.Task{TResult}"/> to be awaited.</param>
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
internal TaskAwaiter(Task<TResult> task)
|
||||
{
|
||||
Contract.Requires(task != null, "Constructing an awaiter requires a task to await.");
|
||||
@@ -331,9 +322,6 @@ namespace System.Runtime.CompilerServices
|
||||
/// <exception cref="System.NullReferenceException">The awaiter was not properly initialized.</exception>
|
||||
public bool IsCompleted
|
||||
{
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
get { return m_task.IsCompleted; }
|
||||
}
|
||||
|
||||
@@ -364,9 +352,6 @@ namespace System.Runtime.CompilerServices
|
||||
/// <exception cref="System.NullReferenceException">The awaiter was not properly initialized.</exception>
|
||||
/// <exception cref="System.Threading.Tasks.TaskCanceledException">The task was canceled.</exception>
|
||||
/// <exception cref="System.Exception">The task completed in a Faulted state.</exception>
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
public TResult GetResult()
|
||||
{
|
||||
TaskAwaiter.ValidateEnd(m_task);
|
||||
@@ -386,9 +371,6 @@ namespace System.Runtime.CompilerServices
|
||||
/// <param name="continueOnCapturedContext">
|
||||
/// true to attempt to marshal the continuation back to the original context captured; otherwise, false.
|
||||
/// </param>
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
internal ConfiguredTaskAwaitable(Task task, bool continueOnCapturedContext)
|
||||
{
|
||||
Contract.Requires(task != null, "Constructing an awaitable requires a task to await.");
|
||||
@@ -397,9 +379,6 @@ namespace System.Runtime.CompilerServices
|
||||
|
||||
/// <summary>Gets an awaiter for this awaitable.</summary>
|
||||
/// <returns>The awaiter.</returns>
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
public ConfiguredTaskAwaitable.ConfiguredTaskAwaiter GetAwaiter()
|
||||
{
|
||||
return m_configuredTaskAwaiter;
|
||||
@@ -421,9 +400,6 @@ namespace System.Runtime.CompilerServices
|
||||
/// true to attempt to marshal the continuation back to the original context captured
|
||||
/// when BeginAwait is called; otherwise, false.
|
||||
/// </param>
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
internal ConfiguredTaskAwaiter(Task task, bool continueOnCapturedContext)
|
||||
{
|
||||
Contract.Requires(task != null, "Constructing an awaiter requires a task to await.");
|
||||
@@ -436,9 +412,6 @@ namespace System.Runtime.CompilerServices
|
||||
/// <exception cref="System.NullReferenceException">The awaiter was not properly initialized.</exception>
|
||||
public bool IsCompleted
|
||||
{
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
get { return m_task.IsCompleted; }
|
||||
}
|
||||
|
||||
@@ -469,9 +442,6 @@ namespace System.Runtime.CompilerServices
|
||||
/// <exception cref="System.NullReferenceException">The awaiter was not properly initialized.</exception>
|
||||
/// <exception cref="System.Threading.Tasks.TaskCanceledException">The task was canceled.</exception>
|
||||
/// <exception cref="System.Exception">The task completed in a Faulted state.</exception>
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
public void GetResult()
|
||||
{
|
||||
TaskAwaiter.ValidateEnd(m_task);
|
||||
@@ -491,9 +461,6 @@ namespace System.Runtime.CompilerServices
|
||||
/// <param name="continueOnCapturedContext">
|
||||
/// true to attempt to marshal the continuation back to the original context captured; otherwise, false.
|
||||
/// </param>
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
internal ConfiguredTaskAwaitable(Task<TResult> task, bool continueOnCapturedContext)
|
||||
{
|
||||
m_configuredTaskAwaiter = new ConfiguredTaskAwaitable<TResult>.ConfiguredTaskAwaiter(task, continueOnCapturedContext);
|
||||
@@ -501,9 +468,6 @@ namespace System.Runtime.CompilerServices
|
||||
|
||||
/// <summary>Gets an awaiter for this awaitable.</summary>
|
||||
/// <returns>The awaiter.</returns>
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
public ConfiguredTaskAwaitable<TResult>.ConfiguredTaskAwaiter GetAwaiter()
|
||||
{
|
||||
return m_configuredTaskAwaiter;
|
||||
@@ -524,9 +488,6 @@ namespace System.Runtime.CompilerServices
|
||||
/// <param name="continueOnCapturedContext">
|
||||
/// true to attempt to marshal the continuation back to the original context captured; otherwise, false.
|
||||
/// </param>
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
internal ConfiguredTaskAwaiter(Task<TResult> task, bool continueOnCapturedContext)
|
||||
{
|
||||
Contract.Requires(task != null, "Constructing an awaiter requires a task to await.");
|
||||
@@ -539,9 +500,6 @@ namespace System.Runtime.CompilerServices
|
||||
/// <exception cref="System.NullReferenceException">The awaiter was not properly initialized.</exception>
|
||||
public bool IsCompleted
|
||||
{
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
get { return m_task.IsCompleted; }
|
||||
}
|
||||
|
||||
@@ -572,9 +530,6 @@ namespace System.Runtime.CompilerServices
|
||||
/// <exception cref="System.NullReferenceException">The awaiter was not properly initialized.</exception>
|
||||
/// <exception cref="System.Threading.Tasks.TaskCanceledException">The task was canceled.</exception>
|
||||
/// <exception cref="System.Exception">The task completed in a Faulted state.</exception>
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
public TResult GetResult()
|
||||
{
|
||||
TaskAwaiter.ValidateEnd(m_task);
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace System.Runtime.CompilerServices
|
||||
if (continuation == null) throw new ArgumentNullException("continuation");
|
||||
Contract.EndContractBlock();
|
||||
|
||||
#if !FEATURE_PAL && !FEATURE_CORECLR // PAL and CoreClr don't support eventing
|
||||
#if !MONO
|
||||
if (TplEtwProvider.Log.IsEnabled())
|
||||
{
|
||||
continuation = OutputCorrelationEtwEvent(continuation);
|
||||
@@ -126,8 +126,7 @@ namespace System.Runtime.CompilerServices
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if !FEATURE_PAL && !FEATURE_CORECLR // PAL and CoreClr don't support eventing
|
||||
#if !MONO
|
||||
private static Action OutputCorrelationEtwEvent(Action continuation)
|
||||
{
|
||||
int continuationId = Task.NewId();
|
||||
@@ -137,18 +136,27 @@ namespace System.Runtime.CompilerServices
|
||||
|
||||
return AsyncMethodBuilderCore.CreateContinuationWrapper(continuation, () =>
|
||||
{
|
||||
var etwLog = TplEtwProvider.Log;
|
||||
etwLog.TaskWaitContinuationStarted(continuationId);
|
||||
|
||||
// ETW event for Task Wait End.
|
||||
Guid prevActivityId = new Guid();
|
||||
// Ensure the continuation runs under the correlated activity ID generated above
|
||||
EventSource.SetCurrentThreadActivityId(TplEtwProvider.CreateGuidForTaskID(continuationId), out prevActivityId);
|
||||
if (etwLog.TasksSetActivityIds)
|
||||
EventSource.SetCurrentThreadActivityId(TplEtwProvider.CreateGuidForTaskID(continuationId), out prevActivityId);
|
||||
|
||||
// Invoke the original continuation provided to OnCompleted.
|
||||
continuation();
|
||||
// Restore activity ID
|
||||
EventSource.SetCurrentThreadActivityId(prevActivityId);
|
||||
|
||||
if (etwLog.TasksSetActivityIds)
|
||||
EventSource.SetCurrentThreadActivityId(prevActivityId);
|
||||
|
||||
etwLog.TaskWaitContinuationComplete(continuationId);
|
||||
});
|
||||
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/// <summary>WaitCallback that invokes the Action supplied as object state.</summary>
|
||||
private static readonly WaitCallback s_waitCallbackRunAction = RunAction;
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
// ==++==
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// ==--==
|
||||
//------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace System.Runtime.CompilerServices
|
||||
{
|
||||
using System;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
|
||||
public sealed class DisablePrivateReflectionAttribute : Attribute
|
||||
{
|
||||
public DisablePrivateReflectionAttribute() {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
namespace System.Runtime.CompilerServices
|
||||
{
|
||||
// C++ recognizes three char types: signed char, unsigned char, and char.
|
||||
// When a char is neither signed nor unsigned, it is a ---- char.
|
||||
// This modopt indicates that the modified instance is a ---- char.
|
||||
// When a char is neither signed nor unsigned, it is a naked char.
|
||||
// This modopt indicates that the modified instance is a naked char.
|
||||
//
|
||||
// Any compiler could use this to indicate that the user has not specified
|
||||
// Sign behavior for the given byte.
|
||||
|
||||
@@ -58,9 +58,6 @@ namespace System.Runtime.CompilerServices {
|
||||
// }
|
||||
internal class PinningHelper
|
||||
{
|
||||
#if !FEATURE_CORECLR
|
||||
[System.Runtime.ForceTokenStabilization]
|
||||
#endif //!FEATURE_CORECLR
|
||||
public byte m_data;
|
||||
}
|
||||
|
||||
@@ -73,9 +70,6 @@ namespace System.Runtime.CompilerServices {
|
||||
// Wraps object variable into a handle. Used to return managed strings from QCalls.
|
||||
// s has to be a local variable on the stack.
|
||||
[SecurityCritical]
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
static internal StringHandleOnStack GetStringHandleOnStack(ref string s)
|
||||
{
|
||||
return new StringHandleOnStack(UnsafeCastToStackPointer(ref s));
|
||||
@@ -84,9 +78,6 @@ namespace System.Runtime.CompilerServices {
|
||||
// Wraps object variable into a handle. Used to pass managed object references in and out of QCalls.
|
||||
// o has to be a local variable on the stack.
|
||||
[SecurityCritical]
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
static internal ObjectHandleOnStack GetObjectHandleOnStack<T>(ref T o) where T : class
|
||||
{
|
||||
return new ObjectHandleOnStack(UnsafeCastToStackPointer(ref o));
|
||||
@@ -95,9 +86,6 @@ namespace System.Runtime.CompilerServices {
|
||||
// Wraps StackCrawlMark into a handle. Used to pass StackCrawlMark to QCalls.
|
||||
// stackMark has to be a local variable on the stack.
|
||||
[SecurityCritical]
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
static internal StackCrawlMarkHandle GetStackCrawlMarkHandle(ref StackCrawlMark stackMark)
|
||||
{
|
||||
return new StackCrawlMarkHandle(UnsafeCastToStackPointer(ref stackMark));
|
||||
@@ -181,9 +169,6 @@ namespace System.Runtime.CompilerServices {
|
||||
// this method is effectively critical
|
||||
[SecurityCritical]
|
||||
[FriendAccessAllowed]
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
static internal T UnsafeCast<T>(Object o) where T : class
|
||||
{
|
||||
// The body of this function will be replaced by the EE with unsafe code that just returns o!!!
|
||||
@@ -191,9 +176,6 @@ namespace System.Runtime.CompilerServices {
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
static internal int UnsafeEnumCast<T>(T val) where T : struct // Actually T must be 4 byte (or less) enum
|
||||
{
|
||||
// should be return (int) val; but C# does not allow, runtime does this magically
|
||||
@@ -201,9 +183,6 @@ namespace System.Runtime.CompilerServices {
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
static internal long UnsafeEnumCastLong<T>(T val) where T : struct // Actually T must be 8 byte enum
|
||||
{
|
||||
// should be return (long) val; but C# does not allow, runtime does this magically
|
||||
@@ -212,9 +191,6 @@ namespace System.Runtime.CompilerServices {
|
||||
}
|
||||
|
||||
[SecurityCritical]
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
static internal IntPtr UnsafeCastToStackPointer<T>(ref T val)
|
||||
{
|
||||
// The body of this function will be replaced by the EE with unsafe code that just returns o!!!
|
||||
|
||||
@@ -62,9 +62,6 @@ namespace System.Runtime.CompilerServices {
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
private static extern void _RunClassConstructor(RuntimeType type);
|
||||
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
public static void RunClassConstructor(RuntimeTypeHandle type)
|
||||
{
|
||||
_RunClassConstructor(type.GetRuntimeType());
|
||||
@@ -164,9 +161,9 @@ namespace System.Runtime.CompilerServices {
|
||||
|
||||
public static int OffsetToStringData
|
||||
{
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
// This offset is baked in by string indexer intrinsic, so there is no harm
|
||||
// in getting it baked in here as well.
|
||||
[System.Runtime.Versioning.NonVersionable]
|
||||
get {
|
||||
// Number of bytes from the address pointed to by a reference to
|
||||
// a String to the first 16-bit character in the String. Skip
|
||||
@@ -212,9 +209,6 @@ namespace System.Runtime.CompilerServices {
|
||||
// as we don't need to probe.
|
||||
[System.Security.SecurityCritical] // auto-generated_required
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
public static void PrepareConstrainedRegionsNoOP()
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user