Esempio n. 1
0
 internal ILScanner(
     DependencyAnalyzerBase <NodeFactory> dependencyGraph,
     ILScanNodeFactory nodeFactory,
     IEnumerable <ICompilationRootProvider> roots,
     Logger logger)
     : base(dependencyGraph, nodeFactory, roots, logger)
 {
 }
Esempio n. 2
0
        public IILScanner ToILScanner()
        {
            var interopStubManager = new CompilerGeneratedInteropStubManager(_compilationGroup, _context, new InteropStateManager(_context.GeneratedAssembly));
            var nodeFactory        = new ILScanNodeFactory(_context, _compilationGroup, _metadataManager, interopStubManager, _nameMangler);
            DependencyAnalyzerBase <NodeFactory> graph = _dependencyTrackingLevel.CreateDependencyGraph(nodeFactory);

            return(new ILScanner(graph, nodeFactory, _compilationRoots, _ilProvider, new NullDebugInformationProvider(), _logger));
        }
Esempio n. 3
0
 internal ILScanner(
     DependencyAnalyzerBase <NodeFactory> dependencyGraph,
     ILScanNodeFactory nodeFactory,
     IEnumerable <ICompilationRootProvider> roots,
     ILProvider ilProvider,
     DebugInformationProvider debugInformationProvider,
     Logger logger)
     : base(dependencyGraph, nodeFactory, roots, ilProvider, debugInformationProvider, null, logger)
 {
 }
Esempio n. 4
0
        public IILScanner ToILScanner()
        {
            // TODO: we will want different metadata managers depending on whether we're doing reflection analysis
            var metadataManager    = new CompilerGeneratedMetadataManager(_compilationGroup, _context, null);
            var interopStubManager = new CompilerGeneratedInteropStubManager(_compilationGroup, _context, new InteropStateManager(_compilationGroup.GeneratedAssembly));
            var nodeFactory        = new ILScanNodeFactory(_context, _compilationGroup, metadataManager, interopStubManager, _nameMangler);
            DependencyAnalyzerBase <NodeFactory> graph = _dependencyTrackingLevel.CreateDependencyGraph(nodeFactory);

            return(new ILScanner(graph, nodeFactory, _compilationRoots, new NullDebugInformationProvider(), _logger));
        }
Esempio n. 5
0
 internal ILScanner(
     DependencyAnalyzerBase <NodeFactory> dependencyGraph,
     ILScanNodeFactory nodeFactory,
     IEnumerable <ICompilationRootProvider> roots,
     ILProvider ilProvider,
     DebugInformationProvider debugInformationProvider,
     PInvokeILEmitterConfiguration pinvokePolicy,
     Logger logger)
     : base(dependencyGraph, nodeFactory, roots, ilProvider, debugInformationProvider, null, pinvokePolicy, logger)
 {
 }
Esempio n. 6
0
 internal ILScanner(
     DependencyAnalyzerBase <NodeFactory> dependencyGraph,
     ILScanNodeFactory nodeFactory,
     IEnumerable <ICompilationRootProvider> roots,
     ILProvider ilProvider,
     DebugInformationProvider debugInformationProvider,
     Logger logger,
     int parallelism)
     : base(dependencyGraph, nodeFactory, roots, ilProvider, debugInformationProvider, null, nodeFactory.CompilationModuleGroup, logger)
 {
     _helperCache = new HelperCache(this);
     _parallelism = parallelism;
 }
Esempio n. 7
0
 internal ILScanner(
     DependencyAnalyzerBase <NodeFactory> dependencyGraph,
     ILScanNodeFactory nodeFactory,
     IEnumerable <ICompilationRootProvider> roots,
     ILProvider ilProvider,
     DebugInformationProvider debugInformationProvider,
     Logger logger,
     bool singleThreaded)
     : base(dependencyGraph, nodeFactory, roots, ilProvider, debugInformationProvider, null, logger)
 {
     _helperCache    = new HelperCache(this);
     _singleThreaded = singleThreaded;
 }
Esempio n. 8
0
        public ILImporter(ILScanner compilation, MethodDesc method, MethodIL methodIL = null)
        {
            if (methodIL == null)
            {
                methodIL = compilation.GetMethodIL(method);
            }
            else
            {
                _isFallbackBodyCompilation = true;
            }

            // This is e.g. an "extern" method in C# without a DllImport or InternalCall.
            if (methodIL == null)
            {
                ThrowHelper.ThrowInvalidProgramException(ExceptionStringID.InvalidProgramSpecific, method);
            }

            _compilation = compilation;
            _factory     = (ILScanNodeFactory)compilation.NodeFactory;

            _ilBytes = methodIL.GetILBytes();

            _canonMethodIL = methodIL;

            // Get the runtime determined method IL so that this works right in shared code
            // and tokens in shared code resolve to runtime determined types.
            MethodIL uninstantiatiedMethodIL = methodIL.GetMethodILDefinition();

            if (methodIL != uninstantiatiedMethodIL)
            {
                MethodDesc sharedMethod = method.GetSharedRuntimeFormMethodTarget();
                _methodIL = new InstantiatedMethodIL(sharedMethod, uninstantiatiedMethodIL);
            }
            else
            {
                _methodIL = methodIL;
            }

            _canonMethod = method;

            var ilExceptionRegions = methodIL.GetExceptionRegions();

            _exceptionRegions = new ExceptionRegion[ilExceptionRegions.Length];
            for (int i = 0; i < ilExceptionRegions.Length; i++)
            {
                _exceptionRegions[i] = new ExceptionRegion()
                {
                    ILRegion = ilExceptionRegions[i]
                };
            }
        }