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:
Diffstat (limited to 'src/ILCompiler.Compiler/src/Compiler/Compilation.cs')
-rw-r--r--src/ILCompiler.Compiler/src/Compiler/Compilation.cs23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/ILCompiler.Compiler/src/Compiler/Compilation.cs b/src/ILCompiler.Compiler/src/Compiler/Compilation.cs
index d686a0d7b..b697d3020 100644
--- a/src/ILCompiler.Compiler/src/Compiler/Compilation.cs
+++ b/src/ILCompiler.Compiler/src/Compiler/Compilation.cs
@@ -58,7 +58,7 @@ namespace ILCompiler
foreach (var rootProvider in compilationRoots)
rootProvider.AddCompilationRoots(rootingService);
- MetadataType globalModuleGeneratedType = nodeFactory.CompilationModuleGroup.GeneratedAssembly.GetGlobalModuleType();
+ MetadataType globalModuleGeneratedType = nodeFactory.TypeSystemContext.GeneratedAssembly.GetGlobalModuleType();
_typeGetTypeMethodThunks = new TypeGetTypeMethodThunkCache(globalModuleGeneratedType);
_assemblyGetExecutingAssemblyMethodThunks = new AssemblyGetExecutingAssemblyMethodThunkCache(globalModuleGeneratedType);
_methodBaseGetCurrentMethodThunks = new MethodBaseGetCurrentMethodThunkCache();
@@ -90,6 +90,12 @@ namespace ILCompiler
public DelegateCreationInfo GetDelegateCtor(TypeDesc delegateType, MethodDesc target, bool followVirtualDispatch)
{
+ // If we're creating a delegate to a virtual method that cannot be overriden, devirtualize.
+ // This is not just an optimization - it's required for correctness in the presence of sealed
+ // vtable slots.
+ if (followVirtualDispatch && (target.IsFinal || target.OwningType.IsSealed()))
+ followVirtualDispatch = false;
+
return DelegateCreationInfo.Create(delegateType, target, NodeFactory, followVirtualDispatch);
}
@@ -102,7 +108,7 @@ namespace ILCompiler
{
var pInvokeFixup = (PInvokeLazyFixupField)field;
PInvokeMetadata metadata = pInvokeFixup.PInvokeMetadata;
- return NodeFactory.PInvokeMethodFixup(metadata.Module, metadata.Name);
+ return NodeFactory.PInvokeMethodFixup(metadata.Module, metadata.Name, metadata.Flags);
}
else
{
@@ -360,7 +366,7 @@ namespace ILCompiler
Debug.Assert(!type.IsGenericDefinition);
MetadataType metadataType = type as MetadataType;
- if (metadataType != null && metadataType.ThreadStaticFieldSize.AsInt > 0)
+ if (metadataType != null && metadataType.ThreadGcStaticFieldSize.AsInt > 0)
{
_graph.AddRoot(_factory.TypeThreadStaticIndex(metadataType), reason);
@@ -413,7 +419,16 @@ namespace ILCompiler
public void RootModuleMetadata(ModuleDesc module, string reason)
{
- _graph.AddRoot(_factory.ModuleMetadata(module), reason);
+ // RootModuleMetadata is kind of a hack - this is pretty much only used to force include
+ // type forwarders from assemblies metadata generator would normally not look at.
+ // This will go away when the temporary RD.XML parser goes away.
+ if (_factory.MetadataManager is UsageBasedMetadataManager)
+ _graph.AddRoot(_factory.ModuleMetadata(module), reason);
+ }
+
+ public void RootReadOnlyDataBlob(byte[] data, int alignment, string reason, string exportName)
+ {
+ _graph.AddRoot(_factory.ReadOnlyDataBlob(exportName, data, alignment), reason);
}
}
}