예제 #1
0
 public GeneratingMetadataManager(CompilerTypeSystemContext typeSystemContext, MetadataBlockingPolicy blockingPolicy, string logFile, StackTraceEmissionPolicy stackTracePolicy)
     : base(typeSystemContext, blockingPolicy)
 {
     _metadataLogFile          = logFile;
     _stackTraceEmissionPolicy = stackTracePolicy;
     _generatedAssembly        = typeSystemContext.GeneratedAssembly;
 }
        public UsageBasedMetadataManager(
            CompilationModuleGroup group,
            CompilerTypeSystemContext typeSystemContext,
            MetadataBlockingPolicy blockingPolicy,
            ManifestResourceBlockingPolicy resourceBlockingPolicy,
            string logFile,
            StackTraceEmissionPolicy stackTracePolicy,
            DynamicInvokeThunkGenerationPolicy invokeThunkGenerationPolicy,
            FlowAnnotations flowAnnotations,
            UsageBasedMetadataGenerationOptions generationOptions,
            Logger logger,
            IEnumerable <KeyValuePair <string, bool> > featureSwitchValues,
            IEnumerable <string> rootEntireAssembliesModules,
            IEnumerable <string> trimmedAssemblies)
            : 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;

            FlowAnnotations = flowAnnotations;
            Logger          = logger;

            _featureSwitchHashtable = new FeatureSwitchHashtable(new Dictionary <string, bool>(featureSwitchValues));

            _rootEntireAssembliesModules = new HashSet <string>(rootEntireAssembliesModules);
            _trimmedAssemblies           = new HashSet <string>(trimmedAssemblies);
        }
예제 #3
0
 public MetadataManager(CompilationModuleGroup compilationModuleGroup, CompilerTypeSystemContext typeSystemContext, MetadataBlockingPolicy blockingPolicy, StackTraceEmissionPolicy stackTraceEmissionPolicy)
 {
     _compilationModuleGroup   = compilationModuleGroup;
     _typeSystemContext        = typeSystemContext;
     _blockingPolicy           = blockingPolicy;
     _stackTraceEmissionPolicy = stackTraceEmissionPolicy;
 }
 public GeneratingMetadataManager(CompilerTypeSystemContext typeSystemContext, MetadataBlockingPolicy blockingPolicy,
                                  ManifestResourceBlockingPolicy resourceBlockingPolicy, string logFile, StackTraceEmissionPolicy stackTracePolicy,
                                  DynamicInvokeThunkGenerationPolicy invokeThunkGenerationPolicy)
     : base(typeSystemContext, blockingPolicy, resourceBlockingPolicy, invokeThunkGenerationPolicy)
 {
     _metadataLogFile          = logFile;
     _stackTraceEmissionPolicy = stackTracePolicy;
     _generatedAssembly        = typeSystemContext.GeneratedAssembly;
 }
예제 #5
0
 public UsageBasedMetadataManager(
     CompilationModuleGroup group,
     CompilerTypeSystemContext typeSystemContext,
     MetadataBlockingPolicy blockingPolicy,
     string logFile,
     StackTraceEmissionPolicy stackTracePolicy)
     : base(group.GeneratedAssembly, typeSystemContext, blockingPolicy, logFile, stackTracePolicy)
 {
     _compilationModuleGroup = group;
 }
예제 #6
0
        public CompilerGeneratedMetadataManager(CompilationModuleGroup group, CompilerTypeSystemContext typeSystemContext, string logFile, StackTraceEmissionPolicy stackTracePolicy)
            : base(group, typeSystemContext, new BlockedInternalsBlockingPolicy())
        {
            _metadataLogFile          = logFile;
            _stackTraceEmissionPolicy = stackTracePolicy;

            if (DynamicInvokeMethodThunk.SupportsThunks(typeSystemContext))
            {
                _dynamicInvokeThunks = new Dictionary <DynamicInvokeMethodSignature, MethodDesc>();
            }
        }
