public static TestAssemblyLinker Compile(ITypeSystem typeSystem)
        {
            IArchitecture architecture = x86.Architecture.CreateArchitecture(x86.ArchitectureFeatureFlags.AutoDetect);

            // FIXME: get from architecture
            TypeLayout typeLayout = new TypeLayout(typeSystem, 4, 4);

            TestCaseAssemblyCompiler compiler = new TestCaseAssemblyCompiler(architecture, typeSystem, typeLayout);
            compiler.Compile();

            return compiler.linker;
        }
        public static void Compile(ITypeSystem typeSystem)
        {
            IArchitecture architecture = x86.Architecture.CreateArchitecture(x86.ArchitectureFeatureFlags.AutoDetect);

            // FIXME: get from architecture
            TypeLayout typeLayout = new TypeLayout(typeSystem, 4, 4);

            CompilerHelper compiler = new CompilerHelper(architecture, typeSystem, typeLayout);
            compiler.Compile();

            //return compiler.linker;
        }
Beispiel #3
0
        private void Compile()
        {
            IAssemblyLoader assemblyLoader = new AssemblyLoader();
            assemblyLoader.InitializePrivatePaths(this.GetInputFileNames());

            foreach (string file in this.GetInputFileNames())
            {
                assemblyLoader.LoadModule(file);
            }

            ITypeSystem typeSystem = new TypeSystem();
            typeSystem.LoadModules(assemblyLoader.Modules);

            int nativePointerSize;
            int nativePointerAlignment;

            this.architectureSelector.Architecture.GetTypeRequirements(BuiltInSigType.IntPtr, out nativePointerSize, out nativePointerAlignment);

            TypeLayout typeLayout = new TypeLayout(typeSystem, nativePointerSize, nativePointerAlignment);

            // Create the compiler
            using (AotCompiler aot = new AotCompiler(this.architectureSelector.Architecture, typeSystem, typeLayout))
            {
                aot.Pipeline.AddRange(new IAssemblyCompilerStage[]
                    {
                        this.bootFormatStage,
                        new InterruptBuilderStage(),
                        new AssemblyCompilationStage(),
                        //new FakeSystemObjectGenerationStage(),
                        new MethodCompilerSchedulerStage(),
                        new TypeInitializers.TypeInitializerSchedulerStage(),
                        this.bootFormatStage,
                        new CilHeaderBuilderStage(),
                        new ObjectFileLayoutStage(),
                        this.linkerStage,
                        this.mapFileWrapper
                    });

                aot.Run();
            }
        }