Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2018-03-24 03:46:16 +0300
committerGitHub <noreply@github.com>2018-03-24 03:46:16 +0300
commitcb17e8c12407a25e62e259f525c6902f5a4f0bdb (patch)
tree2844a040c06cae60ba30c5f2713a34a973faa9ef /src
parent5f16e6b30fc22926e18cb22d02832e78fd02c15a (diff)
parent5975ce3f90a8ab1505da56a359d563c7e40fe242 (diff)
Merge pull request #5613 from dotnet/nmirror
Merge nmirror to master
Diffstat (limited to 'src')
-rw-r--r--src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NativeLayoutVertexNode.cs5
-rw-r--r--src/System.Private.CoreLib/src/System/Threading/CancellationToken.cs10
-rw-r--r--src/System.Private.CoreLib/src/System/Threading/CancellationTokenRegistration.cs19
-rw-r--r--src/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs10
-rw-r--r--src/System.Private.CoreLib/src/System/Threading/ManualResetEventSlim.cs4
-rw-r--r--src/System.Private.CoreLib/src/System/Threading/SemaphoreSlim.cs2
-rw-r--r--src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs8
7 files changed, 30 insertions, 28 deletions
diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NativeLayoutVertexNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NativeLayoutVertexNode.cs
index d83ba988c..b675e6016 100644
--- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NativeLayoutVertexNode.cs
+++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NativeLayoutVertexNode.cs
@@ -1465,6 +1465,7 @@ namespace ILCompiler.DependencyAnalysis
currentVTableIndex++;
int sealedVTableSlot = 0;
+ DefType closestDefType = implType.GetClosestDefType();
// Actual vtable slots follow
foreach (MethodDesc declMethod in vtableEntriesToProcess)
@@ -1472,13 +1473,13 @@ namespace ILCompiler.DependencyAnalysis
// No generic virtual methods can appear in the vtable!
Debug.Assert(!declMethod.HasInstantiation);
- MethodDesc implMethod = implType.GetClosestDefType().FindVirtualFunctionTargetMethodOnObjectType(declMethod);
+ MethodDesc implMethod = closestDefType.FindVirtualFunctionTargetMethodOnObjectType(declMethod);
if (implMethod.CanMethodBeInSealedVTable() && !implType.IsArrayTypeWithoutGenericInterfaces())
{
// Sealed vtable entries on other types in the hierarchy should not be reported (types read entries
// from their own sealed vtables, and not from the sealed vtables of base types).
- if (implMethod.OwningType == implType)
+ if (implMethod.OwningType == closestDefType)
operation(sealedVTableSlot++, true, declMethod, implMethod);
}
else
diff --git a/src/System.Private.CoreLib/src/System/Threading/CancellationToken.cs b/src/System.Private.CoreLib/src/System/Threading/CancellationToken.cs
index e3495aeb4..f37dc3457 100644
--- a/src/System.Private.CoreLib/src/System/Threading/CancellationToken.cs
+++ b/src/System.Private.CoreLib/src/System/Threading/CancellationToken.cs
@@ -167,7 +167,7 @@ namespace System.Threading
/// </remarks>
/// <param name="callback">The delegate to be executed when the <see cref="T:System.Threading.CancellationToken">CancellationToken</see> is canceled.</param>
/// <returns>The <see cref="T:System.Threading.CancellationTokenRegistration"/> instance that can
- /// be used to deregister the callback.</returns>
+ /// be used to unregister the callback.</returns>
/// <exception cref="T:System.ArgumentNullException"><paramref name="callback"/> is null.</exception>
/// <exception cref="T:System.ObjectDisposedException">The associated <see
/// cref="T:System.Threading.CancellationTokenSource">CancellationTokenSource</see> has been disposed.</exception>
@@ -200,7 +200,7 @@ namespace System.Threading
/// the current <see cref="T:System.Threading.SynchronizationContext">SynchronizationContext</see> and use it
/// when invoking the <paramref name="callback"/>.</param>
/// <returns>The <see cref="T:System.Threading.CancellationTokenRegistration"/> instance that can
- /// be used to deregister the callback.</returns>
+ /// be used to unregister the callback.</returns>
/// <exception cref="T:System.ArgumentNullException"><paramref name="callback"/> is null.</exception>
public CancellationTokenRegistration Register(Action callback, bool useSynchronizationContext)
{
@@ -229,7 +229,7 @@ namespace System.Threading
/// <param name="callback">The delegate to be executed when the <see cref="T:System.Threading.CancellationToken">CancellationToken</see> is canceled.</param>
/// <param name="state">The state to pass to the <paramref name="callback"/> when the delegate is invoked. This may be null.</param>
/// <returns>The <see cref="T:System.Threading.CancellationTokenRegistration"/> instance that can
- /// be used to deregister the callback.</returns>
+ /// be used to unregister the callback.</returns>
/// <exception cref="T:System.ArgumentNullException"><paramref name="callback"/> is null.</exception>
public CancellationTokenRegistration Register(Action<Object> callback, Object state)
{
@@ -265,7 +265,7 @@ namespace System.Threading
/// the current <see cref="T:System.Threading.SynchronizationContext">SynchronizationContext</see> and use it
/// when invoking the <paramref name="callback"/>.</param>
/// <returns>The <see cref="T:System.Threading.CancellationTokenRegistration"/> instance that can
- /// be used to deregister the callback.</returns>
+ /// be used to unregister the callback.</returns>
/// <exception cref="T:System.ArgumentNullException"><paramref name="callback"/> is null.</exception>
/// <exception cref="T:System.ObjectDisposedException">The associated <see
/// cref="T:System.Threading.CancellationTokenSource">CancellationTokenSource</see> has been disposed.</exception>
@@ -308,7 +308,7 @@ namespace System.Threading
/// the current <see cref="T:System.Threading.SynchronizationContext">SynchronizationContext</see> and use it
/// when invoking the <paramref name="callback"/>.</param>
/// <returns>The <see cref="T:System.Threading.CancellationTokenRegistration"/> instance that can
- /// be used to deregister the callback.</returns>
+ /// be used to unregister the callback.</returns>
/// <exception cref="T:System.ArgumentNullException"><paramref name="callback"/> is null.</exception>
/// <exception cref="T:System.ObjectDisposedException">The associated <see
/// cref="T:System.Threading.CancellationTokenSource">CancellationTokenSource</see> has been disposed.</exception>
diff --git a/src/System.Private.CoreLib/src/System/Threading/CancellationTokenRegistration.cs b/src/System.Private.CoreLib/src/System/Threading/CancellationTokenRegistration.cs
index d7180b16d..1125b26ef 100644
--- a/src/System.Private.CoreLib/src/System/Threading/CancellationTokenRegistration.cs
+++ b/src/System.Private.CoreLib/src/System/Threading/CancellationTokenRegistration.cs
@@ -37,12 +37,13 @@ namespace System.Threading
public CancellationToken Token => m_callbackInfo?.CancellationTokenSource.Token ?? default(CancellationToken);
/// <summary>
- /// Attempts to deregister the item. If it's already being run, this may fail.
+ /// Attempts to unregister the item. If it's already being run, this may fail.
/// Entails a full memory fence.
/// </summary>
- /// <returns>True if the callback was found and deregistered, false otherwise.</returns>
+ /// <returns>True if the callback was found and unregistered, false otherwise.</returns>
+ // Called from System.Runtime.WindowsRuntime. Also see the proposal at https://github.com/dotnet/corefx/issues/14903.
//[FriendAccessAllowed]
- internal bool TryDeregister()
+ public bool Unregister()
{
if (m_registrationInfo.Source == null) //can be null for dummy registrations.
return false;
@@ -61,14 +62,14 @@ namespace System.Threading
/// <summary>
/// Disposes of the registration and unregisters the target callback from the associated
/// <see cref="T:System.Threading.CancellationToken">CancellationToken</see>.
- /// If the target callback is currently executing this method will wait until it completes, except
- /// in the degenerate cases where a callback method deregisters itself.
+ /// If the target callback is currently executing, this method will wait until it completes, except
+ /// in the degenerate cases where a callback method unregisters itself.
/// </summary>
public void Dispose()
{
// Remove the entry from the array.
// This call includes a full memory fence which prevents potential reorderings of the reads below
- bool deregisterOccured = TryDeregister();
+ bool unregisterOccured = Unregister();
// We guarantee that we will not return if the callback is being executed (assuming we are not currently called by the callback itself)
// We achieve this by the following rules:
@@ -76,8 +77,8 @@ namespace System.Threading
// - if the currently executing callback is this CTR, then waiting would deadlock. (We choose to return rather than deadlock)
// - if not, then this CTR cannot be the one executing, hence no need to wait
//
- // 2. if deregistration failed, and we are on a different thread, then the callback may be running under control of cts.Cancel()
- // => poll until cts.ExecutingCallback is not the one we are trying to deregister.
+ // 2. if unregistration failed, and we are on a different thread, then the callback may be running under control of cts.Cancel()
+ // => poll until cts.ExecutingCallback is not the one we are trying to unregister.
var callbackInfo = m_callbackInfo;
if (callbackInfo != null)
@@ -85,7 +86,7 @@ namespace System.Threading
var tokenSource = callbackInfo.CancellationTokenSource;
if (tokenSource.IsCancellationRequested && //running callbacks has commenced.
!tokenSource.IsCancellationCompleted && //running callbacks hasn't finished
- !deregisterOccured && //deregistration failed (ie the callback is missing from the list)
+ !unregisterOccured && //unregistration failed (ie the callback is missing from the list)
tokenSource.ThreadIDExecutingCallbacks != Environment.CurrentManagedThreadId) //the executingThreadID is not this threadID.
{
// Callback execution is in progress, the executing thread is different to us and has taken the callback for execution
diff --git a/src/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs b/src/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs
index 30302b936..fa34800a5 100644
--- a/src/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs
+++ b/src/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs
@@ -527,7 +527,7 @@ namespace System.Threading
if (disposing && !m_disposed)
{
- //NOTE: We specifically tolerate that a callback can be deregistered
+ //NOTE: We specifically tolerate that a callback can be unregistered
// after the CTS has been disposed and/or concurrently with cts.Dispose().
// This is safe without locks because the reg.Dispose() only
// mutates a sparseArrayFragment and then reads from properties of the CTS that are not
@@ -665,9 +665,9 @@ namespace System.Threading
// If a cancellation has since come in, we will try to undo the registration and run the callback ourselves.
// (this avoids leaving the callback orphaned)
- bool deregisterOccurred = registration.TryDeregister();
+ bool unregisterOccurred = registration.Unregister();
- if (!deregisterOccurred)
+ if (!unregisterOccurred)
{
// The thread that is running Cancel() snagged our callback for execution.
// So we don't need to run it, but we do return the registration so that
@@ -1114,7 +1114,7 @@ namespace System.Threading
/// If no slots are available, the array is grown. The method doesn't return until successful.
/// </summary>
/// <param name="element">The element to add.</param>
- /// <returns>Information about where the add happened, to enable O(1) deregistration.</returns>
+ /// <returns>Information about where the add happened, to enable O(1) unregistration.</returns>
internal SparselyPopulatedArrayAddInfo<T> Add(T element)
{
while (true)
@@ -1137,7 +1137,7 @@ namespace System.Threading
int c = curr.Length;
// We'll compute a start offset based on how many free slots we think there
- // are. This optimizes for ordinary the LIFO deregistration pattern, and is
+ // are. This optimizes for ordinary the LIFO unregistration pattern, and is
// far from perfect due to the non-threadsafe ++ and -- of the free counter.
int start = ((c - curr.m_freeCount) % c);
if (start < 0)
diff --git a/src/System.Private.CoreLib/src/System/Threading/ManualResetEventSlim.cs b/src/System.Private.CoreLib/src/System/Threading/ManualResetEventSlim.cs
index a674901ea..e092eb0f7 100644
--- a/src/System.Private.CoreLib/src/System/Threading/ManualResetEventSlim.cs
+++ b/src/System.Private.CoreLib/src/System/Threading/ManualResetEventSlim.cs
@@ -611,7 +611,7 @@ namespace System.Threading
// Now enter the lock and wait.
EnsureLockObjectCreated();
- // We must register and deregister the token outside of the lock, to avoid deadlocks.
+ // We must register and unregister the token outside of the lock, to avoid deadlocks.
using (cancellationToken.InternalRegisterWithoutEC(s_cancellationTokenCallback, this))
{
using (LockHolder.Hold(m_lock))
@@ -665,7 +665,7 @@ namespace System.Threading
}
}
}
- } // automatically disposes (and deregisters) the callback
+ } // automatically disposes (and unregisters) the callback
return true; //done. The wait was satisfied.
}
diff --git a/src/System.Private.CoreLib/src/System/Threading/SemaphoreSlim.cs b/src/System.Private.CoreLib/src/System/Threading/SemaphoreSlim.cs
index ba2c0ecd9..a6828558b 100644
--- a/src/System.Private.CoreLib/src/System/Threading/SemaphoreSlim.cs
+++ b/src/System.Private.CoreLib/src/System/Threading/SemaphoreSlim.cs
@@ -333,7 +333,7 @@ namespace System.Threading
bool lockTaken = false;
//Register for cancellation outside of the main lock.
- //NOTE: Register/deregister inside the lock can deadlock as different lock acquisition orders could
+ //NOTE: Register/unregister inside the lock can deadlock as different lock acquisition orders could
// occur for (1)this.m_lockObj and (2)cts.internalLock
CancellationTokenRegistration cancellationTokenRegistration = cancellationToken.InternalRegisterWithoutEC(s_cancellationTokenCanceledEventHandler, this);
try
diff --git a/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs b/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs
index 04a0c1a96..d7e7bc135 100644
--- a/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs
+++ b/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs
@@ -245,11 +245,11 @@ namespace System.Threading.Tasks
}
/// <summary>
- /// Checks if we registered a CT callback during construction, and deregisters it.
+ /// Checks if we registered a CT callback during construction, and unregisters it.
/// This should be called when we know the registration isn't useful anymore. Specifically from Finish() if the task has completed
/// successfully or with an exception.
/// </summary>
- internal void DeregisterCancellationCallback()
+ internal void UnregisterCancellationCallback()
{
if (m_cancellationRegistration != null)
{
@@ -2212,7 +2212,7 @@ namespace System.Threading.Tasks
if (cp != null)
{
cp.SetCompleted();
- cp.DeregisterCancellationCallback();
+ cp.UnregisterCancellationCallback();
}
// ready to run continuations and notify parent.
@@ -3140,7 +3140,7 @@ namespace System.Threading.Tasks
if (cp != null)
{
cp.SetCompleted();
- cp.DeregisterCancellationCallback();
+ cp.UnregisterCancellationCallback();
}
if (DebuggerSupport.LoggingOn)