diff options
Diffstat (limited to 'src/ILCompiler.Compiler/src/Compiler/UsageBasedMetadataManager.cs')
-rw-r--r-- | src/ILCompiler.Compiler/src/Compiler/UsageBasedMetadataManager.cs | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/src/ILCompiler.Compiler/src/Compiler/UsageBasedMetadataManager.cs b/src/ILCompiler.Compiler/src/Compiler/UsageBasedMetadataManager.cs index b5845786c..312a1a192 100644 --- a/src/ILCompiler.Compiler/src/Compiler/UsageBasedMetadataManager.cs +++ b/src/ILCompiler.Compiler/src/Compiler/UsageBasedMetadataManager.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; using System.Collections.Generic; using Internal.TypeSystem; @@ -23,6 +24,7 @@ namespace ILCompiler { private readonly CompilationModuleGroup _compilationModuleGroup; + internal readonly UsageBasedMetadataGenerationOptions _generationOptions; private readonly bool _hasPreciseFieldUsageInformation; private readonly List<ModuleDesc> _modulesWithMetadata = new List<ModuleDesc>(); @@ -34,13 +36,17 @@ namespace ILCompiler CompilationModuleGroup group, CompilerTypeSystemContext typeSystemContext, MetadataBlockingPolicy blockingPolicy, + ManifestResourceBlockingPolicy resourceBlockingPolicy, string logFile, - StackTraceEmissionPolicy stackTracePolicy) - : base(group.GeneratedAssembly, typeSystemContext, blockingPolicy, logFile, stackTracePolicy) + StackTraceEmissionPolicy stackTracePolicy, + DynamicInvokeThunkGenerationPolicy invokeThunkGenerationPolicy, + UsageBasedMetadataGenerationOptions generationOptions) + : base(typeSystemContext, blockingPolicy, resourceBlockingPolicy, logFile, stackTracePolicy, invokeThunkGenerationPolicy) { // We use this to mark places that would behave differently if we tracked exact fields used. _hasPreciseFieldUsageInformation = false; _compilationModuleGroup = group; + _generationOptions = generationOptions; } protected override void Graph_NewMarkedNode(DependencyNodeCore<NodeFactory> obj) @@ -353,8 +359,8 @@ namespace ILCompiler } } - return new AnalysisBasedMetadataManager(_compilationModuleGroup.GeneratedAssembly, - _typeSystemContext, _blockingPolicy, _metadataLogFile, _stackTraceEmissionPolicy, + return new AnalysisBasedMetadataManager( + _typeSystemContext, _blockingPolicy, _resourceBlockingPolicy, _metadataLogFile, _stackTraceEmissionPolicy, _dynamicInvokeThunkGenerationPolicy, _modulesWithMetadata, reflectableTypes.ToEnumerable(), reflectableMethods.ToEnumerable(), reflectableFields.ToEnumerable()); } @@ -438,4 +444,21 @@ namespace ILCompiler } } } + + [Flags] + public enum UsageBasedMetadataGenerationOptions + { + None = 0, + + /// <summary> + /// Specifies that complete metadata should be generated for types. + /// </summary> + /// <remarks> + /// If this option is set, generated metadata will no longer be pay for play, + /// and a certain class of bugs will disappear (APIs returning "member doesn't + /// exist" at runtime, even though the member exists and we just didn't generate the metadata). + /// Reflection blocking still applies. + /// </remarks> + CompleteTypesOnly = 1, + } } |