Exemplo n.º 1
0
        static void Main(string[] args)
        {
            if (args[0] == "InstructionSetGenerator")
            {
                InstructionSetGenerator generator = new InstructionSetGenerator();
                if (!generator.ParseInput(new StreamReader(args[1])))
                {
                    return;
                }

                using (TextWriter tw = new StreamWriter(args[2]))
                {
                    Console.WriteLine("Generating {0}", args[2]);
                    generator.WriteManagedReadyToRunInstructionSet(tw);
                }

                using (TextWriter tw = new StreamWriter(args[3]))
                {
                    Console.WriteLine("Generating {0}", args[3]);
                    generator.WriteManagedReadyToRunInstructionSetHelper(tw);
                }

                using (TextWriter tw = new StreamWriter(args[4]))
                {
                    Console.WriteLine("Generating {0}", args[4]);
                    generator.WriteManagedJitInstructionSet(tw);
                }

                using (TextWriter tw = new StreamWriter(args[5]))
                {
                    Console.WriteLine("Generating {0}", args[5]);
                    generator.WriteNativeCorInfoInstructionSet(tw);
                }

                using (TextWriter tw = new StreamWriter(args[6]))
                {
                    Console.WriteLine("Generating {0}", args[6]);
                    generator.WriteNativeReadyToRunInstructionSet(tw);
                }
            }
            else
            {
                IEnumerable <FunctionDecl> functions = ParseInput(new StreamReader(args[0]));
                using (TextWriter tw = new StreamWriter(args[1]))
                {
                    Console.WriteLine("Generating {0}", args[1]);
                    WriteManagedThunkInterface(tw, functions);
                }
                using (TextWriter tw = new StreamWriter(args[2]))
                {
                    Console.WriteLine("Generating {0}", args[2]);
                    WriteNativeWrapperInterface(tw, functions);
                }
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("ThunkGenerator - Generate thunks for the jit interface and for defining the set of instruction sets supported by the runtime, JIT, and crossgen2. Call by using the gen scripts which are aware of the right set of files generated and command line args.");
                return;
            }
            if (args[0] == "InstructionSetGenerator")
            {
                if (args.Length != 7)
                {
                    Console.WriteLine("Incorrect number of files specified for generation");
                }
                InstructionSetGenerator generator = new InstructionSetGenerator();
                if (!generator.ParseInput(new StreamReader(args[1])))
                {
                    return;
                }

                using (TextWriter tw = new StreamWriter(args[2]))
                {
                    Console.WriteLine("Generating {0}", args[2]);
                    generator.WriteManagedReadyToRunInstructionSet(tw);
                }

                using (TextWriter tw = new StreamWriter(args[3]))
                {
                    Console.WriteLine("Generating {0}", args[3]);
                    generator.WriteManagedReadyToRunInstructionSetHelper(tw);
                }

                using (TextWriter tw = new StreamWriter(args[4]))
                {
                    Console.WriteLine("Generating {0}", args[4]);
                    generator.WriteManagedJitInstructionSet(tw);
                }

                using (TextWriter tw = new StreamWriter(args[5]))
                {
                    Console.WriteLine("Generating {0}", args[5]);
                    generator.WriteNativeCorInfoInstructionSet(tw);
                }

                using (TextWriter tw = new StreamWriter(args[6]))
                {
                    Console.WriteLine("Generating {0}", args[6]);
                    generator.WriteNativeReadyToRunInstructionSet(tw);
                }
            }
            else
            {
                if (args.Length != 8)
                {
                    Console.WriteLine("Incorrect number of files specified for generation");
                }

                IEnumerable <FunctionDecl> functions = ParseInput(new StreamReader(args[0]));

                EmitStuff(1, WriteManagedThunkInterface);
                EmitStuff(2, WriteNativeWrapperInterface);
                EmitStuff(3, WriteAPI_Names);
                EmitStuff(4, API_Wrapper);
                EmitStuff(5, SPMI_ICorJitInfoImpl);
                EmitStuff(6, SPMI_ShimCounter_ICorJitInfo);
                EmitStuff(7, SPMI_ShimSimple_ICorJitInfo);

                void EmitStuff(int index, Action <TextWriter, IEnumerable <FunctionDecl> > printer)
                {
                    using (TextWriter tw = new StreamWriter(args[index]))
                    {
                        Console.WriteLine("Generating {0}", args[index]);
                        printer(tw, functions);
                    }
                }
            }
        }