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
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2017-10-18 03:39:13 +0300
committerGitHub <noreply@github.com>2017-10-18 03:39:13 +0300
commit53f2da1da47159b7b4dd39de53e0887ab9a013e8 (patch)
tree1008c137f87955ed7c5b482219b850455a5ec48e /src/System.Private.TypeLoader
parent1fca2dfcbc764702cc6a100d2edabc205069b8e5 (diff)
parent22d3a015a8240a03d4a5237968ea7997647ecaa5 (diff)
Merge pull request #4747 from dotnet/nmirror
Merge nmirror to master
Diffstat (limited to 'src/System.Private.TypeLoader')
-rw-r--r--src/System.Private.TypeLoader/src/Internal/TypeSystem/RuntimeNoMetadataType.cs14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/System.Private.TypeLoader/src/Internal/TypeSystem/RuntimeNoMetadataType.cs b/src/System.Private.TypeLoader/src/Internal/TypeSystem/RuntimeNoMetadataType.cs
index 828b934d9..15bcb28bb 100644
--- a/src/System.Private.TypeLoader/src/Internal/TypeSystem/RuntimeNoMetadataType.cs
+++ b/src/System.Private.TypeLoader/src/Internal/TypeSystem/RuntimeNoMetadataType.cs
@@ -31,7 +31,8 @@ namespace Internal.TypeSystem.NoMetadata
private RuntimeTypeHandle _genericTypeDefinition;
private DefType _genericTypeDefinitionAsDefType;
private Instantiation _instantiation;
- private bool _baseTypeCached;
+
+ // "_baseType == this" means "base type was not initialized yet"
private DefType _baseType;
public NoMetadataType(TypeSystemContext context, RuntimeTypeHandle genericTypeDefinition, DefType genericTypeDefinitionAsDefType, Instantiation instantiation, int hashcode)
@@ -52,6 +53,9 @@ namespace Internal.TypeSystem.NoMetadata
Debug.Assert(((_instantiation.Length > 0) && _genericTypeDefinition.ToEETypePtr()->IsGenericTypeDefinition) ||
((_instantiation.Length == 0) && !_genericTypeDefinition.ToEETypePtr()->IsGenericTypeDefinition));
}
+
+ // Base type is not initialized
+ _baseType = this;
}
public override int GetHashCode()
@@ -71,7 +75,8 @@ namespace Internal.TypeSystem.NoMetadata
{
get
{
- if (_baseTypeCached)
+ // _baseType == this means we didn't initialize it yet
+ if (_baseType != this)
return _baseType;
if (RetrieveRuntimeTypeHandleIfPossible())
@@ -99,7 +104,7 @@ namespace Internal.TypeSystem.NoMetadata
NativeParser baseTypeParser = typeInfoParser.GetParserForBagElementKind(BagElementKind.BaseType);
ParseBaseType(state.NativeLayoutInfo.LoadContext, baseTypeParser);
- Debug.Assert(_baseTypeCached);
+ Debug.Assert(_baseType != this);
return _baseType;
}
}
@@ -124,9 +129,8 @@ namespace Internal.TypeSystem.NoMetadata
/// </summary>
public void SetBaseType(DefType baseType)
{
- Debug.Assert(!_baseTypeCached || _baseType == baseType);
+ Debug.Assert(_baseType == this || _baseType == baseType);
_baseType = baseType;
- _baseTypeCached = true;
}
protected override TypeFlags ComputeTypeFlags(TypeFlags mask)