summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/Runtime/CompilerServices
diff options
context:
space:
mode:
authorJiyoung Yun <jy910.yun@samsung.com>2017-06-13 18:47:36 +0900
committerJiyoung Yun <jy910.yun@samsung.com>2017-06-13 18:47:36 +0900
commit61d6a817e39d3bae0f47dbc09838d51db22a5d30 (patch)
treecb37caa1784bc738b976273335d6ed04a7cc80b0 /src/mscorlib/src/System/Runtime/CompilerServices
parent5b975f8233e8c8d17b215372f89ca713b45d6a0b (diff)
downloadcoreclr-61d6a817e39d3bae0f47dbc09838d51db22a5d30.tar.gz
coreclr-61d6a817e39d3bae0f47dbc09838d51db22a5d30.tar.bz2
coreclr-61d6a817e39d3bae0f47dbc09838d51db22a5d30.zip
Imported Upstream version 2.0.0.11992upstream/2.0.0.11992
Diffstat (limited to 'src/mscorlib/src/System/Runtime/CompilerServices')
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs38
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/CustomConstantAttribute.cs1
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/DateTimeConstantAttribute.cs1
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/DecimalConstantAttribute.cs1
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/MethodImplAttribute.cs1
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs14
6 files changed, 14 insertions, 42 deletions
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs b/src/mscorlib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs
index f32cc2b510..6c6f6ee472 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs
@@ -651,16 +651,10 @@ namespace System.Runtime.CompilerServices
int bucket = hashCode & (_buckets.Length - 1);
for (int entriesIndex = Volatile.Read(ref _buckets[bucket]); entriesIndex != -1; entriesIndex = _entries[entriesIndex].Next)
{
- if (_entries[entriesIndex].HashCode == hashCode)
+ if (_entries[entriesIndex].HashCode == hashCode && _entries[entriesIndex].depHnd.GetPrimaryAndSecondary(out value) == key)
{
- object primary, secondary;
- _entries[entriesIndex].depHnd.GetPrimaryAndSecondary(out primary, out secondary);
- if (primary == key)
- {
- GC.KeepAlive(this); // ensure we don't get finalized while accessing DependentHandles.
- value = secondary;
- return entriesIndex;
- }
+ GC.KeepAlive(this); // ensure we don't get finalized while accessing DependentHandles.
+ return entriesIndex;
}
}
@@ -677,7 +671,7 @@ namespace System.Runtime.CompilerServices
if (index < _entries.Length)
{
object oKey, oValue;
- _entries[index].depHnd.GetPrimaryAndSecondary(out oKey, out oValue);
+ oKey = _entries[index].depHnd.GetPrimaryAndSecondary(out oValue);
GC.KeepAlive(this); // ensure we don't get finalized while accessing DependentHandles.
if (oKey != null)
@@ -921,8 +915,8 @@ namespace System.Runtime.CompilerServices
{
for (int entriesIndex = _buckets[bucket]; entriesIndex != -1; entriesIndex = _entries[entriesIndex].Next)
{
- object primary = null, secondary = null;
- _entries[entriesIndex].depHnd.GetPrimaryAndSecondary(out primary, out secondary);
+ object primary, secondary;
+ primary = _entries[entriesIndex].depHnd.GetPrimaryAndSecondary(out secondary);
// Now that we've secured a strong reference to the secondary, must check the primary again
// to ensure it didn't expire (otherwise, we open a race where TryGetValue misreports an
@@ -951,7 +945,7 @@ namespace System.Runtime.CompilerServices
}
object thisKey, thisValue;
- _entries[entriesIndex].depHnd.GetPrimaryAndSecondary(out thisKey, out thisValue);
+ thisKey = _entries[entriesIndex].depHnd.GetPrimaryAndSecondary(out thisValue);
if (Equals(thisKey, key))
{
GC.KeepAlive(this); // ensure we don't get finalized while accessing DependentHandles.
@@ -1069,10 +1063,8 @@ namespace System.Runtime.CompilerServices
#region Constructors
public DependentHandle(object primary, object secondary)
{
- IntPtr handle = (IntPtr)0;
- nInitialize(primary, secondary, out handle);
// no need to check for null result: nInitialize expected to throw OOM.
- _handle = handle;
+ _handle = nInitialize(primary, secondary);
}
#endregion
@@ -1084,14 +1076,12 @@ namespace System.Runtime.CompilerServices
// primary.
public object GetPrimary()
{
- object primary;
- nGetPrimary(_handle, out primary);
- return primary;
+ return nGetPrimary(_handle);
}
- public void GetPrimaryAndSecondary(out object primary, out object secondary)
+ public object GetPrimaryAndSecondary(out object secondary)
{
- nGetPrimaryAndSecondary(_handle, out primary, out secondary);
+ return nGetPrimaryAndSecondary(_handle, out secondary);
}
public void SetPrimary(object primary)
@@ -1121,13 +1111,13 @@ namespace System.Runtime.CompilerServices
#region Private Members
[MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void nInitialize(object primary, object secondary, out IntPtr dependentHandle);
+ private static extern IntPtr nInitialize(object primary, object secondary);
[MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void nGetPrimary(IntPtr dependentHandle, out object primary);
+ private static extern object nGetPrimary(IntPtr dependentHandle);
[MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void nGetPrimaryAndSecondary(IntPtr dependentHandle, out object primary, out object secondary);
+ private static extern object nGetPrimaryAndSecondary(IntPtr dependentHandle, out object secondary);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void nSetPrimary(IntPtr dependentHandle, object primary);
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/CustomConstantAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/CustomConstantAttribute.cs
index 8f4c79cd94..7393bb2bcd 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/CustomConstantAttribute.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/CustomConstantAttribute.cs
@@ -7,7 +7,6 @@ using System.Collections.Generic;
namespace System.Runtime.CompilerServices
{
- [Serializable]
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
public abstract class CustomConstantAttribute : Attribute
{
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/DateTimeConstantAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/DateTimeConstantAttribute.cs
index 7aca42b627..5155d0085d 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/DateTimeConstantAttribute.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/DateTimeConstantAttribute.cs
@@ -7,7 +7,6 @@ using System.Diagnostics.Contracts;
namespace System.Runtime.CompilerServices
{
- [Serializable]
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
public sealed class DateTimeConstantAttribute : CustomConstantAttribute
{
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/DecimalConstantAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/DecimalConstantAttribute.cs
index 0e2b6f8418..f5fd5a21a3 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/DecimalConstantAttribute.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/DecimalConstantAttribute.cs
@@ -12,7 +12,6 @@ using System.Collections.Generic;
namespace System.Runtime.CompilerServices
{
- [Serializable]
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
public sealed class DecimalConstantAttribute : Attribute
{
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/MethodImplAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/MethodImplAttribute.cs
index b24018cf78..3c19ee8863 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/MethodImplAttribute.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/MethodImplAttribute.cs
@@ -12,7 +12,6 @@ namespace System.Runtime.CompilerServices
// certain method properties.
// Custom attribute to specify additional method properties.
- [Serializable]
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor, Inherited = false)]
sealed public class MethodImplAttribute : Attribute
{
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs b/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs
index c050000169..df52f301e4 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs
@@ -13,12 +13,10 @@
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)
@@ -37,19 +35,7 @@ namespace System.Runtime.CompilerServices
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
- if (info == null)
- {
- throw new ArgumentNullException(nameof(info));
- }
- Contract.EndContractBlock();
base.GetObjectData(info, context);
- info.AddValue("WrappedException", m_wrappedException, typeof(Object));
- }
-
- internal RuntimeWrappedException(SerializationInfo info, StreamingContext context)
- : base(info, context)
- {
- m_wrappedException = info.GetValue("WrappedException", typeof(Object));
}
}
}