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:
authorMichal Strehovsky <michals@microsoft.com>2017-08-31 23:32:04 +0300
committerMichal Strehovsky <michals@microsoft.com>2017-08-31 23:32:04 +0300
commit01146d99291879f7506ec2ce08ce43984aeabef3 (patch)
tree9ad450ddc8625eaf5b777fb3908c0ed4cf0e8b7b /src/System.Private.TypeLoader
parent572f9e1d6c210078b831508c7cd230ce33202963 (diff)
Fix type loader handling of __Canon in CoreRT
On Project N, `__Canon` is backed by an actual type in System.Private.CoreLib. In the new type system, we no longer need each type to have a token and we chose `__Canon` to be a synthetic type created out of thin air. This poses a small problem when trying to refer to it from C#. In this change: * I'm making us not include `__Canon.cs` on CoreRT anymore. * I'm updating the single method mode command line parser to parse `__Canon` specially. We were already special casing it by rewriting the type tree anyway (parse as an ECMA type and then replace). (This is what Project X uses in the bridging code too.) * I'm making `GetCanonType` an intrinsic (which has access to the `__Canon` TypeDesc) * Putting some code under ifdef that doesn't apply on CoreRT [tfs-changeset: 1672488]
Diffstat (limited to 'src/System.Private.TypeLoader')
-rw-r--r--src/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeBuilder.cs4
-rw-r--r--src/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/genericdictionarycell.cs2
-rw-r--r--src/System.Private.TypeLoader/src/Internal/TypeSystem/CanonTypes.Runtime.cs1
-rw-r--r--src/System.Private.TypeLoader/src/Internal/TypeSystem/TypeSystemContext.Runtime.cs2
4 files changed, 9 insertions, 0 deletions
diff --git a/src/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeBuilder.cs b/src/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeBuilder.cs
index a23b0453b..7296204a0 100644
--- a/src/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeBuilder.cs
+++ b/src/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeBuilder.cs
@@ -505,9 +505,11 @@ namespace Internal.Runtime.TypeLoader
// If so, use that, otherwise, run down the template type loader path with the universal template
if ((state.TemplateType == null) || isTemplateUniversalCanon)
{
+#if !CORERT
// CanonAlike types do not get dictionaries
if ((state.TemplateType == null) && (type.IsConstructedOverType(type.Context.CanonAlikeTypeArray)))
return;
+#endif
// ReadyToRun case - Native Layout is just the dictionary
NativeParser readyToRunInfoParser = state.GetParserForReadyToRunNativeLayoutInfo();
@@ -641,12 +643,14 @@ namespace Internal.Runtime.TypeLoader
TypeLoaderLogger.WriteLine("Found BagElementKind.DictionaryLayout");
Debug.Assert(!isTemplateUniversalCanon, "Universal template nativelayout do not have DictionaryLayout");
+#if !CORERT
if (type.IsConstructedOverType(type.Context.CanonAlikeTypeArray))
{
TypeLoaderLogger.WriteLine("Type is CanonAlike, skip generation of dictionary");
typeInfoParser.SkipInteger();
break;
}
+#endif
Debug.Assert(state.Dictionary == null);
if (!state.TemplateType.RetrieveRuntimeTypeHandleIfPossible())
diff --git a/src/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/genericdictionarycell.cs b/src/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/genericdictionarycell.cs
index 2ddeff53c..83a13d089 100644
--- a/src/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/genericdictionarycell.cs
+++ b/src/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/genericdictionarycell.cs
@@ -737,11 +737,13 @@ namespace Internal.Runtime.TypeLoader
bool methodRequestedIsCanonical = Method.IsCanonicalMethod(CanonicalFormKind.Specific);
MethodDesc canonAlikeForm;
+#if !CORERT
if (methodRequestedIsCanonical)
{
canonAlikeForm = Method.ReplaceTypesInConstructionOfMethod(Method.Context.CanonTypeArray, Method.Context.CanonAlikeTypeArray);
}
else
+#endif
{
canonAlikeForm = Method;
}
diff --git a/src/System.Private.TypeLoader/src/Internal/TypeSystem/CanonTypes.Runtime.cs b/src/System.Private.TypeLoader/src/Internal/TypeSystem/CanonTypes.Runtime.cs
index b7f4f5bc5..ce05945b4 100644
--- a/src/System.Private.TypeLoader/src/Internal/TypeSystem/CanonTypes.Runtime.cs
+++ b/src/System.Private.TypeLoader/src/Internal/TypeSystem/CanonTypes.Runtime.cs
@@ -5,6 +5,7 @@
using System;
+using Internal.Runtime;
using Internal.Runtime.Augments;
namespace Internal.TypeSystem
diff --git a/src/System.Private.TypeLoader/src/Internal/TypeSystem/TypeSystemContext.Runtime.cs b/src/System.Private.TypeLoader/src/Internal/TypeSystem/TypeSystemContext.Runtime.cs
index 5ed63432f..75564a154 100644
--- a/src/System.Private.TypeLoader/src/Internal/TypeSystem/TypeSystemContext.Runtime.cs
+++ b/src/System.Private.TypeLoader/src/Internal/TypeSystem/TypeSystemContext.Runtime.cs
@@ -647,6 +647,7 @@ namespace Internal.TypeSystem
_typesToFlushTypeSystemStateFrom = null;
}
+#if !CORERT
private TypeDesc _canonAlikeType;
public TypeDesc CanonAlikeType
@@ -681,6 +682,7 @@ namespace Internal.TypeSystem
return _canonTypeArray;
}
}
+#endif
#if ECMA_METADATA_SUPPORT
public class ModuleToEcmaModuleHashtable : LockFreeReaderHashtable<EcmaModuleInfo, Internal.TypeSystem.Ecma.EcmaModule>