예제 #7
0
        public GeneratingMetadataManager(ModuleDesc generatedAssembly, CompilerTypeSystemContext typeSystemContext, MetadataBlockingPolicy blockingPolicy, string logFile, StackTraceEmissionPolicy stackTracePolicy)
            : base(typeSystemContext, blockingPolicy)
        {
            _metadataLogFile          = logFile;
            _stackTraceEmissionPolicy = stackTracePolicy;
            _generatedAssembly        = generatedAssembly;

            if (DynamicInvokeMethodThunk.SupportsThunks(typeSystemContext))
            {
                _dynamicInvokeThunks = new Dictionary <DynamicInvokeMethodSignature, MethodDesc>();
            }
        }
예제 #8
0
 public UsageBasedMetadataManager(
     CompilationModuleGroup group,
     CompilerTypeSystemContext typeSystemContext,
     MetadataBlockingPolicy blockingPolicy,
     string logFile,
     StackTraceEmissionPolicy stackTracePolicy)
     : base(group.GeneratedAssembly, typeSystemContext, blockingPolicy, logFile, stackTracePolicy)
 {
     // We use this to mark places that would behave differently if we tracked exact fields used.
     _hasPreciseFieldUsageInformation = false;
     _compilationModuleGroup          = group;
 }
예제 #9
0
 public UsageBasedMetadataManager(
     CompilationModuleGroup group,
     CompilerTypeSystemContext typeSystemContext,
     MetadataBlockingPolicy blockingPolicy,
     ManifestResourceBlockingPolicy resourceBlockingPolicy,
     string logFile,
     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;
 }
예제 #10
0
 public PrecomputedMetadataManager(
     CompilationModuleGroup group,
     CompilerTypeSystemContext typeSystemContext,
     ModuleDesc metadataDescribingModule,
     IEnumerable <ModuleDesc> compilationModules,
     IEnumerable <ModuleDesc> inputMetadataOnlyAssemblies,
     byte[] metadataBlob,
     StackTraceEmissionPolicy stackTraceEmissionPolicy)
     : base(group, typeSystemContext, new AttributeSpecifiedBlockingPolicy(), stackTraceEmissionPolicy)
 {
     _metadataDescribingModule = metadataDescribingModule;
     _compilationModules       = new HashSet <ModuleDesc>(compilationModules);
     _metadataOnlyAssemblies   = new HashSet <ModuleDesc>(inputMetadataOnlyAssemblies);
     _loadedMetadata           = new Lazy <MetadataLoadedInfo>(LoadMetadata);
     _dynamicInvokeStubs       = new Lazy <Dictionary <MethodDesc, MethodDesc> >(LoadDynamicInvokeStubs);
     _metadataBlob             = metadataBlob;
 }
