// From measurements it seems we spend very little time in this method public bool LessEqual(ArrayState a) { Contract.Requires(this.PluginsCount == a.PluginsCount); bool result; if (AbstractDomainsHelper.TryTrivialLessEqual(this, a, out result)) { return(result); } if (!this.Array.LessEqual(a.Array)) { return(false); } if (!this.Numerical.LessEqual(a.Numerical)) { return(false); } for (var i = 0; i < this.PluginsCount; i++) { if (!this.PluginAbstractStateAt(i).LessEqual(a.PluginAbstractStateAt(i))) { return(false); } } return(true); }
public ArrayState Meet(ArrayState a) { Contract.Requires(this.PluginsCount == a.PluginsCount); Contract.Ensures(Contract.Result <ArrayState>() != null); Contract.Ensures(Contract.Result <ArrayState>().PluginsCount == this.PluginsCount); ArrayState result; if (AbstractDomainsHelper.TryTrivialMeet(this, a, out result)) { return(result); } #if DEBUG // F: for debugging result = null; #endif var array = this.Array.Meet(a.Array); var numerical = this.Numerical.Meet(a.Numerical) as INumericalAbstractDomain <BoxedVariable <Variable>, BoxedExpression>; var plugins = new IAbstractDomainForEnvironments <BoxedVariable <Variable>, BoxedExpression> [this.PluginsCount]; for (var i = 0; i < this.PluginsCount; i++) { plugins[i] = this.PluginAbstractStateAt(i).Meet(a.PluginAbstractStateAt(i)) as IAbstractDomainForEnvironments <BoxedVariable <Variable>, BoxedExpression>; } return(new ArrayState(array, numerical, plugins, this.mappings)); }
protected ArraySegmentationEnvironment <AbstractDomain, BoxedVariable <Variable>, BoxedExpression> Select(ArrayState state) { Contract.Ensures(state != null); Contract.Ensures(Contract.Result <ArraySegmentationEnvironment <AbstractDomain, BoxedVariable <Variable>, BoxedExpression> >() != null); return(state.PluginAbstractStateAt(this.Id) as ArraySegmentationEnvironment <AbstractDomain, BoxedVariable <Variable>, BoxedExpression>); }
public EnumDefined <BoxedVariable <Variable>, Type, BoxedExpression> Select(ArrayState state) { Contract.Requires(state != null); Contract.Requires(this.Id < state.PluginsCount); Contract.Ensures(Contract.Result <EnumDefined <BoxedVariable <Variable>, Type, BoxedExpression> >() != null); var untyped = state.PluginAbstractStateAt(this.Id); var selected = untyped as EnumDefined <BoxedVariable <Variable>, Type, BoxedExpression>; Contract.Assume(selected != null); return(selected); }
public ArrayTracking Select(ArrayState state) { Contract.Requires(state != null); Contract.Requires(this.Id < state.PluginsCount); Contract.Ensures(Contract.Result <ArrayTracking>() != null); var untyped = state.PluginAbstractStateAt(this.Id); var selected = untyped as ArrayTracking; Contract.Assume(selected != null); return(selected); }
private ADictionary Select(ArrayState state) { Contract.Requires(state != null); Contract.Ensures(Contract.Result <ADictionary>() != null); Contract.Assume(-1 <= this.Id, "assuming the global invariant"); Contract.Assume(this.Id < state.PluginsCount, "assuming the global invariant"); var result = state.PluginAbstractStateAt(this.Id) as ADictionary; Contract.Assume(result != null, "Wrong type!!!"); return(result); }
Select(ArrayState state) { Contract.Requires(state != null); Contract.Ensures(Contract.Result <ArraySegmentationEnvironment <TwoValuesLattice <BoxedVariable <Variable> >, BoxedVariable <Variable>, BoxedExpression> >() != null); Contract.Assume(this.Id < state.PluginsCount, "Assuming the global invariant"); var untyped = state.PluginAbstractStateAt(this.Id); var selected = untyped as ArraySegmentationEnvironment <TwoValuesLattice <BoxedVariable <Variable> >, BoxedVariable <Variable>, BoxedExpression>; Contract.Assume(selected != null); return(selected); }
Select(ArrayState state) { Contract.Requires(state != null); Contract.Requires(this.Id < state.PluginsCount); Contract.Ensures( Contract.Result < ArraySegmentationEnvironment < FlatAbstractDomainOfBoolsWithRenaming <BoxedVariable <Variable> >, BoxedVariable <Variable>, BoxedExpression> >() != null); var subState = state.PluginAbstractStateAt(this.Id) as ArraySegmentationEnvironment <FlatAbstractDomainOfBoolsWithRenaming <BoxedVariable <Variable> >, BoxedVariable <Variable>, BoxedExpression>; Contract.Assume(subState != null); return(subState); }
public ArrayState Widening(ArrayState a) { Contract.Requires(this.PluginsCount == a.PluginsCount); Contract.Ensures(Contract.Result <ArrayState>() != null); Contract.Ensures(Contract.Result <ArrayState>().PluginsCount == this.PluginsCount); ArrayState result; if (AbstractDomainsHelper.TryTrivialJoin(this, a, out result)) { return(result); } #if DEBUG // F: for debugging result = null; #endif ArraySegmentationEnvironment <NonRelationalValueAbstraction <BoxedVariable <Variable>, BoxedExpression>, BoxedVariable <Variable>, BoxedExpression> array = null; INumericalAbstractDomain <BoxedVariable <Variable>, BoxedExpression> numerical = null; #if PARALLELWIDENING var arrayTask = Task.Run(() => array = this.Array.Widening(a.Array)); var numericalTask = Task.Run(() => numerical = this.Numerical.Widening(a.Numerical) as INumericalAbstractDomain <BoxedVariable <Variable>, BoxedExpression>); #else array = this.Array.Widening(a.Array); numerical = this.Numerical.Widening(a.Numerical) as INumericalAbstractDomain <BoxedVariable <Variable>, BoxedExpression>; #endif var plugins = new IAbstractDomainForEnvironments <BoxedVariable <Variable>, BoxedExpression> [this.PluginsCount]; for (var i = 0; i < this.PluginsCount; i++) { plugins[i] = this.PluginAbstractStateAt(i).Widening(a.PluginAbstractStateAt(i)) as IAbstractDomainForEnvironments <BoxedVariable <Variable>, BoxedExpression>; } #if PARALLELWIDENING Task.WaitAll(arrayTask, numericalTask); #endif return(new ArrayState(array, numerical, plugins, this.mappings)); }