protected Compilation( DependencyAnalyzerBase<NodeFactory> dependencyGraph, NodeFactory nodeFactory, IEnumerable<ICompilationRootProvider> compilationRoots, NameMangler nameMangler, Logger logger) { _dependencyGraph = dependencyGraph; _nodeFactory = nodeFactory; _nameMangler = nameMangler; _logger = logger; _dependencyGraph.ComputeDependencyRoutine += ComputeDependencyNodeDependencies; NodeFactory.AttachToDependencyGraph(_dependencyGraph); // TODO: hacky static field NodeFactory.NameMangler = nameMangler; var rootingService = new RootingServiceProvider(dependencyGraph, nodeFactory); foreach (var rootProvider in compilationRoots) rootProvider.AddCompilationRoots(rootingService); // TODO: use a better owning type for multi-file friendliness _typeGetTypeMethodThunks = new TypeGetTypeMethodThunkCache(TypeSystemContext.SystemModule.GetGlobalModuleType()); }
protected Compilation( DependencyAnalyzerBase<NodeFactory> dependencyGraph, NodeFactory nodeFactory, IEnumerable<ICompilationRootProvider> compilationRoots, NameMangler nameMangler, Logger logger) { _dependencyGraph = dependencyGraph; _nodeFactory = nodeFactory; _nameMangler = nameMangler; _logger = logger; _dependencyGraph.ComputeDependencyRoutine += ComputeDependencyNodeDependencies; NodeFactory.AttachToDependencyGraph(_dependencyGraph); // TODO: hacky static field NodeFactory.NameMangler = nameMangler; var rootingService = new RootingServiceProvider(dependencyGraph, nodeFactory); foreach (var rootProvider in compilationRoots) rootProvider.AddCompilationRoots(rootingService); _typeGetTypeMethodThunks = new TypeGetTypeMethodThunkCache(nodeFactory.CompilationModuleGroup.GeneratedAssembly.GetGlobalModuleType()); PInvokeILProvider = new PInvokeILProvider(new PInvokeILEmitterConfiguration(!nodeFactory.CompilationModuleGroup.IsSingleFileCompilation)); _methodILCache = new ILProvider(PInvokeILProvider); }
public Compilation(CompilerTypeSystemContext typeSystemContext, CompilationOptions options) { _typeSystemContext = typeSystemContext; _options = options; _nameMangler = new NameMangler(this); }
public Compilation(CompilationOptions options, CompilerTypeSystemContext context, CompilationModuleGroup compilationGroup) { _options = options; _nameMangler = new NameMangler(options.IsCppCodeGen); _typeSystemContext = context; _compilationModuleGroup = compilationGroup; }
public Compilation(CompilationOptions options) { _options = options; _typeSystemContext = new CompilerTypeSystemContext(new TargetDetails(options.TargetArchitecture, options.TargetOS)); _typeSystemContext.InputFilePaths = options.InputFilePaths; _typeSystemContext.ReferenceFilePaths = options.ReferenceFilePaths; _typeSystemContext.SetSystemModule(_typeSystemContext.GetModuleForSimpleName(options.SystemModuleName)); _nameMangler = new NameMangler(this); }
protected Compilation( DependencyAnalyzerBase<NodeFactory> dependencyGraph, NodeFactory nodeFactory, IEnumerable<ICompilationRootProvider> compilationRoots, NameMangler nameMangler, Logger logger) { _dependencyGraph = dependencyGraph; _nodeFactory = nodeFactory; _nameMangler = nameMangler; _logger = logger; _dependencyGraph.ComputeDependencyRoutine += ComputeDependencyNodeDependencies; NodeFactory.AttachToDependencyGraph(_dependencyGraph); // TODO: hacky static field NodeFactory.NameMangler = nameMangler; var rootingService = new RootingServiceProvider(dependencyGraph, nodeFactory); foreach (var rootProvider in compilationRoots) rootProvider.AddCompilationRoots(rootingService); }
public Compilation(CompilationOptions options) { _options = options; _typeSystemContext = new CompilerTypeSystemContext(new TargetDetails(options.TargetArchitecture, options.TargetOS)); _typeSystemContext.InputFilePaths = options.InputFilePaths; _typeSystemContext.ReferenceFilePaths = options.ReferenceFilePaths; _typeSystemContext.SetSystemModule(_typeSystemContext.GetModuleForSimpleName(options.SystemModuleName)); _nameMangler = new NameMangler(this); _typeInitManager = new TypeInitialization(); if (options.MultiFile) { _compilationModuleGroup = new MultiFileCompilationModuleGroup(_typeSystemContext, this); } else { _compilationModuleGroup = new SingleFileCompilationModuleGroup(_typeSystemContext, this); } }
public sealed override string EEType(TypeDesc type) { return("__EEType_" + NameMangler.GetMangledTypeName(type)); }
public sealed override string ThreadStatics(TypeDesc type) { return(NameMangler.CompilationUnitPrefix + NameMangler.GetMangledTypeName(type) + "::" + ThreadStaticMemberName); }
public sealed override string NonGCStatics(TypeDesc type) { return(NameMangler.GetMangledTypeName(type) + "::" + NonGCStaticMemberName); }
public CompilationBuilder(CompilerTypeSystemContext context, CompilationModuleGroup compilationGroup, NameMangler nameMangler) { _context = context; _compilationGroup = compilationGroup; _nameMangler = nameMangler; _metadataManager = new EmptyMetadataManager(compilationGroup, context); }
public sealed override string TypeGenericDictionary(TypeDesc type) { return(GenericDictionaryNamePrefix + NameMangler.GetMangledTypeName(type)); }
public sealed override string NonGCStatics(TypeDesc type) { return(NameMangler.GetMangledTypeName(type) + "::__NONGCSTATICS"); }
public sealed override string ThreadStatics(TypeDesc type) { return(NameMangler.CompilationUnitPrefix + NameMangler.GetMangledTypeName(type) + "::__THREADSTATICS"); }
// Mangled name of boxed version of a type public sealed override string MangledBoxedTypeName(TypeDesc type) { Debug.Assert(type.IsValueType); return("Boxed_" + NameMangler.GetMangledTypeName(type)); }
public override string MethodGenericDictionary(MethodDesc method) { return(GenericDictionaryNamePrefix + NameMangler.GetMangledMethodName(method)); }
public CompilationBuilder(CompilerTypeSystemContext context, CompilationModuleGroup compilationGroup, NameMangler nameMangler) { _context = context; _compilationGroup = compilationGroup; _nameMangler = nameMangler; InitializePartial(); }
public BlobNode FieldRvaDataBlob(FieldDesc field) { // Use the typical field definition in case this is an instantiated generic type field = field.GetTypicalFieldDefinition(); return(ReadOnlyDataBlob(NameMangler.GetMangledFieldName(field), ((EcmaField)field).GetFieldRvaData(), Target.PointerSize)); }
public void Compile() { NodeFactory.NameMangler = NameMangler; string systemModuleName = ((IAssemblyDesc)_typeSystemContext.SystemModule).GetName().Name; // TODO: just something to get Runtime.Base compiled if (systemModuleName != "System.Private.CoreLib") { NodeFactory.CompilationUnitPrefix = systemModuleName.Replace(".", "_"); } else { NodeFactory.CompilationUnitPrefix = NameMangler.SanitizeName(Path.GetFileNameWithoutExtension(Options.OutputFilePath)); } if (_options.IsCppCodeGen) { _nodeFactory = new CppCodegenNodeFactory(_typeSystemContext, _compilationModuleGroup); } else { _nodeFactory = new RyuJitNodeFactory(_typeSystemContext, _compilationModuleGroup); } // Choose which dependency graph implementation to use based on the amount of logging requested. if (_options.DgmlLog == null) { // No log uses the NoLogStrategy _dependencyGraph = new DependencyAnalyzer <NoLogStrategy <NodeFactory>, NodeFactory>(_nodeFactory, null); } else { if (_options.FullLog) { // Full log uses the full log strategy _dependencyGraph = new DependencyAnalyzer <FullGraphLogStrategy <NodeFactory>, NodeFactory>(_nodeFactory, null); } else { // Otherwise, use the first mark strategy _dependencyGraph = new DependencyAnalyzer <FirstMarkLogStrategy <NodeFactory>, NodeFactory>(_nodeFactory, null); } } _nodeFactory.AttachToDependencyGraph(_dependencyGraph); if (_options.IsCppCodeGen) { _cppWriter = new CppCodeGen.CppWriter(this); _dependencyGraph.ComputeDependencyRoutine += CppCodeGenComputeDependencyNodeDependencies; var nodes = _dependencyGraph.MarkedNodeList; _cppWriter.OutputCode(nodes, _compilationModuleGroup.StartupCodeMain, _nodeFactory); } else { _corInfo = new CorInfoImpl(this, new JitConfigProvider(_options.CodegenOptions)); _dependencyGraph.ComputeDependencyRoutine += ComputeDependencyNodeDependencies; var nodes = _dependencyGraph.MarkedNodeList; ObjectWriter.EmitObject(_options.OutputFilePath, nodes, _nodeFactory); } if (_options.DgmlLog != null) { using (FileStream dgmlOutput = new FileStream(_options.DgmlLog, FileMode.Create)) { DgmlWriter.WriteDependencyGraphToStream(dgmlOutput, _dependencyGraph); dgmlOutput.Flush(); } } }
public sealed override string ThreadStatics(TypeDesc type) { return("__ThreadStaticBase_" + NameMangler.GetMangledTypeName(type)); }
internal ILScannerBuilder(CompilerTypeSystemContext context, CompilationModuleGroup compilationGroup, NameMangler mangler, ILProvider ilProvider) { _context = context; _compilationGroup = compilationGroup; _nameMangler = mangler; _metadataManager = new EmptyMetadataManager(context); _ilProvider = ilProvider; }