Пример #1
0
 public static FuncBuilderHints EmitFunction(Namespace ns, FuncBuilderHints fbHints, ActionOnFuncBuilder action, out bool runAgain)
 {
     try {
         //HACK
         var emitter = CodeGenerator.Emitter;
         emitter.RegistersWritten = 0;
         var fb           = new FuncBuilder(ns, fbHints, action);
         var rw           = emitter.RegistersWritten;
         var scratch0Used = (rw & (1 << fb.Scratch0.Index)) != 0;
         var scratch1Used = (rw & (1 << fb.Scratch1.Index)) != 0;
         return(fb.RunOptimizer(scratch0Used, scratch1Used, out runAgain));
     } finally {
         Instance = null;
     }
 }
Пример #2
0
        private Hashtable EmitStaticFunctions(out bool runAgain)
        {
            runAgain = false;
            var hintsForNextTime = new Hashtable(); //Hashtable<string,FuncBuilderHints>

            for (var i = 0; i < funcDefinitions.Count; ++i)
            {
                emitter.AlignToWord();
                var definition  = (FuncDefinition)funcDefinitions[i];
                var declaration = definition.Declaration;
                var name        = declaration.Name;
                var fbHints     = (FuncBuilderHints)GeneratorHints.FuncNameToFuncBuilderHints[name] ?? new FuncBuilderHints();

                var ns = new Namespace(this.TopNamespace, i, name);
                declaration.EntryPoint.Mark();
                bool fbRunAgain;
                var  newFbHints = FuncBuilder.EmitFunction(ns, fbHints, definition.Body, out fbRunAgain);
                hintsForNextTime.Add(name, newFbHints);
                runAgain |= fbRunAgain;
            }
            return(hintsForNextTime);
        }
Пример #3
0
 public static FuncBuilderHints EmitFunction(Namespace ns, FuncBuilderHints fbHints, ActionOnFuncBuilder action, out bool runAgain)
 {
     try {
     //HACK
     var emitter=CodeGenerator.Emitter;
     emitter.RegistersWritten=0;
     var fb=new FuncBuilder(ns, fbHints, action);
     var rw=emitter.RegistersWritten;
     var scratch0Used=(rw&(1<<fb.Scratch0.Index))!=0;
     var scratch1Used=(rw&(1<<fb.Scratch1.Index))!=0;
     return fb.RunOptimizer(scratch0Used, scratch1Used, out runAgain);
       } finally {
     Instance=null;
       }
 }