コード例 #1
0
        public override IEnumerable<BuildObject> getDependencies(out DependencyDisposition ddisp)
        {
            ddisp = DependencyDisposition.Complete;

            OrderPreservingSet<BuildObject> deps = new OrderPreservingSet<BuildObject>();

            // Things we need to stitch the interface:
            deps.Add(this.genericStitch);
            deps.Add(this.appSpecificStitch);
            deps.AddRange(this.mainBeatVerb.getOutputs());

            // Things we need to stitch the imports into the imp file:
            deps.Add(this.entryImpInput);
            deps.Add(this.context.getContextOutput());
            IIncludePathContext pathContext = this.context.fetchIfAvailable(ref ddisp);
            if (pathContext != null)
            {
                this.dafnyMainIfcInput = pathContext.search("dafny_Main_i", ModPart.Ifc);
                Util.Assert(this.dafnyMainIfcInput != null);
                deps.Add(this.dafnyMainIfcInput);
                this.dafnyMainImpInput = pathContext.search("dafny_Main_i", ModPart.Ifc);
                Util.Assert(this.dafnyMainImpInput != null);
                deps.Add(this.dafnyMainImpInput);
            }

            return deps;
        }
コード例 #2
0
        public IEnumerable<BuildObject> getIncludes(BuildObject beatsrc)
        {
            IHasher hasher = BuildEngine.theEngine.getHasher();
            OrderPreservingSet<BuildObject> includes = new OrderPreservingSet<BuildObject>();

            BuildObject ifcFile = hasher.search(this.includePathSearcher, beatsrc.getFileNameWithoutExtension(), ModPart.Ifc);
            BuildObject impFile = hasher.search(this.includePathSearcher, beatsrc.getFileNameWithoutExtension(), ModPart.Imp);

            Util.Assert(ifcFile.Equals(beatsrc) || impFile.Equals(beatsrc));
            includes.AddRange(this.directIncludes.getBasmIncludes(ifcFile));
            includes.AddRange(this.directIncludes.getBasmIncludes(impFile));
            return includes;
        }
コード例 #3
0
ファイル: DafnySpecVerb.cs プロジェクト: jango2015/Ironclad
        protected override IEnumerable<SourcePath> getRootArgs()
        {
            OrderPreservingSet<SourcePath> specFiles = new OrderPreservingSet<SourcePath>();
            specFiles.Add(this.getDafnyPrelude());
            specFiles.Add(this.getSeqSpec());
            DependencyDisposition ddisp;
            foreach (SourcePath src in this.getAllDafnyModules(out ddisp))
            {
                if (this.transformFilterAccepts(src))
                {
                    specFiles.Add(src);
                }
            }

            return specFiles;
        }
コード例 #4
0
 public TransitiveDepsContents(OrderPreservingSet<BuildObject> shallowDeps, OrderPreservingSet<BuildObject> transitiveDeps)
 {
     this._shallowDeps = shallowDeps;
     this._transitiveDeps = transitiveDeps;
 }
コード例 #5
0
        private IEnumerable<SourcePath> getTrustedBoogieAxioms()
        {
            OrderPreservingSet<SourcePath> result = new OrderPreservingSet<SourcePath>();
            AnnotationScanner anns = new AnnotationScanner(basmInput);
            foreach (string[] annotation in anns.getAnnotations(AddBoogieAxiomAnnotation))
            {
                string module = annotation[1];
                SourcePath trustedPath = new SourcePath(Path.Combine(
                    BuildEngine.theEngine.getSrcRoot(),
                    BuildEngine.VerveTrustedSpecDir,
                    module + BoogieVerb.BPL_EXTN));
                result.Add(trustedPath);
            }

            return result;
        }
