コード例 #1
0
ファイル: CivlRefinement.cs プロジェクト: snidoom/boogie
        public static void AddCheckers(LinearTypeChecker linearTypeChecker, CivlTypeChecker civlTypeChecker, List<Declaration> decls)
        {
            Program program = linearTypeChecker.program;
            foreach (int layerNum in civlTypeChecker.AllImplementedLayerNums)
            {
                if (CommandLineOptions.Clo.TrustLayersDownto <= layerNum || layerNum <= CommandLineOptions.Clo.TrustLayersUpto) continue;

                MyDuplicator duplicator = new MyDuplicator(civlTypeChecker, layerNum);
                foreach (var proc in program.Procedures)
                {
                    if (!civlTypeChecker.procToActionInfo.ContainsKey(proc)) continue;
                    Procedure duplicateProc = duplicator.VisitProcedure(proc);
                    decls.Add(duplicateProc);
                }
                decls.AddRange(duplicator.impls);
                CivlRefinement civlTransform = new CivlRefinement(linearTypeChecker, civlTypeChecker, duplicator);
                foreach (var impl in program.Implementations)
                {
                    if (!civlTypeChecker.procToActionInfo.ContainsKey(impl.Proc) || civlTypeChecker.procToActionInfo[impl.Proc].createdAtLayerNum < layerNum)
                        continue;
                    Implementation duplicateImpl = duplicator.VisitImplementation(impl);
                    civlTransform.TransformImpl(duplicateImpl);
                    decls.Add(duplicateImpl);
                }
                decls.AddRange(civlTransform.Collect());
            }
        }
コード例 #2
0
ファイル: OwickiGries.cs プロジェクト: hertzel001/boogie
        public static void AddCheckers(LinearTypeChecker linearTypeChecker, MoverTypeChecker moverTypeChecker, List<Declaration> decls)
        {
            Program program = linearTypeChecker.program;
            foreach (int layerNum in moverTypeChecker.AllCreatedLayerNums.Except(new int[] { moverTypeChecker.leastUnimplementedLayerNum }))
            {
                if (CommandLineOptions.Clo.TrustLayersDownto <= layerNum || layerNum <= CommandLineOptions.Clo.TrustLayersUpto) continue;

                MyDuplicator duplicator = new MyDuplicator(moverTypeChecker, layerNum);
                foreach (var proc in program.Procedures)
                {
                    if (!moverTypeChecker.procToActionInfo.ContainsKey(proc)) continue;
                    Procedure duplicateProc = duplicator.VisitProcedure(proc);
                    decls.Add(duplicateProc);
                }
                decls.AddRange(duplicator.impls);
                OwickiGries ogTransform = new OwickiGries(linearTypeChecker, moverTypeChecker, duplicator);
                foreach (var impl in program.Implementations)
                {
                    if (!moverTypeChecker.procToActionInfo.ContainsKey(impl.Proc) || moverTypeChecker.procToActionInfo[impl.Proc].createdAtLayerNum < layerNum)
                        continue;
                    Implementation duplicateImpl = duplicator.VisitImplementation(impl);
                    ogTransform.TransformImpl(duplicateImpl);
                    decls.Add(duplicateImpl);
                }
                decls.AddRange(ogTransform.Collect());
            }
        }
コード例 #3
0
ファイル: OwickiGries.cs プロジェクト: Chenguang-Zhu/ICE-C5
 public static void AddCheckers(LinearTypeChecker linearTypeChecker, MoverTypeChecker moverTypeChecker, List<Declaration> decls)
 {
     Program program = linearTypeChecker.program;
     foreach (int phaseNum in moverTypeChecker.assertionPhaseNums)
     {
         MyDuplicator duplicator = new MyDuplicator(moverTypeChecker, phaseNum);
         List<Implementation> impls = new List<Implementation>();
         List<Procedure> procs = new List<Procedure>();
         foreach (var decl in program.TopLevelDeclarations)
         {
             Procedure proc = decl as Procedure;
             if (proc == null || !QKeyValue.FindBoolAttribute(proc.Attributes, "yields")) continue;
             Procedure duplicateProc = duplicator.VisitProcedure(proc);
             procs.Add(duplicateProc);
             if (moverTypeChecker.procToActionInfo.ContainsKey(proc) && moverTypeChecker.procToActionInfo[proc].phaseNum < phaseNum)
             {
                 duplicateProc.Attributes = OwickiGries.RemoveYieldsAttribute(duplicateProc.Attributes);
                 program.GlobalVariables().Iter(x => duplicateProc.Modifies.Add(new IdentifierExpr(Token.NoToken, x)));
                 CodeExpr action = (CodeExpr)duplicator.VisitCodeExpr(moverTypeChecker.procToActionInfo[proc].thisAction);
                 Implementation impl = new Implementation(Token.NoToken, duplicateProc.Name, proc.TypeParameters, proc.InParams, proc.OutParams, new List<Variable>(), action.Blocks);
                 impl.Proc = duplicateProc;
                 impl.Proc.AddAttribute("inline", new LiteralExpr(Token.NoToken, Microsoft.Basetypes.BigNum.FromInt(1)));
                 impl.AddAttribute("inline", new LiteralExpr(Token.NoToken, Microsoft.Basetypes.BigNum.FromInt(1)));
                 impls.Add(impl);
             }
         }
         foreach (var decl in program.TopLevelDeclarations)
         {
             Implementation impl = decl as Implementation;
             if (impl == null ||
                 !QKeyValue.FindBoolAttribute(impl.Proc.Attributes, "yields") ||
                 (moverTypeChecker.procToActionInfo.ContainsKey(impl.Proc) && moverTypeChecker.procToActionInfo[impl.Proc].phaseNum < phaseNum))
                 continue;
             Implementation duplicateImpl = duplicator.VisitImplementation(impl);
             impls.Add(duplicateImpl);
         }
         Dictionary<Absy, Absy> reverseAbsyMap = new Dictionary<Absy, Absy>();
         foreach (Absy key in duplicator.absyMap.Keys)
         {
             reverseAbsyMap[duplicator.absyMap[key]] = key;
         }
         OwickiGries ogTransform = new OwickiGries(linearTypeChecker, reverseAbsyMap, phaseNum, decls);
         ogTransform.Transform(impls, procs);
     }
 }