summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/Runtime/CompilerServices
diff options
context:
space:
mode:
Diffstat (limited to 'src/mscorlib/src/System/Runtime/CompilerServices')
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/AccessedThroughPropertyAttribute.cs30
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/AssemblySettingAttributes.cs94
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/AsyncMethodBuilder.cs112
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/AsyncStateMachineAttribute.cs18
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/CallerFilePathAttribute.cs17
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/CallerLineNumberAttribute.cs17
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/CallerMemberNameAttribute.cs17
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/CompilationRelaxations.cs50
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/CompilerGeneratedAttribute.cs16
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/CompilerGlobalScopeAttribute.cs26
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/CompilerMarshalOverride.cs23
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs8
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/CustomConstantAttribute.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/DateTimeConstantAttribute.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/DecimalConstantAttribute.cs4
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/DisablePrivateReflectionAttribute.cs18
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/DiscardableAttribute.cs18
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/ExtensionAttribute.cs13
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/FixedAddressValueTypeAttribute.cs14
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/FixedBufferAttribute.cs43
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/FormattableStringFactory.cs58
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/FriendAccessAllowedAttribute.cs (renamed from src/mscorlib/src/System/Runtime/CompilerServices/InternalsVisibleToAttribute.cs)36
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IAsyncStateMachine.cs27
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/ICastable.cs12
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/INotifyCompletion.cs39
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/ITuple.cs22
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IndexerNameAttribute.cs16
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IsVolatile.cs12
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IteratorStateMachineAttribute.cs18
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/MethodImplAttribute.cs61
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/ReferenceAssemblyAttribute.cs39
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/RuntimeCompatibilityAttribute.cs48
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs34
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs32
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/SpecialNameAttribute.cs27
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/StateMachineAttribute.cs20
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/SuppressIldasmAttribute.cs19
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/SuppressMergeCheckAttribute.cs23
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/TaskAwaiter.cs26
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/TupleElementNamesAttribute.cs57
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/TypeDependencyAttribute.cs18
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/TypeForwardedFromAttribute.cs35
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/TypeForwardedToAttribute.cs34
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/Unsafe.cs61
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/UnsafeValueTypeAttribute.cs14
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/YieldAwaitable.cs3
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/jithelpers.cs28
47 files changed, 230 insertions, 1131 deletions
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/AccessedThroughPropertyAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/AccessedThroughPropertyAttribute.cs
deleted file mode 100644
index 34e66beade..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/AccessedThroughPropertyAttribute.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-namespace System.Runtime.CompilerServices
-{
- using System;
-
- [AttributeUsage(AttributeTargets.Field)]
- public sealed class AccessedThroughPropertyAttribute : Attribute
- {
- private readonly string propertyName;
-
- public AccessedThroughPropertyAttribute(string propertyName)
- {
- this.propertyName = propertyName;
- }
-
- public string PropertyName
- {
- get
- {
- return propertyName;
- }
- }
- }
-}
-
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/AssemblySettingAttributes.cs b/src/mscorlib/src/System/Runtime/CompilerServices/AssemblySettingAttributes.cs
deleted file mode 100644
index 5251122629..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/AssemblySettingAttributes.cs
+++ /dev/null
@@ -1,94 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-
-namespace System.Runtime.CompilerServices
-{
-
- using System;
- using System.Runtime.InteropServices;
-
- /*
- NGenHint is not supported in Whidbey
-
- [Serializable]
- public enum NGenHint
- {
- Default = 0x0000, // No preference specified
-
- Eager = 0x0001, // NGen at install time
- Lazy = 0x0002, // NGen after install time
- Never = 0x0003, // Assembly should not be ngened
- }
- */
-
- [Serializable]
- public enum LoadHint
- {
- Default = 0x0000, // No preference specified
-
- Always = 0x0001, // Dependency is always loaded
- Sometimes = 0x0002, // Dependency is sometimes loaded
- //Never = 0x0003, // Dependency is never loaded
- }
-
- [Serializable]
- [AttributeUsage(AttributeTargets.Assembly)]
- public sealed class DefaultDependencyAttribute : Attribute
- {
- private LoadHint loadHint;
-
- public DefaultDependencyAttribute (
- LoadHint loadHintArgument
- )
- {
- loadHint = loadHintArgument;
- }
-
- public LoadHint LoadHint
- {
- get
- {
- return loadHint;
- }
- }
- }
-
-
-[Serializable]
-[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
- public sealed class DependencyAttribute : Attribute
- {
- private String dependentAssembly;
- private LoadHint loadHint;
-
- public DependencyAttribute (
- String dependentAssemblyArgument,
- LoadHint loadHintArgument
- )
- {
- dependentAssembly = dependentAssemblyArgument;
- loadHint = loadHintArgument;
- }
-
- public String DependentAssembly
- {
- get
- {
- return dependentAssembly;
- }
- }
-
- public LoadHint LoadHint
- {
- get
- {
- return loadHint;
- }
- }
- }
-}
-
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/AsyncMethodBuilder.cs b/src/mscorlib/src/System/Runtime/CompilerServices/AsyncMethodBuilder.cs
index afb0c22778..fc7a7f01a3 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/AsyncMethodBuilder.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/AsyncMethodBuilder.cs
@@ -63,7 +63,7 @@ namespace System.Runtime.CompilerServices
// See comment on AsyncMethodBuilderCore.Start
// AsyncMethodBuilderCore.Start(ref stateMachine);
- if (stateMachine == null) throw new ArgumentNullException(nameof(stateMachine));
+ if (stateMachine == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.stateMachine);
Contract.EndContractBlock();
// Run the MoveNext method within a copy-on-write ExecutionContext scope.
@@ -72,7 +72,6 @@ namespace System.Runtime.CompilerServices
Thread currentThread = Thread.CurrentThread;
ExecutionContextSwitcher ecs = default(ExecutionContextSwitcher);
- RuntimeHelpers.PrepareConstrainedRegions();
try
{
ExecutionContext.EstablishCopyOnWriteScope(currentThread, ref ecs);
@@ -240,15 +239,8 @@ namespace System.Runtime.CompilerServices
}
}
- // This property lazily instantiates the Task in a non-thread-safe manner.
- private Task Task
- {
- get
- {
- if (m_task == null) m_task = new Task();
- return m_task;
- }
- }
+ /// <summary>Lazily instantiate the Task in a non-thread-safe manner.</summary>
+ private Task Task => m_task ?? (m_task = new Task());
/// <summary>
/// Gets an object that may be used to uniquely identify this builder to the debugger.
@@ -295,7 +287,7 @@ namespace System.Runtime.CompilerServices
// See comment on AsyncMethodBuilderCore.Start
// AsyncMethodBuilderCore.Start(ref stateMachine);
- if (stateMachine == null) throw new ArgumentNullException(nameof(stateMachine));
+ if (stateMachine == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.stateMachine);
Contract.EndContractBlock();
// Run the MoveNext method within a copy-on-write ExecutionContext scope.
@@ -304,7 +296,6 @@ namespace System.Runtime.CompilerServices
Thread currentThread = Thread.CurrentThread;
ExecutionContextSwitcher ecs = default(ExecutionContextSwitcher);
- RuntimeHelpers.PrepareConstrainedRegions();
try
{
ExecutionContext.EstablishCopyOnWriteScope(currentThread, ref ecs);
@@ -358,7 +349,11 @@ namespace System.Runtime.CompilerServices
/// <summary>Gets the <see cref="System.Threading.Tasks.Task"/> for this builder.</summary>
/// <returns>The <see cref="System.Threading.Tasks.Task"/> representing the builder's asynchronous operation.</returns>
/// <exception cref="System.InvalidOperationException">The builder is not initialized.</exception>
- public Task Task { get { return m_builder.Task; } }
+ public Task Task
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get { return m_builder.Task; }
+ }
/// <summary>
/// Completes the <see cref="System.Threading.Tasks.Task"/> in the
@@ -449,7 +444,7 @@ namespace System.Runtime.CompilerServices
// See comment on AsyncMethodBuilderCore.Start
// AsyncMethodBuilderCore.Start(ref stateMachine);
- if (stateMachine == null) throw new ArgumentNullException(nameof(stateMachine));
+ if (stateMachine == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.stateMachine);
Contract.EndContractBlock();
// Run the MoveNext method within a copy-on-write ExecutionContext scope.
@@ -458,7 +453,6 @@ namespace System.Runtime.CompilerServices
Thread currentThread = Thread.CurrentThread;
ExecutionContextSwitcher ecs = default(ExecutionContextSwitcher);
- RuntimeHelpers.PrepareConstrainedRegions();
try
{
ExecutionContext.EstablishCopyOnWriteScope(currentThread, ref ecs);
@@ -502,7 +496,7 @@ namespace System.Runtime.CompilerServices
{
// Force the Task to be initialized prior to the first suspending await so
// that the original stack-based builder has a reference to the right Task.
- var builtTask = this.Task;
+ Task builtTask = this.Task;
// Box the state machine, then tell the boxed instance to call back into its own builder,
// so we can cache the boxed reference. NOTE: The language compiler may choose to use
@@ -542,7 +536,7 @@ namespace System.Runtime.CompilerServices
{
// Force the Task to be initialized prior to the first suspending await so
// that the original stack-based builder has a reference to the right Task.
- var builtTask = this.Task;
+ Task<TResult> builtTask = this.Task;
// Box the state machine, then tell the boxed instance to call back into its own builder,
// so we can cache the boxed reference. NOTE: The language compiler may choose to use
@@ -563,15 +557,14 @@ namespace System.Runtime.CompilerServices
/// <returns>The <see cref="System.Threading.Tasks.Task{TResult}"/> representing the builder's asynchronous operation.</returns>
public Task<TResult> Task
{
- get
- {
- // Get and return the task. If there isn't one, first create one and store it.
- var task = m_task;
- if (task == null) { m_task = task = new Task<TResult>(); }
- return task;
- }
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get { return m_task ?? InitializeTask(); }
}
+ /// <summary>Initializes the task, which must not yet be initialized.</summary>
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ private Task<TResult> InitializeTask() => (m_task = new Task<TResult>());
+
/// <summary>
/// Completes the <see cref="System.Threading.Tasks.Task{TResult}"/> in the
/// <see cref="System.Threading.Tasks.TaskStatus">RanToCompletion</see> state with the specified result.
@@ -582,28 +575,49 @@ namespace System.Runtime.CompilerServices
{
// Get the currently stored task, which will be non-null if get_Task has already been accessed.
// If there isn't one, get a task and store it.
- var task = m_task;
- if (task == null)
+ if (m_task == null)
{
m_task = GetTaskForResult(result);
Debug.Assert(m_task != null, "GetTaskForResult should never return null");
}
- // Slow path: complete the existing task.
else
{
- if (AsyncCausalityTracer.LoggingOn)
- AsyncCausalityTracer.TraceOperationCompletion(CausalityTraceLevel.Required, task.Id, AsyncCausalityStatus.Completed);
+ // Slow path: complete the existing task.
+ SetExistingTaskResult(result);
+ }
+ }
- //only log if we have a real task that was previously created
- if (System.Threading.Tasks.Task.s_asyncDebuggingEnabled)
- {
- System.Threading.Tasks.Task.RemoveFromActiveTasks(task.Id);
- }
+ /// <summary>Completes the already initialized task with the specified result.</summary>
+ /// <param name="result">The result to use to complete the task.</param>
+ private void SetExistingTaskResult(TResult result)
+ {
+ Debug.Assert(m_task != null, "Expected non-null task");
- if (!task.TrySetResult(result))
- {
- throw new InvalidOperationException(Environment.GetResourceString("TaskT_TransitionToFinal_AlreadyCompleted"));
- }
+ if (AsyncCausalityTracer.LoggingOn || System.Threading.Tasks.Task.s_asyncDebuggingEnabled)
+ {
+ LogExistingTaskCompletion();
+ }
+
+ if (!m_task.TrySetResult(result))
+ {
+ ThrowHelper.ThrowInvalidOperationException(ExceptionResource.TaskT_TransitionToFinal_AlreadyCompleted);
+ }
+ }
+
+ /// <summary>Handles logging for the successful completion of an operation.</summary>
+ private void LogExistingTaskCompletion()
+ {
+ Debug.Assert(m_task != null);
+
+ if (AsyncCausalityTracer.LoggingOn)
+ {
+ AsyncCausalityTracer.TraceOperationCompletion(CausalityTraceLevel.Required, m_task.Id, AsyncCausalityStatus.Completed);
+ }
+
+ // only log if we have a real task that was previously created
+ if (System.Threading.Tasks.Task.s_asyncDebuggingEnabled)
+ {
+ System.Threading.Tasks.Task.RemoveFromActiveTasks(m_task.Id);
}
}
@@ -620,15 +634,14 @@ namespace System.Runtime.CompilerServices
// Get the currently stored task, which will be non-null if get_Task has already been accessed.
// If there isn't one, store the supplied completed task.
- var task = m_task;
- if (task == null)
+ if (m_task == null)
{
m_task = completedTask;
}
else
{
// Otherwise, complete the task that's there.
- SetResult(default(TResult));
+ SetExistingTaskResult(default(TResult));
}
}
@@ -667,7 +680,7 @@ namespace System.Runtime.CompilerServices
if (!successfullySet)
{
- throw new InvalidOperationException(Environment.GetResourceString("TaskT_TransitionToFinal_AlreadyCompleted"));
+ ThrowHelper.ThrowInvalidOperationException(ExceptionResource.TaskT_TransitionToFinal_AlreadyCompleted);
}
}
@@ -704,6 +717,7 @@ namespace System.Runtime.CompilerServices
/// </summary>
/// <param name="result">The result for which we need a task.</param>
/// <returns>The completed task containing the result.</returns>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)] // method looks long, but for a given TResult it results in a relatively small amount of asm
private Task<TResult> GetTaskForResult(TResult result)
{
Contract.Ensures(
@@ -846,9 +860,9 @@ namespace System.Runtime.CompilerServices
/// <exception cref="System.InvalidOperationException">The builder is incorrectly initialized.</exception>
public void SetStateMachine(IAsyncStateMachine stateMachine)
{
- if (stateMachine == null) throw new ArgumentNullException(nameof(stateMachine));
+ if (stateMachine == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.stateMachine);
Contract.EndContractBlock();
- if (m_stateMachine != null) throw new InvalidOperationException(Environment.GetResourceString("AsyncMethodBuilder_InstanceNotInitialized"));
+ if (m_stateMachine != null) ThrowHelper.ThrowInvalidOperationException(ExceptionResource.AsyncMethodBuilder_InstanceNotInitialized);
m_stateMachine = stateMachine;
}
@@ -1104,12 +1118,12 @@ namespace System.Runtime.CompilerServices
return action;
}
- ///<summary>
- /// Given an action, see if it is a contiunation wrapper and has a Task associated with it. If so return it (null otherwise)
- ///</summary>
+ ///<summary>
+ /// Given an action, see if it is a contiunation wrapper and has a Task associated with it. If so return it (null otherwise)
+ ///</summary>
internal static Task TryGetContinuationTask(Action action)
{
- if (action != null)
+ if (action != null)
{
var asWrapper = action.Target as ContinuationWrapper;
if (asWrapper != null)
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/AsyncStateMachineAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/AsyncStateMachineAttribute.cs
deleted file mode 100644
index f1fc9ced82..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/AsyncStateMachineAttribute.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-
-using System;
-
-namespace System.Runtime.CompilerServices
-{
- [Serializable, AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
- public sealed class AsyncStateMachineAttribute : StateMachineAttribute
- {
- public AsyncStateMachineAttribute(Type stateMachineType)
- : base(stateMachineType)
- {
- }
- }
-}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/CallerFilePathAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/CallerFilePathAttribute.cs
deleted file mode 100644
index 330934cf95..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/CallerFilePathAttribute.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-
-using System;
-
-namespace System.Runtime.CompilerServices
-{
- [AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
- public sealed class CallerFilePathAttribute : Attribute
- {
- public CallerFilePathAttribute()
- {
- }
- }
-}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/CallerLineNumberAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/CallerLineNumberAttribute.cs
deleted file mode 100644
index 9c87e8e25f..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/CallerLineNumberAttribute.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-
-using System;
-
-namespace System.Runtime.CompilerServices
-{
- [AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
- public sealed class CallerLineNumberAttribute : Attribute
- {
- public CallerLineNumberAttribute()
- {
- }
- }
-}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/CallerMemberNameAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/CallerMemberNameAttribute.cs
deleted file mode 100644
index 4fc70908fb..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/CallerMemberNameAttribute.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-
-using System;
-
-namespace System.Runtime.CompilerServices
-{
- [AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
- public sealed class CallerMemberNameAttribute : Attribute
- {
- public CallerMemberNameAttribute()
- {
- }
- }
-}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/CompilationRelaxations.cs b/src/mscorlib/src/System/Runtime/CompilerServices/CompilationRelaxations.cs
deleted file mode 100644
index c3679b610c..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/CompilationRelaxations.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-
-namespace System.Runtime.CompilerServices
-{
-
- using System;
-
- /// IMPORTANT: Keep this in sync with corhdr.h
-[Serializable]
-[Flags]
- public enum CompilationRelaxations : int
- {
- NoStringInterning = 0x0008, // Start in 0x0008, we had other non public flags in this enum before,
- // so we'll start here just in case somebody used them. This flag is only
- // valid when set for Assemblies.
- };
-
-[Serializable]
-[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Method)]
- public class CompilationRelaxationsAttribute : Attribute
- {
- private int m_relaxations; // The relaxations.
-
- public CompilationRelaxationsAttribute (
- int relaxations)
- {
- m_relaxations = relaxations;
- }
-
- public CompilationRelaxationsAttribute (
- CompilationRelaxations relaxations)
- {
- m_relaxations = (int) relaxations;
- }
-
- public int CompilationRelaxations
- {
- get
- {
- return m_relaxations;
- }
- }
- }
-
-}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/CompilerGeneratedAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/CompilerGeneratedAttribute.cs
deleted file mode 100644
index 1778506c7c..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/CompilerGeneratedAttribute.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-namespace System.Runtime.CompilerServices {
-
-[Serializable]
-[AttributeUsage(AttributeTargets.All, Inherited = true)]
- public sealed class CompilerGeneratedAttribute : Attribute
- {
- public CompilerGeneratedAttribute () {}
- }
-}
-
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/CompilerGlobalScopeAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/CompilerGlobalScopeAttribute.cs
deleted file mode 100644
index 1cd830cfca..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/CompilerGlobalScopeAttribute.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*============================================================
-**
-**
-**
-** Purpose: Attribute used to communicate to the VS7 debugger
-** that a class should be treated as if it has
-** global scope.
-**
-**
-===========================================================*/
-
-
-namespace System.Runtime.CompilerServices
-{
- [Serializable]
- [AttributeUsage(AttributeTargets.Class)]
- public class CompilerGlobalScopeAttribute : Attribute
- {
- public CompilerGlobalScopeAttribute () {}
- }
-}
-
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/CompilerMarshalOverride.cs b/src/mscorlib/src/System/Runtime/CompilerServices/CompilerMarshalOverride.cs
deleted file mode 100644
index a7b4aca480..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/CompilerMarshalOverride.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace System.Runtime.CompilerServices
-{
- // The CLR data marshaler has some behaviors that are incompatible with
- // C++. Specifically, C++ treats boolean variables as byte size, whereas
- // the marshaller treats them as 4-byte size. Similarly, C++ treats
- // wchar_t variables as 4-byte size, whereas the marshaller treats them
- // as single byte size under certain conditions. In order to work around
- // such issues, the C++ compiler will emit a type that the marshaller will
- // marshal using the correct sizes. In addition, the compiler will place
- // this modopt onto the variables to indicate that the specified type is
- // not the true type. Any compiler that needed to deal with similar
- // marshalling incompatibilities could use this attribute as well.
- //
- // Indicates that the modified instance differs from its true type for
- // correct marshalling.
- public static class CompilerMarshalOverride
- {
- }
-}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs b/src/mscorlib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs
index 4b2648ba6f..f32cc2b510 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs
@@ -61,6 +61,7 @@
using System.Collections;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading;
@@ -164,7 +165,6 @@ namespace System.Runtime.CompilerServices
{
CreateEntry(key, value);
}
-
}
}
@@ -797,7 +797,7 @@ namespace System.Runtime.CompilerServices
}
return Resize(newSize);
- }
+ }
internal Container Resize(int newSize)
{
@@ -974,7 +974,7 @@ namespace System.Runtime.CompilerServices
{
if (_invalid)
{
- throw new InvalidOperationException(Environment.GetResourceString("CollectionCorrupted"));
+ throw new InvalidOperationException(SR.InvalidOperation_CollectionCorrupted);
}
}
@@ -1114,7 +1114,7 @@ namespace System.Runtime.CompilerServices
{
IntPtr handle = _handle;
_handle = (IntPtr)0;
- nFree(handle);
+ nFree(handle);
}
}
#endregion
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/CustomConstantAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/CustomConstantAttribute.cs
index 1a5dcfdc11..8f4c79cd94 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/CustomConstantAttribute.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/CustomConstantAttribute.cs
@@ -8,7 +8,7 @@ using System.Collections.Generic;
namespace System.Runtime.CompilerServices
{
[Serializable]
- [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter, Inherited=false)]
+ [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
public abstract class CustomConstantAttribute : Attribute
{
public abstract Object Value { get; }
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/DateTimeConstantAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/DateTimeConstantAttribute.cs
index 148d916be1..7aca42b627 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/DateTimeConstantAttribute.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/DateTimeConstantAttribute.cs
@@ -8,7 +8,7 @@ using System.Diagnostics.Contracts;
namespace System.Runtime.CompilerServices
{
[Serializable]
- [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter, Inherited=false)]
+ [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
public sealed class DateTimeConstantAttribute : CustomConstantAttribute
{
public DateTimeConstantAttribute(long ticks)
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/DecimalConstantAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/DecimalConstantAttribute.cs
index f05191840d..0e2b6f8418 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/DecimalConstantAttribute.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/DecimalConstantAttribute.cs
@@ -13,7 +13,7 @@ using System.Collections.Generic;
namespace System.Runtime.CompilerServices
{
[Serializable]
- [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter, Inherited=false)]
+ [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
public sealed class DecimalConstantAttribute : Attribute
{
[CLSCompliant(false)]
@@ -25,7 +25,7 @@ namespace System.Runtime.CompilerServices
uint low
)
{
- dec = new System.Decimal((int) low, (int)mid, (int)hi, (sign != 0), scale);
+ dec = new System.Decimal((int)low, (int)mid, (int)hi, (sign != 0), scale);
}
public DecimalConstantAttribute(
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/DisablePrivateReflectionAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/DisablePrivateReflectionAttribute.cs
deleted file mode 100644
index 46dae10fdd..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/DisablePrivateReflectionAttribute.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-namespace System.Runtime.CompilerServices
-{
- using System;
-
- [AttributeUsage(AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
- public sealed class DisablePrivateReflectionAttribute : Attribute
- {
- public DisablePrivateReflectionAttribute() {}
- }
-}
-
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/DiscardableAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/DiscardableAttribute.cs
deleted file mode 100644
index 3fda4624d4..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/DiscardableAttribute.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-namespace System.Runtime.CompilerServices {
-
- using System;
-
- // Custom attribute to indicating a TypeDef is a discardable attribute
- public class DiscardableAttribute : Attribute
- {
- public DiscardableAttribute()
- {
- }
- }
-}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/ExtensionAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/ExtensionAttribute.cs
deleted file mode 100644
index 6ec8fa04f5..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/ExtensionAttribute.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-using System;
-
-namespace System.Runtime.CompilerServices
-{
- /// <summary>
- /// Indicates that a method is an extension method, or that a class or assembly contains extension methods.
- /// </summary>
- [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly)]
- public sealed class ExtensionAttribute : Attribute { }
-}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/FixedAddressValueTypeAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/FixedAddressValueTypeAttribute.cs
deleted file mode 100644
index 679e304ad1..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/FixedAddressValueTypeAttribute.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace System.Runtime.CompilerServices
-{
- using System;
-
-[Serializable]
-[AttributeUsage(AttributeTargets.Field)]
- sealed public class FixedAddressValueTypeAttribute : Attribute
- {
- }
-}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/FixedBufferAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/FixedBufferAttribute.cs
deleted file mode 100644
index a7d01b12c4..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/FixedBufferAttribute.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*============================================================
-**
-**
-** Purpose: Used by a compiler for generating value types
-** in-place within other value types containing a certain
-** number of elements of the given (primitive) type. Somewhat
-** similar to P/Invoke's ByValTStr attribute.
-** Used by C# with this syntax: "fixed int buffer[10];"
-**
-===========================================================*/
-using System;
-
-namespace System.Runtime.CompilerServices
-{
- [AttributeUsage(AttributeTargets.Field, Inherited=false)]
- public sealed class FixedBufferAttribute : Attribute
- {
- private Type elementType;
- private int length;
-
- public FixedBufferAttribute(Type elementType, int length)
- {
- this.elementType = elementType;
- this.length = length;
- }
-
- public Type ElementType {
- get {
- return elementType;
- }
- }
-
- public int Length {
- get {
- return length;
- }
- }
- }
-}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/FormattableStringFactory.cs b/src/mscorlib/src/System/Runtime/CompilerServices/FormattableStringFactory.cs
deleted file mode 100644
index 4b99a8a5d9..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/FormattableStringFactory.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*============================================================
-**
-** 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(nameof(format));
- }
-
- if (arguments == null)
- {
- throw new ArgumentNullException(nameof(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); }
- }
- }
-}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/InternalsVisibleToAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/FriendAccessAllowedAttribute.cs
index ee7807a5dd..9d380e1070 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/InternalsVisibleToAttribute.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/FriendAccessAllowedAttribute.cs
@@ -2,40 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
namespace System.Runtime.CompilerServices
{
- using System;
-
-
- [AttributeUsage(AttributeTargets.Assembly, AllowMultiple=true, Inherited=false)]
- public sealed class InternalsVisibleToAttribute : Attribute
- {
- private string _assemblyName;
- private bool _allInternalsVisible = true;
-
- public InternalsVisibleToAttribute(string assemblyName)
- {
- this._assemblyName = assemblyName;
- }
-
- public string AssemblyName
- {
- get
- {
- return _assemblyName;
- }
- }
-
- public bool AllInternalsVisible
- {
- get { return _allInternalsVisible; }
- set { _allInternalsVisible = value; }
- }
- }
-
/// <summary>
/// If AllInternalsVisible is not true for a friend assembly, the FriendAccessAllowed attribute
/// indicates which internals are shared with that friend assembly.
@@ -52,7 +20,7 @@ namespace System.Runtime.CompilerServices
AllowMultiple = false,
Inherited = false)]
[FriendAccessAllowed]
- internal sealed class FriendAccessAllowedAttribute : Attribute {
+ internal sealed class FriendAccessAllowedAttribute : Attribute
+ {
}
}
-
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/IAsyncStateMachine.cs b/src/mscorlib/src/System/Runtime/CompilerServices/IAsyncStateMachine.cs
deleted file mode 100644
index 7fb7ea5395..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/IAsyncStateMachine.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
-//
-//
-//
-// Represents state machines generated for asynchronous methods.
-//
-// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-
-namespace System.Runtime.CompilerServices
-{
- /// <summary>
- /// Represents state machines generated for asynchronous methods.
- /// This type is intended for compiler use only.
- /// </summary>
- public interface IAsyncStateMachine
- {
- /// <summary>Moves the state machine to its next state.</summary>
- void MoveNext();
- /// <summary>Configures the state machine with a heap-allocated replica.</summary>
- /// <param name="stateMachine">The heap-allocated replica.</param>
- void SetStateMachine(IAsyncStateMachine stateMachine);
- }
-}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/ICastable.cs b/src/mscorlib/src/System/Runtime/CompilerServices/ICastable.cs
index 7ba9434575..e2b76ed973 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/ICastable.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/ICastable.cs
@@ -61,22 +61,22 @@ namespace System.Runtime.CompilerServices
// IsInstanceOfInterface.
RuntimeTypeHandle GetImplType(RuntimeTypeHandle interfaceType);
}
-
+
/// <summary>
/// Helpers that allows VM to call into ICastable methods without having to deal with RuntimeTypeHandle.
/// RuntimeTypeHandle is a struct and is always passed in stack in x86, which our VM call helpers don't
/// particularly like.
/// </summary>
- class ICastableHelpers
+ internal class ICastableHelpers
{
internal static bool IsInstanceOfInterface(ICastable castable, RuntimeType type, out Exception castError)
{
return castable.IsInstanceOfInterface(new RuntimeTypeHandle(type), out castError);
- }
-
+ }
+
internal static RuntimeType GetImplType(ICastable castable, RuntimeType interfaceType)
{
- return castable.GetImplType(new RuntimeTypeHandle(interfaceType)).GetRuntimeType();
- }
+ return castable.GetImplType(new RuntimeTypeHandle(interfaceType)).GetRuntimeType();
+ }
}
}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/INotifyCompletion.cs b/src/mscorlib/src/System/Runtime/CompilerServices/INotifyCompletion.cs
deleted file mode 100644
index aba0a0691f..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/INotifyCompletion.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
-//
-//
-//
-// Interfaces used to represent instances that notify listeners of their completion via continuations.
-// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-using System;
-using System.Security;
-
-namespace System.Runtime.CompilerServices
-{
- /// <summary>
- /// Represents an operation that will schedule continuations when the operation completes.
- /// </summary>
- public interface INotifyCompletion
- {
- /// <summary>Schedules the continuation action to be invoked when the instance completes.</summary>
- /// <param name="continuation">The action to invoke when the operation completes.</param>
- /// <exception cref="System.ArgumentNullException">The <paramref name="continuation"/> argument is null (Nothing in Visual Basic).</exception>
- void OnCompleted(Action continuation);
- }
-
- /// <summary>
- /// Represents an awaiter used to schedule continuations when an await operation completes.
- /// </summary>
- public interface ICriticalNotifyCompletion : INotifyCompletion
- {
- /// <summary>Schedules the continuation action to be invoked when the instance completes.</summary>
- /// <param name="continuation">The action to invoke when the operation completes.</param>
- /// <exception cref="System.ArgumentNullException">The <paramref name="continuation"/> argument is null (Nothing in Visual Basic).</exception>
- /// <remarks>Unlike OnCompleted, UnsafeOnCompleted need not propagate ExecutionContext information.</remarks>
- void UnsafeOnCompleted(Action continuation);
- }
-}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/ITuple.cs b/src/mscorlib/src/System/Runtime/CompilerServices/ITuple.cs
deleted file mode 100644
index cafee11f8a..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/ITuple.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace System.Runtime.CompilerServices
-{
- /// <summary>
- /// This interface is required for types that want to be indexed into by dynamic patterns.
- /// </summary>
- public interface ITuple
- {
- /// <summary>
- /// The number of positions in this data structure.
- /// </summary>
- int Length { get; }
-
- /// <summary>
- /// Get the element at position <param name="index"/>.
- /// </summary>
- object this[int index] { get; }
- }
-}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/IndexerNameAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/IndexerNameAttribute.cs
deleted file mode 100644
index c32be6f3a2..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/IndexerNameAttribute.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace System.Runtime.CompilerServices
-{
- using System;
-
-[Serializable]
-[AttributeUsage(AttributeTargets.Property, Inherited = true)]
- public sealed class IndexerNameAttribute: Attribute
- {
- public IndexerNameAttribute(String indexerName)
- {}
- }
-}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/IsVolatile.cs b/src/mscorlib/src/System/Runtime/CompilerServices/IsVolatile.cs
deleted file mode 100644
index 5287e82b7b..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/IsVolatile.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace System.Runtime.CompilerServices
-{
- public static class IsVolatile
- {
- // no instantiation, please!
- }
-}
-
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/IteratorStateMachineAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/IteratorStateMachineAttribute.cs
deleted file mode 100644
index 4bb9b4eb8f..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/IteratorStateMachineAttribute.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-
-using System;
-
-namespace System.Runtime.CompilerServices
-{
- [Serializable, AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
- public sealed class IteratorStateMachineAttribute : StateMachineAttribute
- {
- public IteratorStateMachineAttribute(Type stateMachineType)
- : base(stateMachineType)
- {
- }
- }
-}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/MethodImplAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/MethodImplAttribute.cs
index b4991110f8..b24018cf78 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/MethodImplAttribute.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/MethodImplAttribute.cs
@@ -2,72 +2,47 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-namespace System.Runtime.CompilerServices {
-
- using System;
- using System.Reflection;
-
+
+using System;
+using System.Reflection;
+
+namespace System.Runtime.CompilerServices
+{
// This Enum matchs the miImpl flags defined in corhdr.h. It is used to specify
// certain method properties.
-
- [Serializable]
- [Flags]
- public enum MethodImplOptions
- {
- Unmanaged = System.Reflection.MethodImplAttributes.Unmanaged,
- ForwardRef = System.Reflection.MethodImplAttributes.ForwardRef,
- PreserveSig = System.Reflection.MethodImplAttributes.PreserveSig,
- InternalCall = System.Reflection.MethodImplAttributes.InternalCall,
- Synchronized = System.Reflection.MethodImplAttributes.Synchronized,
- NoInlining = System.Reflection.MethodImplAttributes.NoInlining,
- AggressiveInlining = System.Reflection.MethodImplAttributes.AggressiveInlining,
- NoOptimization = System.Reflection.MethodImplAttributes.NoOptimization,
- // **** If you add something, update internal MethodImplAttribute(MethodImplAttributes methodImplAttributes)! ****
- }
+ // Custom attribute to specify additional method properties.
[Serializable]
- public enum MethodCodeType
+ [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor, Inherited = false)]
+ sealed public class MethodImplAttribute : Attribute
{
- IL = System.Reflection.MethodImplAttributes.IL,
- Native = System.Reflection.MethodImplAttributes.Native,
- /// <internalonly/>
- OPTIL = System.Reflection.MethodImplAttributes.OPTIL,
- Runtime = System.Reflection.MethodImplAttributes.Runtime
- }
-
- // Custom attribute to specify additional method properties.
-[Serializable]
-[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor, Inherited = false)]
- sealed public class MethodImplAttribute : Attribute
- {
- internal MethodImplOptions _val;
- public MethodCodeType MethodCodeType;
+ internal MethodImplOptions _val;
+ public MethodCodeType MethodCodeType;
internal MethodImplAttribute(MethodImplAttributes methodImplAttributes)
{
- MethodImplOptions all =
- MethodImplOptions.Unmanaged | MethodImplOptions.ForwardRef | MethodImplOptions.PreserveSig |
+ MethodImplOptions all =
+ MethodImplOptions.Unmanaged | MethodImplOptions.ForwardRef | MethodImplOptions.PreserveSig |
MethodImplOptions.InternalCall | MethodImplOptions.Synchronized |
MethodImplOptions.NoInlining | MethodImplOptions.AggressiveInlining |
MethodImplOptions.NoOptimization;
_val = ((MethodImplOptions)methodImplAttributes) & all;
}
-
+
public MethodImplAttribute(MethodImplOptions methodImplOptions)
{
_val = methodImplOptions;
}
-
+
public MethodImplAttribute(short value)
{
_val = (MethodImplOptions)value;
}
-
+
public MethodImplAttribute()
{
}
-
- public MethodImplOptions Value { get {return _val;} }
- }
+ public MethodImplOptions Value { get { return _val; } }
+ }
}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/ReferenceAssemblyAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/ReferenceAssemblyAttribute.cs
deleted file mode 100644
index d5e64a1177..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/ReferenceAssemblyAttribute.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*============================================================
-**
-** Attribute: ReferenceAssemblyAttribute
-**
-** Purpose: Identifies an assembly as being a "reference
-** assembly", meaning it contains public surface area but
-** no usable implementation. Reference assemblies
-** should be loadable for introspection, but not execution.
-**
-============================================================*/
-namespace System.Runtime.CompilerServices
-{
- using System;
-
- [Serializable]
- [AttributeUsage(AttributeTargets.Assembly, AllowMultiple=false)]
- public sealed class ReferenceAssemblyAttribute : Attribute
- {
- private String _description; // Maybe ".NET FX v4.0 SP1, partial trust"?
-
- public ReferenceAssemblyAttribute()
- {
- }
-
- public ReferenceAssemblyAttribute(String description)
- {
- _description = description;
- }
-
- public String Description
- {
- get { return _description; }
- }
- }
-}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeCompatibilityAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeCompatibilityAttribute.cs
deleted file mode 100644
index 40a9b7c568..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeCompatibilityAttribute.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-/*=============================================================================
-**
-**
-**
-** Purpose: Mark up the program to indicate various legacy or new opt-in behaviors.
-**
-**
-=============================================================================*/
-
-namespace System.Runtime.CompilerServices
-{
-
- using System;
-
-[Serializable]
-[AttributeUsage(AttributeTargets.Assembly, Inherited=false, AllowMultiple=false)]
- public sealed class RuntimeCompatibilityAttribute : Attribute
- {
- // fields
- private bool m_wrapNonExceptionThrows;
-
- // constructors
- public RuntimeCompatibilityAttribute() {
- // legacy behavior is the default, and m_wrapNonExceptionThrows is implicitly
- // false thanks to the CLR's guarantee of zeroed memory.
- }
-
- // properties
-
- // If a non-CLSCompliant exception (i.e. one that doesn't derive from System.Exception) is
- // thrown, should it be wrapped up in a System.Runtime.CompilerServices.RuntimeWrappedException
- // instance when presented to catch handlers?
- public bool WrapNonExceptionThrows {
- get {
- return m_wrapNonExceptionThrows;
- }
- set {
- m_wrapNonExceptionThrows = value;
- }
- }
- }
-}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs b/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs
index 509e527ecb..0338b18bee 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs
@@ -9,8 +9,9 @@
// This class defines a set of static methods that provide support for compilers.
//
//
-namespace System.Runtime.CompilerServices {
+namespace System.Runtime.CompilerServices
+{
using System;
using System.Security;
using System.Runtime;
@@ -32,7 +33,7 @@ namespace System.Runtime.CompilerServices {
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- public static extern void InitializeArray(Array array,RuntimeFieldHandle fldHandle);
+ public static extern void InitializeArray(Array array, RuntimeFieldHandle fldHandle);
// GetObjectValue is intended to allow value classes to be manipulated as 'Object'
// but have aliasing behavior of a value class. The intent is that you would use
@@ -61,7 +62,7 @@ namespace System.Runtime.CompilerServices {
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern void _RunClassConstructor(RuntimeType type);
- public static void RunClassConstructor(RuntimeTypeHandle type)
+ public static void RunClassConstructor(RuntimeTypeHandle type)
{
_RunClassConstructor(type.GetRuntimeType());
}
@@ -77,24 +78,24 @@ namespace System.Runtime.CompilerServices {
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern void _RunModuleConstructor(System.Reflection.RuntimeModule module);
- public static void RunModuleConstructor(ModuleHandle module)
+ public static void RunModuleConstructor(ModuleHandle module)
{
- _RunModuleConstructor(module.GetRuntimeModule());
+ _RunModuleConstructor(module.GetRuntimeModule());
}
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity]
internal static extern void _CompileMethod(IRuntimeMethodInfo method);
- public static void PrepareMethod(RuntimeMethodHandle method){}
- public static void PrepareMethod(RuntimeMethodHandle method, RuntimeTypeHandle[] instantiation){}
- public static void PrepareContractedDelegate(Delegate d){}
-
+ public static void PrepareMethod(RuntimeMethodHandle method) { }
+ public static void PrepareMethod(RuntimeMethodHandle method, RuntimeTypeHandle[] instantiation) { }
+ public static void PrepareContractedDelegate(Delegate d) { }
+
public static void PrepareDelegate(Delegate d)
{
if (d == null)
{
- throw new ArgumentNullException ("d");
+ throw new ArgumentNullException("d");
}
}
@@ -108,8 +109,9 @@ namespace System.Runtime.CompilerServices {
{
// 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 {
+ [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
// over the MethodTable pointer, & String
@@ -167,6 +169,14 @@ namespace System.Runtime.CompilerServices {
{
((CleanupCode)backoutCode)(userData, exceptionThrown);
}
+
+ /// <returns>true if given type is reference type or value type that contains references</returns>
+ static public bool IsReferenceOrContainsReferences<T>()
+ {
+ // The body of this function will be replaced by the EE with unsafe code!!!
+ // See getILIntrinsicImplementation for how this happens.
+ throw new InvalidOperationException();
+ }
}
}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs b/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs
index e3b2d2ce62..c050000169 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs
@@ -11,29 +11,34 @@
**
=============================================================================*/
-namespace System.Runtime.CompilerServices {
- using System;
- using System.Runtime.Serialization;
- using System.Runtime.Remoting;
- using System.Diagnostics.Contracts;
-
+using System;
+using System.Runtime.Serialization;
+using System.Runtime.Remoting;
+using System.Diagnostics.Contracts;
+
+namespace System.Runtime.CompilerServices
+{
[Serializable]
public sealed class RuntimeWrappedException : Exception
{
private RuntimeWrappedException(Object thrownObject)
- : base(Environment.GetResourceString("RuntimeWrappedException")) {
- SetErrorCode(System.__HResults.COR_E_RUNTIMEWRAPPED);
+ : base(SR.RuntimeWrappedException)
+ {
+ HResult = System.__HResults.COR_E_RUNTIMEWRAPPED;
m_wrappedException = thrownObject;
}
-
- public Object WrappedException {
+
+ public Object WrappedException
+ {
get { return m_wrappedException; }
}
private Object m_wrappedException;
- public override void GetObjectData(SerializationInfo info, StreamingContext context) {
- if (info==null) {
+ public override void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ if (info == null)
+ {
throw new ArgumentNullException(nameof(info));
}
Contract.EndContractBlock();
@@ -42,7 +47,8 @@ namespace System.Runtime.CompilerServices {
}
internal RuntimeWrappedException(SerializationInfo info, StreamingContext context)
- : base(info, context) {
+ : base(info, context)
+ {
m_wrappedException = info.GetValue("WrappedException", typeof(Object));
}
}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/SpecialNameAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/SpecialNameAttribute.cs
deleted file mode 100644
index 38e5538b44..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/SpecialNameAttribute.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-
-using System;
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-namespace System.Runtime.CompilerServices
-{
- [AttributeUsage(AttributeTargets.Class |
- AttributeTargets.Method |
- AttributeTargets.Property |
- AttributeTargets.Field |
- AttributeTargets.Event |
- AttributeTargets.Struct)]
-
-
- public sealed class SpecialNameAttribute : Attribute
- {
- public SpecialNameAttribute() { }
- }
-}
-
-
-
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/StateMachineAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/StateMachineAttribute.cs
deleted file mode 100644
index 7c84009e1f..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/StateMachineAttribute.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-
-using System;
-
-namespace System.Runtime.CompilerServices
-{
- [Serializable, AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
- public class StateMachineAttribute : Attribute
- {
- public Type StateMachineType { get; private set; }
-
- public StateMachineAttribute(Type stateMachineType)
- {
- this.StateMachineType = stateMachineType;
- }
- }
-}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/SuppressIldasmAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/SuppressIldasmAttribute.cs
deleted file mode 100644
index eb019eecbf..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/SuppressIldasmAttribute.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-namespace System.Runtime.CompilerServices
-{
- using System;
-
- [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module)]
- public sealed class SuppressIldasmAttribute : Attribute
- {
- public SuppressIldasmAttribute()
- {
- }
- }
-}
-
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/SuppressMergeCheckAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/SuppressMergeCheckAttribute.cs
deleted file mode 100644
index 6bb36c4bf5..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/SuppressMergeCheckAttribute.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-
-using System.Runtime.InteropServices;
-
-namespace System.Runtime.CompilerServices
-{
- [AttributeUsage(AttributeTargets.Class |
- AttributeTargets.Constructor |
- AttributeTargets.Method |
- AttributeTargets.Field |
- AttributeTargets.Event |
- AttributeTargets.Property)]
-
- internal sealed class SuppressMergeCheckAttribute : Attribute
- {
- public SuppressMergeCheckAttribute()
- {}
- }
-}
-
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/TaskAwaiter.cs b/src/mscorlib/src/System/Runtime/CompilerServices/TaskAwaiter.cs
index f01900a5bf..e2fa6caa2d 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/TaskAwaiter.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/TaskAwaiter.cs
@@ -72,7 +72,7 @@ namespace System.Runtime.CompilerServices
/// <summary>Gets whether the task being awaited is completed.</summary>
/// <remarks>This property is intended for compiler user rather than use directly in code.</remarks>
/// <exception cref="System.NullReferenceException">The awaiter was not properly initialized.</exception>
- public bool IsCompleted
+ public bool IsCompleted
{
get { return m_task.IsCompleted; }
}
@@ -84,7 +84,7 @@ namespace System.Runtime.CompilerServices
/// <remarks>This method is intended for compiler user rather than use directly in code.</remarks>
public void OnCompleted(Action continuation)
{
- OnCompletedInternal(m_task, continuation, continueOnCapturedContext:true, flowExecutionContext:true);
+ OnCompletedInternal(m_task, continuation, continueOnCapturedContext: true, flowExecutionContext: true);
}
/// <summary>Schedules the continuation onto the <see cref="System.Threading.Tasks.Task"/> associated with this <see cref="TaskAwaiter"/>.</summary>
@@ -94,7 +94,7 @@ namespace System.Runtime.CompilerServices
/// <remarks>This method is intended for compiler user rather than use directly in code.</remarks>
public void UnsafeOnCompleted(Action continuation)
{
- OnCompletedInternal(m_task, continuation, continueOnCapturedContext:true, flowExecutionContext:false);
+ OnCompletedInternal(m_task, continuation, continueOnCapturedContext: true, flowExecutionContext: false);
}
/// <summary>Ends the await on the completed <see cref="System.Threading.Tasks.Task"/>.</summary>
@@ -240,7 +240,7 @@ namespace System.Runtime.CompilerServices
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));
}
@@ -303,7 +303,7 @@ namespace System.Runtime.CompilerServices
/// <summary>Gets whether the task being awaited is completed.</summary>
/// <remarks>This property is intended for compiler user rather than use directly in code.</remarks>
/// <exception cref="System.NullReferenceException">The awaiter was not properly initialized.</exception>
- public bool IsCompleted
+ public bool IsCompleted
{
get { return m_task.IsCompleted; }
}
@@ -315,7 +315,7 @@ namespace System.Runtime.CompilerServices
/// <remarks>This method is intended for compiler user rather than use directly in code.</remarks>
public void OnCompleted(Action continuation)
{
- TaskAwaiter.OnCompletedInternal(m_task, continuation, continueOnCapturedContext:true, flowExecutionContext:true);
+ TaskAwaiter.OnCompletedInternal(m_task, continuation, continueOnCapturedContext: true, flowExecutionContext: true);
}
/// <summary>Schedules the continuation onto the <see cref="System.Threading.Tasks.Task"/> associated with this <see cref="TaskAwaiter"/>.</summary>
@@ -325,7 +325,7 @@ namespace System.Runtime.CompilerServices
/// <remarks>This method is intended for compiler user rather than use directly in code.</remarks>
public void UnsafeOnCompleted(Action continuation)
{
- TaskAwaiter.OnCompletedInternal(m_task, continuation, continueOnCapturedContext:true, flowExecutionContext:false);
+ TaskAwaiter.OnCompletedInternal(m_task, continuation, continueOnCapturedContext: true, flowExecutionContext: false);
}
/// <summary>Ends the await on the completed <see cref="System.Threading.Tasks.Task{TResult}"/>.</summary>
@@ -390,7 +390,7 @@ namespace System.Runtime.CompilerServices
/// <summary>Gets whether the task being awaited is completed.</summary>
/// <remarks>This property is intended for compiler user rather than use directly in code.</remarks>
/// <exception cref="System.NullReferenceException">The awaiter was not properly initialized.</exception>
- public bool IsCompleted
+ public bool IsCompleted
{
get { return m_task.IsCompleted; }
}
@@ -402,7 +402,7 @@ namespace System.Runtime.CompilerServices
/// <remarks>This method is intended for compiler user rather than use directly in code.</remarks>
public void OnCompleted(Action continuation)
{
- TaskAwaiter.OnCompletedInternal(m_task, continuation, m_continueOnCapturedContext, flowExecutionContext:true);
+ TaskAwaiter.OnCompletedInternal(m_task, continuation, m_continueOnCapturedContext, flowExecutionContext: true);
}
/// <summary>Schedules the continuation onto the <see cref="System.Threading.Tasks.Task"/> associated with this <see cref="TaskAwaiter"/>.</summary>
@@ -412,7 +412,7 @@ namespace System.Runtime.CompilerServices
/// <remarks>This method is intended for compiler user rather than use directly in code.</remarks>
public void UnsafeOnCompleted(Action continuation)
{
- TaskAwaiter.OnCompletedInternal(m_task, continuation, m_continueOnCapturedContext, flowExecutionContext:false);
+ TaskAwaiter.OnCompletedInternal(m_task, continuation, m_continueOnCapturedContext, flowExecutionContext: false);
}
/// <summary>Ends the await on the completed <see cref="System.Threading.Tasks.Task"/>.</summary>
@@ -475,7 +475,7 @@ namespace System.Runtime.CompilerServices
/// <summary>Gets whether the task being awaited is completed.</summary>
/// <remarks>This property is intended for compiler user rather than use directly in code.</remarks>
/// <exception cref="System.NullReferenceException">The awaiter was not properly initialized.</exception>
- public bool IsCompleted
+ public bool IsCompleted
{
get { return m_task.IsCompleted; }
}
@@ -487,7 +487,7 @@ namespace System.Runtime.CompilerServices
/// <remarks>This method is intended for compiler user rather than use directly in code.</remarks>
public void OnCompleted(Action continuation)
{
- TaskAwaiter.OnCompletedInternal(m_task, continuation, m_continueOnCapturedContext, flowExecutionContext:true);
+ TaskAwaiter.OnCompletedInternal(m_task, continuation, m_continueOnCapturedContext, flowExecutionContext: true);
}
/// <summary>Schedules the continuation onto the <see cref="System.Threading.Tasks.Task"/> associated with this <see cref="TaskAwaiter"/>.</summary>
@@ -497,7 +497,7 @@ namespace System.Runtime.CompilerServices
/// <remarks>This method is intended for compiler user rather than use directly in code.</remarks>
public void UnsafeOnCompleted(Action continuation)
{
- TaskAwaiter.OnCompletedInternal(m_task, continuation, m_continueOnCapturedContext, flowExecutionContext:false);
+ TaskAwaiter.OnCompletedInternal(m_task, continuation, m_continueOnCapturedContext, flowExecutionContext: false);
}
/// <summary>Ends the await on the completed <see cref="System.Threading.Tasks.Task{TResult}"/>.</summary>
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/TupleElementNamesAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/TupleElementNamesAttribute.cs
deleted file mode 100644
index 65b120e6b4..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/TupleElementNamesAttribute.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Collections.Generic;
-
-namespace System.Runtime.CompilerServices
-{
- /// <summary>
- /// Indicates that the use of <see cref="System.ValueTuple"/> on a member is meant to be treated as a tuple with element names.
- /// </summary>
- [CLSCompliant(false)]
- [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Event)]
- public sealed class TupleElementNamesAttribute : Attribute
- {
- private readonly string[] _transformNames;
-
- /// <summary>
- /// Initializes a new instance of the <see
- /// cref="TupleElementNamesAttribute"/> class.
- /// </summary>
- /// <param name="transformNames">
- /// Specifies, in a pre-order depth-first traversal of a type's
- /// construction, which <see cref="System.ValueType"/> occurrences are
- /// meant to carry element names.
- /// </param>
- /// <remarks>
- /// This constructor is meant to be used on types that contain an
- /// instantiation of <see cref="System.ValueType"/> that contains
- /// element names. For instance, if <c>C</c> is a generic type with
- /// two type parameters, then a use of the constructed type <c>C{<see
- /// cref="System.ValueTuple{T1, T2}"/>, <see
- /// cref="System.ValueTuple{T1, T2, T3}"/></c> might be intended to
- /// treat the first type argument as a tuple with element names and the
- /// second as a tuple without element names. In which case, the
- /// appropriate attribute specification should use a
- /// <c>transformNames</c> value of <c>{ "name1", "name2", null, null,
- /// null }</c>.
- /// </remarks>
- public TupleElementNamesAttribute(string[] transformNames)
- {
- if (transformNames == null)
- {
- throw new ArgumentNullException(nameof(transformNames));
- }
-
- _transformNames = transformNames;
- }
-
- /// <summary>
- /// Specifies, in a pre-order depth-first traversal of a type's
- /// construction, which <see cref="System.ValueTuple"/> elements are
- /// meant to carry element names.
- /// </summary>
- public IList<string> TransformNames => _transformNames;
- }
-} \ No newline at end of file
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/TypeDependencyAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/TypeDependencyAttribute.cs
index 2de9c1f785..929cbe7608 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/TypeDependencyAttribute.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/TypeDependencyAttribute.cs
@@ -2,28 +2,26 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-namespace System.Runtime.CompilerServices
-{
- using System;
- using System.Diagnostics.Contracts;
+using System;
+using System.Diagnostics.Contracts;
+namespace System.Runtime.CompilerServices
+{
// We might want to make this inherited someday. But I suspect it shouldn't
// be necessary.
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
- internal sealed class TypeDependencyAttribute: Attribute
+ internal sealed class TypeDependencyAttribute : Attribute
{
-
private string typeName;
- public TypeDependencyAttribute (string typeName)
+ public TypeDependencyAttribute(string typeName)
{
- if(typeName == null) throw new ArgumentNullException(nameof(typeName));
+ if (typeName == null) throw new ArgumentNullException(nameof(typeName));
Contract.EndContractBlock();
this.typeName = typeName;
}
}
-
}
-
+
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/TypeForwardedFromAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/TypeForwardedFromAttribute.cs
deleted file mode 100644
index 671d1f0071..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/TypeForwardedFromAttribute.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-
-namespace System.Runtime.CompilerServices
-{
- [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false, AllowMultiple = false)]
- public sealed class TypeForwardedFromAttribute : Attribute
- {
- string assemblyFullName;
-
- private TypeForwardedFromAttribute()
- {
- // Disallow default constructor
- }
-
-
- public TypeForwardedFromAttribute(string assemblyFullName)
- {
- if (String.IsNullOrEmpty(assemblyFullName))
- {
- throw new ArgumentNullException(nameof(assemblyFullName));
- }
- this.assemblyFullName = assemblyFullName;
- }
-
- public string AssemblyFullName
- {
- get {
- return assemblyFullName;
- }
- }
- }
-}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/TypeForwardedToAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/TypeForwardedToAttribute.cs
deleted file mode 100644
index 147c103047..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/TypeForwardedToAttribute.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-
-using System;
-using System.Reflection;
-
-namespace System.Runtime.CompilerServices
-{
- using System;
- [AttributeUsage(AttributeTargets.Assembly, AllowMultiple=true, Inherited=false)]
- public sealed class TypeForwardedToAttribute : Attribute
- {
- private Type _destination;
-
- public TypeForwardedToAttribute(Type destination)
- {
- _destination = destination;
- }
-
- public Type Destination
- {
- get {
- return _destination;
- }
- }
-
- }
-}
-
-
-
-
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/Unsafe.cs b/src/mscorlib/src/System/Runtime/CompilerServices/Unsafe.cs
index adfa015161..b184cd9fa8 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/Unsafe.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/Unsafe.cs
@@ -4,6 +4,12 @@
using System.Runtime.Versioning;
+#if BIT64
+using nuint = System.UInt64;
+#else
+using nuint = System.UInt32;
+#endif
+
namespace System.Runtime.CompilerServices
{
//
@@ -37,6 +43,7 @@ namespace System.Runtime.CompilerServices
{
// The body of this function will be replaced by the EE with unsafe code that just returns sizeof !!T
// See getILIntrinsicImplementationForUnsafe for how this happens.
+ typeof(T).ToString(); // Type token used by the actual method body
throw new InvalidOperationException();
}
@@ -61,7 +68,19 @@ namespace System.Runtime.CompilerServices
{
// The body of this function will be replaced by the EE with unsafe code!!!
// See getILIntrinsicImplementationForUnsafe for how this happens.
- typeof(T).ToString(); // Type used by the actual method body
+ typeof(T).ToString(); // Type token used by the actual method body
+ throw new InvalidOperationException();
+ }
+
+ /// <summary>
+ /// Adds an element offset to the given reference.
+ /// </summary>
+ [NonVersionable]
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static ref T AddByteOffset<T>(ref T source, nuint byteOffset)
+ {
+ // The body of this function will be replaced by the EE with unsafe code!!!
+ // See getILIntrinsicImplementationForUnsafe for how this happens.
throw new InvalidOperationException();
}
@@ -89,5 +108,45 @@ namespace System.Runtime.CompilerServices
// See getILIntrinsicImplementationForUnsafe for how this happens.
throw new InvalidOperationException();
}
+
+ [NonVersionable]
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static T ReadUnaligned<T>(void* source)
+ {
+ // The body of this function will be replaced by the EE with unsafe code!!!
+ // See getILIntrinsicImplementationForUnsafe for how this happens.
+ typeof(T).ToString(); // Type token used by the actual method body
+ throw new InvalidOperationException();
+ }
+
+ [NonVersionable]
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static T ReadUnaligned<T>(ref byte source)
+ {
+ // The body of this function will be replaced by the EE with unsafe code!!!
+ // See getILIntrinsicImplementationForUnsafe for how this happens.
+ typeof(T).ToString(); // Type token used by the actual method body
+ throw new InvalidOperationException();
+ }
+
+ [NonVersionable]
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static void WriteUnaligned<T>(void* destination, T value)
+ {
+ // The body of this function will be replaced by the EE with unsafe code!!!
+ // See getILIntrinsicImplementationForUnsafe for how this happens.
+ typeof(T).ToString(); // Type token used by the actual method body
+ throw new InvalidOperationException();
+ }
+
+ [NonVersionable]
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static void WriteUnaligned<T>(ref byte destination, T value)
+ {
+ // The body of this function will be replaced by the EE with unsafe code!!!
+ // See getILIntrinsicImplementationForUnsafe for how this happens.
+ typeof(T).ToString(); // Type token used by the actual method body
+ throw new InvalidOperationException();
+ }
}
}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/UnsafeValueTypeAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/UnsafeValueTypeAttribute.cs
deleted file mode 100644
index bc210ccb71..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/UnsafeValueTypeAttribute.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace System.Runtime.CompilerServices
-{
- using System;
-
-[Serializable]
-[AttributeUsage(AttributeTargets.Struct)]
- sealed public class UnsafeValueTypeAttribute : Attribute
- {
- }
-}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/YieldAwaitable.cs b/src/mscorlib/src/System/Runtime/CompilerServices/YieldAwaitable.cs
index 92d1b4f95b..f1c7772526 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/YieldAwaitable.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/YieldAwaitable.cs
@@ -144,7 +144,6 @@ namespace System.Runtime.CompilerServices
etwLog.TaskWaitContinuationComplete(continuationId);
});
-
}
/// <summary>WaitCallback that invokes the Action supplied as object state.</summary>
@@ -157,7 +156,7 @@ namespace System.Runtime.CompilerServices
private static void RunAction(object state) { ((Action)state)(); }
/// <summary>Ends the await operation.</summary>
- public void GetResult() {} // Nop. It exists purely because the compiler pattern demands it.
+ public void GetResult() { } // Nop. It exists purely because the compiler pattern demands it.
}
}
}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/jithelpers.cs b/src/mscorlib/src/System/Runtime/CompilerServices/jithelpers.cs
index 080e42f46f..b86835f778 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/jithelpers.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/jithelpers.cs
@@ -16,8 +16,8 @@ using System.Diagnostics.Contracts;
using System.Runtime.InteropServices;
using System.Security;
-namespace System.Runtime.CompilerServices {
-
+namespace System.Runtime.CompilerServices
+{
// Wrapper for address of a string variable on stack
internal struct StringHandleOnStack
{
@@ -114,14 +114,14 @@ namespace System.Runtime.CompilerServices {
static internal int UnsafeEnumCast<T>(T val) where T : struct // Actually T must be 4 byte (or less) enum
{
- Debug.Assert(typeof(T).IsEnum
- && (Enum.GetUnderlyingType(typeof(T)) == typeof(int)
- || Enum.GetUnderlyingType(typeof(T)) == typeof(uint)
+ Debug.Assert(typeof(T).IsEnum
+ && (Enum.GetUnderlyingType(typeof(T)) == typeof(int)
+ || Enum.GetUnderlyingType(typeof(T)) == typeof(uint)
|| Enum.GetUnderlyingType(typeof(T)) == typeof(short)
|| Enum.GetUnderlyingType(typeof(T)) == typeof(ushort)
|| Enum.GetUnderlyingType(typeof(T)) == typeof(byte)
|| Enum.GetUnderlyingType(typeof(T)) == typeof(sbyte)),
- "Error, T must be an 4 byte (or less) enum JitHelpers.UnsafeEnumCast!");
+ "Error, T must be an 4 byte (or less) enum JitHelpers.UnsafeEnumCast!");
return UnsafeEnumCastInternal<T>(val);
}
@@ -134,9 +134,9 @@ namespace System.Runtime.CompilerServices {
static internal long UnsafeEnumCastLong<T>(T val) where T : struct // Actually T must be 8 byte enum
{
- Debug.Assert(typeof(T).IsEnum
- && (Enum.GetUnderlyingType(typeof(T)) == typeof(long)
- || Enum.GetUnderlyingType(typeof(T)) == typeof(ulong)),
+ Debug.Assert(typeof(T).IsEnum
+ && (Enum.GetUnderlyingType(typeof(T)) == typeof(long)
+ || Enum.GetUnderlyingType(typeof(T)) == typeof(ulong)),
"Error, T must be an 8 byte enum JitHelpers.UnsafeEnumCastLong!");
return UnsafeEnumCastLongInternal<T>(val);
}
@@ -213,7 +213,7 @@ namespace System.Runtime.CompilerServices {
#if _DEBUG
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- extern static bool IsAddressInStack(IntPtr ptr);
+ private extern static bool IsAddressInStack(IntPtr ptr);
#endif
static internal bool ByRefLessThan<T>(ref T refA, ref T refB)
@@ -223,14 +223,6 @@ namespace System.Runtime.CompilerServices {
throw new InvalidOperationException();
}
- /// <returns>true if given type is reference type or value type that contains references</returns>
- static internal bool ContainsReferences<T>()
- {
- // The body of this function will be replaced by the EE with unsafe code!!!
- // See getILIntrinsicImplementation for how this happens.
- throw new InvalidOperationException();
- }
-
static internal ref T GetArrayData<T>(T[] array)
{
// The body of this function will be replaced by the EE with unsafe code!!!