コード例 #6
0
        protected IEnumerable<BoogieVerb> getBoogieVerbs(VerificationRequest verificationRequest)
        {
            if (verificationRequest.verifyMode == VerificationRequest.VerifyMode.NoVerify)
            {
                return new BoogieVerb[] { };
            }

            BoogieAsmDepBase.BasmModuleAccumulator acc = new BoogieAsmDepBase.BasmModuleAccumulator(context, upstreamObj, includeAllImps());
            List<BuildObject> basmModules = new List<BuildObject>(acc.basmModules.Where(mod => !mod.IsTrusted));

            OrderPreservingSet<BoogieVerb> normal_Boogie = new OrderPreservingSet<BoogieVerb>();
            OrderPreservingSet<BoogieVerb> SymDiff_Boogie = new OrderPreservingSet<BoogieVerb>();

            foreach (BuildObject basmModule in basmModules)
            {
                if (verificationRequest.verifyMode == VerificationRequest.VerifyMode.SelectiveVerify
                    && !verificationRequest.selectiveVerifyModuleNames.Contains(basmModule.getFileNameWithoutExtension()))
                {
                    continue;
                }

                normal_Boogie.Add(new BoogieVerb(context, basmModule, symdiff: VerificationRequest.SymDiffMode.NoSymDiff));

                if (verificationRequest.getSymDiffMode() == VerificationRequest.SymDiffMode.UseSymDiff
                        && BoogieAsmVerifyVerb.needs_symdiff(basmModule))
                {
                    SymDiff_Boogie.Add(new BoogieVerb(context, basmModule, symdiff: VerificationRequest.SymDiffMode.UseSymDiff));
                }
            }

            return SymDiff_Boogie.Union(normal_Boogie);
        }
コード例 #7
0
            public BasmModuleAccumulator(IContextGeneratingVerb contextGenVerb, BuildObject upstreamObj, bool linkMode)
            {
                this._contextGenVerb = contextGenVerb;
                this._mutableVerbSet = new HashSet<IVerb>();

                // NB preserve module definition-dependency order.
                this._basmModules = new OrderPreservingSet<BuildObject>();
                this._auxiliaryDeps = new HashSet<BuildObject>();
                _ddisp = DependencyDisposition.Complete;

                ////try
                ////{
                _mutableVerbSet.Add(contextGenVerb);
                _auxiliaryDeps.UnionWith(contextGenVerb.getOutputs());

                context = contextGenVerb.fetchIfAvailable(ref _ddisp);

                if (context != null)
                {
                    OrderPreservingSet<BuildObject> deps;
                    if (!linkMode)
                    {
                        deps = BeatExtensions.getBeatFlavoredShallowDependencies(
                            contextGenVerb, upstreamObj, out _ddisp, BeatIncludes.ImportFilter.ForBasmOnly);
                    }
                    else
                    {
                        deps = BeatExtensions.getBasmFlavoredTransitiveDependencies(contextGenVerb, upstreamObj, out _ddisp);
                        _mutableVerbSet.Add(BeatExtensions.getBasmFlavoredTransitiveDepVerb(_contextGenVerb, upstreamObj));
                    }

                    // REVIEW: The following two variables are unused.  Remove?
                    string targetModName = upstreamObj.getFileNameWithoutExtension();
                    ModPart targetModPart = BeatExtensions.whichPart(upstreamObj);

                    // NB security policy note: When verifying X.imp, we must be sure to supply X.ifc
                    // to BoogieAsm, so that we know that we're actually verifying the promises
                    // that other modules are relying on when they say "X" (which is how X got on
                    // the verification obligation list). That property happens automatically here,
                    // because we make a list of modules (ignoring ifc/imp part), such as {A,B,X},
                    // and include *every* .ifc. If we're verifying X.imp, a conditional test
                    // includes it at the time we consider module X.

                    foreach (BuildObject dep in deps)
                    {
                        string depExtn = dep.getExtension();
                        if (depExtn == null
                            || depExtn.EndsWith(TransitiveDepsVerb.TDEP_EXTN)
                            || depExtn.EndsWith(ContextGeneratingVerb.CONTEXT_EXTN))
                        {
                            _auxiliaryDeps.Add(dep);
                        }
                        else
                        {
                            Util.Assert(depExtn.Equals(BeatExtensions.BEATIFC_EXTN)
                                || depExtn.Equals(BeatExtensions.BEATIMP_EXTN)
                                || depExtn.Equals(BASMIFC_EXTN)
                                || depExtn.Equals(BASMIMP_EXTN));   // Burned too many times by this silly filter-out strategy.
                            string modName = dep.getFileNameWithoutExtension();
                            ModPart modPart = BeatExtensions.whichPart(dep);
                            getBasmModule(modName, ModPart.Ifc);
                            if ((dep.Equals(upstreamObj) && modPart == ModPart.Imp) || linkMode)
                            {
                                getBasmModule(modName, ModPart.Imp);
                            }
                        }
                    }
                }

                ////}
                ////catch (ObjNotReadyException)
                ////{
                ////    // oh, we don't even have the context object yet.
                ////    _ddisp = DependencyDisposition.Incomplete;
                ////}
                ////catch (ObjFailedException)
                ////{
                ////    _ddisp = DependencyDisposition.Failed;
                ////}
            }