예제 #11
0
        public AnalysisBasedMetadataManager(
            CompilerTypeSystemContext typeSystemContext,
            MetadataBlockingPolicy blockingPolicy,
            string logFile,
            StackTraceEmissionPolicy stackTracePolicy,
            IEnumerable <ModuleDesc> modulesWithMetadata,
            IEnumerable <ReflectableEntity <TypeDesc> > reflectableTypes,
            IEnumerable <ReflectableEntity <MethodDesc> > reflectableMethods,
            IEnumerable <ReflectableEntity <FieldDesc> > reflectableFields)
            : base(typeSystemContext, blockingPolicy, logFile, stackTracePolicy)
        {
            _modulesWithMetadata = new List <ModuleDesc>(modulesWithMetadata);

            foreach (var refType in reflectableTypes)
            {
                _reflectableTypes.Add(refType.Entity, refType.Category);
            }

            foreach (var refMethod in reflectableMethods)
            {
                // Asking for description or runtime mapping for a member without asking
                // for the owning type would mean we can't actually satisfy the request.
                Debug.Assert((refMethod.Category & MetadataCategory.Description) == 0 ||
                             (_reflectableTypes[refMethod.Entity.OwningType] & MetadataCategory.Description) != 0);
                Debug.Assert((refMethod.Category & MetadataCategory.RuntimeMapping) == 0 ||
                             (_reflectableTypes[refMethod.Entity.OwningType] & MetadataCategory.RuntimeMapping) != 0);
                _reflectableMethods.Add(refMethod.Entity, refMethod.Category);

                MethodDesc canonMethod = refMethod.Entity.GetCanonMethodTarget(CanonicalFormKind.Specific);
                if (refMethod.Entity != canonMethod)
                {
                    if (!_reflectableMethods.TryGetValue(canonMethod, out MetadataCategory category))
                    {
                        category = 0;
                    }
                    _reflectableMethods[canonMethod] = category | refMethod.Category;
                }
            }

            foreach (var refField in reflectableFields)
            {
                // Asking for description or runtime mapping for a member without asking
                // for the owning type would mean we can't actually satisfy the request.
                Debug.Assert((refField.Category & MetadataCategory.Description) == 0 ||
                             (_reflectableTypes[refField.Entity.OwningType] & MetadataCategory.Description) != 0);
                Debug.Assert((refField.Category & MetadataCategory.RuntimeMapping) == 0 ||
                             (_reflectableTypes[refField.Entity.OwningType] & MetadataCategory.RuntimeMapping) != 0);
                _reflectableFields.Add(refField.Entity, refField.Category);
            }

#if DEBUG
            HashSet <ModuleDesc> moduleHash = new HashSet <ModuleDesc>(_modulesWithMetadata);
            foreach (var refType in reflectableTypes)
            {
                // The instantiated types need to agree on the Description bit with the definition.
                // GetMetadataCategory relies on that.
                Debug.Assert((GetMetadataCategory(refType.Entity.GetTypeDefinition()) & MetadataCategory.Description)
                             == (GetMetadataCategory(refType.Entity) & MetadataCategory.Description));

                Debug.Assert(!(refType.Entity is MetadataType) || moduleHash.Contains(((MetadataType)refType.Entity).Module));
            }

            foreach (var refMethod in reflectableMethods)
            {
                // The instantiated methods need to agree on the Description bit with the definition.
                // GetMetadataCategory relies on that.
                Debug.Assert((GetMetadataCategory(refMethod.Entity.GetTypicalMethodDefinition()) & MetadataCategory.Description)
                             == (GetMetadataCategory(refMethod.Entity) & MetadataCategory.Description));
            }

            foreach (var refField in reflectableFields)
            {
                // The instantiated fields need to agree on the Description bit with the definition.
                // GetMetadataCategory relies on that.
                Debug.Assert((GetMetadataCategory(refField.Entity.GetTypicalFieldDefinition()) & MetadataCategory.Description)
                             == (GetMetadataCategory(refField.Entity) & MetadataCategory.Description));
            }
#endif
        }
