public MethodHasher( AnalysisDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, SymbolicValue, ILogOptions, IMethodResult <SymbolicValue> > driver, IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, SymbolicValue, ILogOptions> mDriver, bool trace, Func <Subroutine, int> subroutineIdentifier = null, Func <Type, int> typeIdentifier = null ) { this.driver = driver; this.mDriver = mDriver; this.tw = new HashWriter(trace); this.ilHasher = new ILHasher(this.mDriver.StackLayer, this.tw, this.ReferenceType, this.InlinedSubroutine); if (subroutineIdentifier != null) { this.subroutineIdentifier = subroutineIdentifier; } else { // unique ID for a subroutine (used to put warnings into contexts) var subroutineLocalIds = new BijectiveMap <Subroutine, int>(); this.subroutineIdentifier = sub => { int res; if (!subroutineLocalIds.TryGetValue(sub, out res)) { subroutineLocalIds.Add(sub, res = subroutineLocalIds.Count); } return(res); }; } if (typeIdentifier != null) { this.typeIdentifier = typeIdentifier; } else { // unique ID for types (used for general serialization of boxed expressions) var referencedTypesLocalIds = new BijectiveMap <Type, int>(); this.typeIdentifier = typ => { int res; if (!referencedTypesLocalIds.TryGetValue(typ, out res)) { referencedTypesLocalIds.Add(typ, res = referencedTypesLocalIds.Count); } return(res); }; } }
public CDriver(AnalysisDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, LogOptions, MethodResult> parent, IDecodeMetaData <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly> mdDecoder, Type type) { Contract.Requires(mdDecoder != null); this.ParentDriver = parent; this.MetaDataDecoder = mdDecoder; mInvariants = new List <BoxedExpression>(); this.ClassType = type; var nonStaticMethods = mdDecoder.Methods(type).Where(m => !mdDecoder.IsStatic(m)); mMethodsCount = nonStaticMethods.Count(); this.Constructors = nonStaticMethods.Where(mdDecoder.IsConstructor).ToList(); var constructorsCount = this.Constructors.Count(); mAnalyzedMethodsCount = 0; #if false mConstructorsInfo = new Dictionary <Method, MethodInfo>(capacity: constructorsCount); #endif this.ConstructorsStatus = new ConstructorsAnalysisStatus(type, constructorsCount); mMass = new Dictionary <Method, AnalysisDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, LogOptions, MethodResult> .MethodAnalysisStatus>(); }
public MDriver( Method method, OldAnalysisDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, LogOptions, MethodResult> parent, IClassDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, ExternalExpression <APC, SymbolicValue>, SymbolicValue, LogOptions, MethodResult> classDriver, bool removeInferredPrecondition ) : base(method, parent) { specializedParent = parent; // Here we build our stack of adapters. // // Expr (expressions) // Heap (symbolic values) // StackDepth (Temp decoder for APC) // CFG (Unit decoder for APC, including Assume) // cciilprovider (Unit decoder for PC) // // The base class already built the first 3 // The last two are built on demand this.classDriver = classDriver; RemoveInferredPreconditions = removeInferredPrecondition; }