コード例 #8
0
        public override IVerbWorker getWorker(WorkingDirectory workingDirectory)
        {
            OrderPreservingSet<BuildObject> shallowDeps = new OrderPreservingSet<BuildObject>();
            OrderPreservingSet<BuildObject> transitiveDeps = new OrderPreservingSet<BuildObject>();

            IEnumerable<BuildObject> includes = this.getIncludeFactory().getIncludes(this.obj);
            foreach (BuildObject child in includes)
            {
                shallowDeps.Add(child);
                transitiveDeps.AddRange(this.factory(child).getTransitiveIncludes());
                transitiveDeps.Add(child);
            }

            VirtualContents contents = new TransitiveDepsContents(shallowDeps, transitiveDeps);
            BuildEngine.theEngine.Repository.StoreVirtual(this.depsObj(), new Fresh(), contents);
            return new VerbSyncWorker(workingDirectory, new Fresh());
        }
コード例 #9
0
ファイル: BeatExtensions.cs プロジェクト: jango2015/Ironclad
        private static IEnumerable<BeatIncludes.LabeledInclude> getBeatFlavoredShallowIncludesLabeled(
            IContextGeneratingVerb contextVerb, BuildObject rootObj)
        {
            ContextContents context = (ContextContents)
                BuildEngine.theEngine.Repository.FetchVirtual(contextVerb.getContextOutput());
            BeatIncludes includes = new BeatIncludes(context.Context);
            OrderPreservingSet<BeatIncludes.LabeledInclude> result = new OrderPreservingSet<BeatIncludes.LabeledInclude>(
                includes.getLabeledIncludes(rootObj));

            if (BeatExtensions.whichPart(rootObj) == ModPart.Imp)
            {
                BuildObject rootIfc = context.Context.search(rootObj.getFileNameWithoutExtension(), ModPart.Ifc);
                result.Add(new BeatIncludes.LabeledInclude(BeatIncludes.ImportFilter.ForBeatOrBasm, rootIfc));
            }

            return result;
        }
コード例 #10
0
ファイル: BeatExtensions.cs プロジェクト: jango2015/Ironclad
        // The list belongs to the caller to .Add() to as desired.
        public static OrderPreservingSet<BuildObject> getBasmFlavoredTransitiveDependencies(IContextGeneratingVerb context, BuildObject rootObj, out DependencyDisposition ddisp)
        {
            OrderPreservingSet<BuildObject> result = new OrderPreservingSet<BuildObject>();
            TransitiveDepsVerb depsVerb = getBasmFlavoredTransitiveDepVerb(context, rootObj);
            result.Add(depsVerb.depsObj());
            result.AddRange(depsVerb.getAvailableDeps(out ddisp));

            // NB add root object at end of list, to keep it in definition-dependency order.
            result.Add(rootObj);
            return result;
        }
コード例 #11
0
ファイル: BeatExtensions.cs プロジェクト: jango2015/Ironclad
        // This used to use a BeatTransitiveDepsVerb, but we're going with shallow dependencies at the moment.
        // We may want to restore that behavior later, if we can get some sane transitive dep tree worked out for
        // Verve code.
        // The returned list belongs to the caller to .Add() to as desired.
        // TODO this really needs to be factored to supply the actual Beat-flavored references separately
        // from the auxiliary deps (transitive dep objects and context dep objects), so we don't have
        // client code trying to filter back out the part it wants. Brittle.
        public static OrderPreservingSet<BuildObject> getBeatFlavoredShallowDependencies(
            IContextGeneratingVerb contextVerb, BuildObject rootObj, out DependencyDisposition ddisp, BeatIncludes.ImportFilter filter)
        {
            OrderPreservingSet<BuildObject> result = new OrderPreservingSet<BuildObject>();
            result.Add(contextVerb.getContextOutput());
            try
            {
                result.AddRange(getBeatFlavoredShallowIncludes(contextVerb, rootObj, filter));
                ddisp = DependencyDisposition.Complete;
            }
            catch (ObjectNotReadyException)
            {
                ddisp = DependencyDisposition.Incomplete;
            }
            catch (ObjectFailedException)
            {
                ddisp = DependencyDisposition.Failed;
            }

            result.Add(rootObj);    // root really needs to go at the end of the list.
            return result;
        }