예제 #12
0
        public AnalysisBasedMetadataManager(
            CompilerTypeSystemContext typeSystemContext,
            MetadataBlockingPolicy blockingPolicy,
            ManifestResourceBlockingPolicy resourceBlockingPolicy,
            string logFile,
            StackTraceEmissionPolicy stackTracePolicy,
            DynamicInvokeThunkGenerationPolicy invokeThunkGenerationPolicy,
            IEnumerable <ModuleDesc> modulesWithMetadata,
            IEnumerable <ReflectableEntity <TypeDesc> > reflectableTypes,
            IEnumerable <ReflectableEntity <MethodDesc> > reflectableMethods,
            IEnumerable <ReflectableEntity <FieldDesc> > reflectableFields,
            IEnumerable <TypeDesc> ldtokenReferenceableTypes)
            : base(typeSystemContext, blockingPolicy, resourceBlockingPolicy, logFile, stackTracePolicy, invokeThunkGenerationPolicy)
        {
            _modulesWithMetadata = new List <ModuleDesc>(modulesWithMetadata);

            foreach (var refType in reflectableTypes)
            {
                _reflectableTypes.Add(refType.Entity, refType.Category);
            }

            foreach (var refMethod in reflectableMethods)
            {
                // Asking for description or runtime mapping for a member without asking
                // for the owning type would mean we can't actually satisfy the request.
                Debug.Assert((refMethod.Category & MetadataCategory.Description) == 0 ||
                             (_reflectableTypes[refMethod.Entity.OwningType] & MetadataCategory.Description) != 0);
                Debug.Assert((refMethod.Category & MetadataCategory.RuntimeMapping) == 0 ||
                             (_reflectableTypes[refMethod.Entity.OwningType] & MetadataCategory.RuntimeMapping) != 0);
                _reflectableMethods.Add(refMethod.Entity, refMethod.Category);
            }

            foreach (var refField in reflectableFields)
            {
                // Asking for description or runtime mapping for a member without asking
                // for the owning type would mean we can't actually satisfy the request.
                Debug.Assert((refField.Category & MetadataCategory.Description) == 0 ||
                             (_reflectableTypes[refField.Entity.OwningType] & MetadataCategory.Description) != 0);
                Debug.Assert((refField.Category & MetadataCategory.RuntimeMapping) == 0 ||
                             (_reflectableTypes[refField.Entity.OwningType] & MetadataCategory.RuntimeMapping) != 0);
                _reflectableFields.Add(refField.Entity, refField.Category);
            }

            _ldtokenReferenceableTypes = new HashSet <TypeDesc>(ldtokenReferenceableTypes);

#if DEBUG
            HashSet <ModuleDesc> moduleHash = new HashSet <ModuleDesc>(_modulesWithMetadata);
            foreach (var refType in reflectableTypes)
            {
                // The instantiated types need to agree on the Description bit with the definition.
                // GetMetadataCategory relies on that.
                Debug.Assert((GetMetadataCategory(refType.Entity.GetTypeDefinition()) & MetadataCategory.Description)
                             == (GetMetadataCategory(refType.Entity) & MetadataCategory.Description));

                Debug.Assert(!(refType.Entity is MetadataType) || moduleHash.Contains(((MetadataType)refType.Entity).Module));
            }

            foreach (var refMethod in reflectableMethods)
            {
                // The instantiated methods need to agree on the Description bit with the definition.
                // GetMetadataCategory relies on that.
                Debug.Assert((GetMetadataCategory(refMethod.Entity.GetTypicalMethodDefinition()) & MetadataCategory.Description)
                             == (GetMetadataCategory(refMethod.Entity) & MetadataCategory.Description));

                // Canonical form of the method needs to agree with the logical form
                Debug.Assert(GetMetadataCategory(refMethod.Entity) == GetMetadataCategory(refMethod.Entity.GetCanonMethodTarget(CanonicalFormKind.Specific)));
            }

            foreach (var refField in reflectableFields)
            {
                // The instantiated fields need to agree on the Description bit with the definition.
                // GetMetadataCategory relies on that.
                Debug.Assert((GetMetadataCategory(refField.Entity.GetTypicalFieldDefinition()) & MetadataCategory.Description)
                             == (GetMetadataCategory(refField.Entity) & MetadataCategory.Description));
            }
#endif
        }
예제 #13
0
 public EmptyMetadataManager(CompilerTypeSystemContext typeSystemContext, StackTraceEmissionPolicy stackTraceEmissionPolicy)
     : base(typeSystemContext, new FullyBlockedMetadataPolicy(), new FullyBlockedManifestResourcePolicy(), new NoDynamicInvokeThunkGenerationPolicy())
 {
     _stackTraceEmissionPolicy = stackTraceEmissionPolicy;
 }