You've already forked linux-packaging-mono
Imported Upstream version 4.3.2.467
Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
This commit is contained in:
@@ -18,12 +18,7 @@ namespace System.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
// This attribute seems particularly prone to accidental inclusion in bcl.small
|
||||
// We would only want to do so intentionally (if targeted patching were enabled there)
|
||||
#if !FEATURE_CORECLR
|
||||
|
||||
//============================================================================================================
|
||||
// [TargetedPatchingOptOutAttribute("Performance critical to inline across NGen image boundaries")] -
|
||||
// Sacrifices cheap servicing of a method body in order to allow unrestricted inlining. Certain types of
|
||||
// trivial methods (e.g. simple property getters) are automatically attributed by ILCA.EXE during the build.
|
||||
// For other performance critical methods, it should be added manually.
|
||||
@@ -46,21 +41,4 @@ namespace System.Runtime
|
||||
|
||||
private TargetedPatchingOptOutAttribute() { }
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//============================================================================================================
|
||||
// [ForceTokenStabilization] - Using this CA forces ILCA.EXE to stabilize the attached type, method or field.
|
||||
// We use this to identify private helper methods invoked by IL stubs.
|
||||
//
|
||||
// NOTE: Attaching this to a type is NOT equivalent to attaching it to all of its methods!
|
||||
//============================================================================================================
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface | AttributeTargets.Delegate |
|
||||
AttributeTargets.Method | AttributeTargets.Constructor |
|
||||
AttributeTargets.Field
|
||||
, AllowMultiple = false, Inherited = false)]
|
||||
sealed class ForceTokenStabilizationAttribute : Attribute
|
||||
{
|
||||
public ForceTokenStabilizationAttribute() { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace System.Runtime {
|
||||
[SecurityCritical]
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
internal static extern void InternalStartProfile(string profile);
|
||||
internal static extern void InternalStartProfile(string profile, IntPtr ptrNativeAssemblyLoadContext);
|
||||
|
||||
[SecurityCritical]
|
||||
public static void SetProfileRoot(string directoryPath)
|
||||
@@ -50,7 +50,7 @@ namespace System.Runtime {
|
||||
[SecurityCritical]
|
||||
public static void StartProfile(string profile)
|
||||
{
|
||||
InternalStartProfile(profile);
|
||||
InternalStartProfile(profile, IntPtr.Zero);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -27,11 +27,18 @@ namespace System.Runtime {
|
||||
Batch = 0,
|
||||
Interactive = 1,
|
||||
LowLatency = 2,
|
||||
SustainedLowLatency = 3
|
||||
SustainedLowLatency = 3,
|
||||
NoGCRegion = 4
|
||||
}
|
||||
|
||||
public static class GCSettings
|
||||
{
|
||||
enum SetLatencyModeStatus
|
||||
{
|
||||
Succeeded = 0,
|
||||
NoGCInProgress = 1 // NoGCRegion is in progress, can't change pause mode.
|
||||
};
|
||||
|
||||
public static GCLatencyMode LatencyMode
|
||||
{
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
@@ -53,7 +60,8 @@ namespace System.Runtime {
|
||||
}
|
||||
Contract.EndContractBlock();
|
||||
|
||||
GC.SetGCLatencyMode((int)value);
|
||||
if (GC.SetGCLatencyMode((int)value) == (int)SetLatencyModeStatus.NoGCInProgress)
|
||||
throw new InvalidOperationException("The NoGCRegion mode is in progress. End it and then set a different mode.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
** Date: April 2008
|
||||
**/
|
||||
|
||||
#if FEATURE_COMINTEROP
|
||||
|
||||
namespace System.Runtime.InteropServices {
|
||||
//
|
||||
// #ComEventsFeature
|
||||
@@ -206,5 +204,3 @@ namespace System.Runtime.InteropServices {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
**/
|
||||
|
||||
|
||||
#if FEATURE_COMINTEROP
|
||||
|
||||
namespace System.Runtime.InteropServices {
|
||||
|
||||
using System;
|
||||
@@ -96,5 +94,3 @@ namespace System.Runtime.InteropServices {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -21,7 +21,6 @@ using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Reflection;
|
||||
|
||||
#if FEATURE_COMINTEROP
|
||||
|
||||
namespace System.Runtime.InteropServices {
|
||||
|
||||
@@ -249,5 +248,3 @@ namespace System.Runtime.InteropServices {
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
** Date: April 2008
|
||||
**/
|
||||
|
||||
#if FEATURE_COMINTEROP
|
||||
|
||||
namespace System.Runtime.InteropServices {
|
||||
using System;
|
||||
@@ -289,5 +288,3 @@ namespace System.Runtime.InteropServices {
|
||||
#endregion
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -70,17 +70,8 @@ namespace System.Runtime.InteropServices {
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
private extern int CalculateCount();
|
||||
|
||||
#if !FEATURE_CORECLR
|
||||
[System.Runtime.ForceTokenStabilization]
|
||||
#endif //!FEATURE_CORECLR
|
||||
private Object m_array;
|
||||
#if !FEATURE_CORECLR
|
||||
[System.Runtime.ForceTokenStabilization]
|
||||
#endif //!FEATURE_CORECLR
|
||||
private int m_offset;
|
||||
#if !FEATURE_CORECLR
|
||||
[System.Runtime.ForceTokenStabilization]
|
||||
#endif //!FEATURE_CORECLR
|
||||
private int m_count;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,10 +79,8 @@ namespace System.Runtime.InteropServices{
|
||||
InterfaceIsIUnknown = 1,
|
||||
InterfaceIsIDispatch = 2,
|
||||
|
||||
#if FEATURE_COMINTEROP
|
||||
[System.Runtime.InteropServices.ComVisible(false)]
|
||||
InterfaceIsIInspectable = 3,
|
||||
#endif // FEATURE_COMINTEROP
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Interface, Inherited = false)]
|
||||
@@ -165,7 +163,6 @@ namespace System.Runtime.InteropServices{
|
||||
public String Value { get { return _importClassName; } }
|
||||
}
|
||||
|
||||
#if FEATURE_COMINTEROP || MOBILE_LEGACY
|
||||
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
|
||||
[System.Runtime.InteropServices.ComVisible(true)]
|
||||
public sealed class LCIDConversionAttribute : Attribute
|
||||
@@ -246,7 +243,6 @@ namespace System.Runtime.InteropServices{
|
||||
}
|
||||
public IDispatchImplType Value { get {return _val;} }
|
||||
}
|
||||
#endif
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class, Inherited = true)]
|
||||
[System.Runtime.InteropServices.ComVisible(true)]
|
||||
@@ -286,7 +282,7 @@ namespace System.Runtime.InteropServices{
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if FEATURE_COMINTEROP
|
||||
#if FEATURE_COMINTEROP || MOBILE_LEGACY
|
||||
[Serializable]
|
||||
[Flags()]
|
||||
[System.Runtime.InteropServices.ComVisible(true)]
|
||||
@@ -395,7 +391,6 @@ namespace System.Runtime.InteropServices{
|
||||
}
|
||||
public TypeLibVarFlags Value { get {return _val;} }
|
||||
}
|
||||
#endif //FEATURE_COMINTEROP
|
||||
|
||||
[Serializable]
|
||||
[System.Runtime.InteropServices.ComVisible(true)]
|
||||
@@ -410,9 +405,7 @@ namespace System.Runtime.InteropServices{
|
||||
VT_CY = 6,
|
||||
VT_DATE = 7,
|
||||
VT_BSTR = 8,
|
||||
#if FEATURE_COMINTEROP
|
||||
VT_DISPATCH = 9,
|
||||
#endif // FEATURE_COMINTEROP
|
||||
VT_ERROR = 10,
|
||||
VT_BOOL = 11,
|
||||
VT_VARIANT = 12,
|
||||
@@ -478,9 +471,7 @@ namespace System.Runtime.InteropServices{
|
||||
|
||||
Currency = 0xf, // A currency
|
||||
|
||||
#if FEATURE_COMINTEROP || FEATURE_LEGACYNETCF || MONO
|
||||
BStr = 0x13, // OLE Unicode BSTR
|
||||
#endif //FEATURE_COMINTEROP || FEATURE_LEGACYNETCF
|
||||
|
||||
LPStr = 0x14, // Ptr to SBCS string
|
||||
|
||||
@@ -492,17 +483,13 @@ namespace System.Runtime.InteropServices{
|
||||
|
||||
IUnknown = 0x19, // COM IUnknown pointer.
|
||||
|
||||
#if FEATURE_COMINTEROP || FEATURE_LEGACYNETCF || MONO
|
||||
IDispatch = 0x1a, // COM IDispatch pointer
|
||||
#endif //FEATURE_COMINTEROP || FEATURE_LEGACYNETCF
|
||||
|
||||
Struct = 0x1b, // Structure
|
||||
|
||||
#if FEATURE_COMINTEROP || FEATURE_LEGACYNETCF || MONO
|
||||
Interface = 0x1c, // COM interface
|
||||
|
||||
SafeArray = 0x1d, // OLE SafeArray
|
||||
#endif //FEATURE_COMINTEROP || FEATURE_LEGACYNETCF
|
||||
|
||||
ByValArray = 0x1e, // Array of fixed size (only valid in structs)
|
||||
|
||||
@@ -510,7 +497,6 @@ namespace System.Runtime.InteropServices{
|
||||
|
||||
SysUInt = 0x20,
|
||||
|
||||
#if FEATURE_COMINTEROP || FEATURE_LEGACYNETCF || MONO
|
||||
VBByRefStr = 0x22,
|
||||
|
||||
AnsiBStr = 0x23, // OLE BSTR containing SBCS characters
|
||||
@@ -518,7 +504,6 @@ namespace System.Runtime.InteropServices{
|
||||
TBStr = 0x24, // Ptr to OS preferred (SBCS/Unicode) BSTR
|
||||
|
||||
VariantBool = 0x25, // OLE defined BOOLEAN (2 bytes, true == -1, false == 0)
|
||||
#endif //FEATURE_COMINTEROP || FEATURE_LEGACYNETCF
|
||||
|
||||
FunctionPtr = 0x26, // Function pointer
|
||||
|
||||
@@ -528,20 +513,15 @@ namespace System.Runtime.InteropServices{
|
||||
|
||||
LPStruct = 0x2b, // Pointer to a structure
|
||||
|
||||
#if FEATURE_COMINTEROP || FEATURE_LEGACYNETCF || MONO
|
||||
CustomMarshaler = 0x2c,
|
||||
#endif //FEATURE_COMINTEROP || FEATURE_LEGACYNETCF
|
||||
|
||||
Error = 0x2d,
|
||||
|
||||
#if FEATURE_COMINTEROP
|
||||
[System.Runtime.InteropServices.ComVisible(false)]
|
||||
IInspectable = 0x2e,
|
||||
|
||||
[System.Runtime.InteropServices.ComVisible(false)]
|
||||
HString = 0x2f, // Windows Runtime HSTRING
|
||||
|
||||
#endif //FEATURE_COMINTEROP
|
||||
}
|
||||
|
||||
#if !MONO
|
||||
@@ -620,11 +600,9 @@ namespace System.Runtime.InteropServices{
|
||||
short sizeParamIndex, int sizeConst, string marshalType, RuntimeType marshalTypeRef, string marshalCookie, int iidParamIndex)
|
||||
{
|
||||
_val = val;
|
||||
#if FEATURE_COMINTEROP
|
||||
SafeArraySubType = safeArraySubType;
|
||||
SafeArrayUserDefinedSubType = safeArrayUserDefinedSubType;
|
||||
IidParameterIndex = iidParamIndex;
|
||||
#endif // FEATURE_COMINTEROP
|
||||
ArraySubType = arraySubType;
|
||||
SizeParamIndex = sizeParamIndex;
|
||||
SizeConst = sizeConst;
|
||||
@@ -644,14 +622,12 @@ namespace System.Runtime.InteropServices{
|
||||
}
|
||||
public UnmanagedType Value { get { return _val; } }
|
||||
|
||||
#if FEATURE_COMINTEROP
|
||||
// Fields used with SubType = SafeArray.
|
||||
public VarEnum SafeArraySubType;
|
||||
public Type SafeArrayUserDefinedSubType;
|
||||
|
||||
// Field used with iid_is attribute (interface pointers).
|
||||
public int IidParameterIndex;
|
||||
#endif // FEATURE_COMINTEROP
|
||||
|
||||
// Fields used with SubType = ByValArray and LPArray.
|
||||
// Array size = parameter(PI) * PM + C
|
||||
@@ -1059,7 +1035,6 @@ namespace System.Runtime.InteropServices{
|
||||
public int MajorVersion { get {return _major;} }
|
||||
public int MinorVersion { get {return _minor;} }
|
||||
}
|
||||
#endif //FEATURE_COMINTEROP
|
||||
|
||||
[AttributeUsage(AttributeTargets.Interface, Inherited = false)]
|
||||
[System.Runtime.InteropServices.ComVisible(true)]
|
||||
@@ -1075,8 +1050,6 @@ namespace System.Runtime.InteropServices{
|
||||
public Type CoClass { get { return _CoClass; } }
|
||||
}
|
||||
|
||||
#if FEATURE_COMINTEROP || MONO
|
||||
|
||||
[AttributeUsage(AttributeTargets.Interface, Inherited = false)]
|
||||
[System.Runtime.InteropServices.ComVisible(true)]
|
||||
public sealed class ComEventInterfaceAttribute : Attribute
|
||||
@@ -1135,8 +1108,6 @@ namespace System.Runtime.InteropServices{
|
||||
public int RevisionNumber { get {return _revision;} }
|
||||
}
|
||||
|
||||
#endif //FEATURE_COMINTEROP
|
||||
|
||||
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Struct, Inherited = false)]
|
||||
[System.Runtime.InteropServices.ComVisible(true)]
|
||||
public sealed class BestFitMappingAttribute : Attribute
|
||||
@@ -1176,7 +1147,6 @@ namespace System.Runtime.InteropServices{
|
||||
}
|
||||
}
|
||||
|
||||
#if FEATURE_COMINTEROP
|
||||
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
|
||||
[System.Runtime.InteropServices.ComVisible(false)]
|
||||
public sealed class ManagedToNativeComInteropStubAttribute : Attribute
|
||||
@@ -1193,7 +1163,6 @@ namespace System.Runtime.InteropServices{
|
||||
public Type ClassType { get { return _classType; } }
|
||||
public String MethodName { get { return _methodName; } }
|
||||
}
|
||||
#endif // FEATURE_COMINTEROP
|
||||
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -152,9 +152,6 @@ public abstract class CriticalHandle : CriticalFinalizerObject, IDisposable
|
||||
#if DEBUG
|
||||
private String _stackTrace; // Where we allocated this CriticalHandle.
|
||||
#endif
|
||||
#if !FEATURE_CORECLR
|
||||
[System.Runtime.ForceTokenStabilization]
|
||||
#endif //!FEATURE_CORECLR
|
||||
protected IntPtr handle; // This must be protected so derived classes can use out params.
|
||||
private bool _isClosed; // Set by SetHandleAsInvalid or Close/Dispose/finalization.
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user