public static void AssertIs(this ConsistencyState state, ConsistencyState expectedState) { if (state != expectedState) { throw Errors.WrongComputedState(expectedState, state); } }
public static void AssertIsNot(this ConsistencyState state, ConsistencyState unexpectedState) { if (state == unexpectedState) { throw Errors.WrongComputedState(state); } }
/// <summary> /// Inclusion check for two PointsToAndWriteEffects /// </summary> /// <param name="ptgWe"></param> public override bool Includes(PointsToState cState2) { bool includes = base.Includes(cState2); ConsistencyState pE = (ConsistencyState)cState2; includes = includes && IncludesConsistency(pE.consistency); return(includes); }
public ConsistencyState(ConsistencyState exp) : base(exp) { this.consistency = new Dictionary <IPTAnalysisNode, AbstractValue>(exp.consistency); exposedNodes = new Set <IPTAnalysisNode>(exp.exposedNodes); this.nonNullState = exp.nonNullState; }
protected override object VisitCall(Variable dest, Variable receiver, Method callee, ExpressionList arguments, bool virtcall, Statement stat, object arg) { ConsistencyState exp = (ConsistencyState)arg; Label lb = new Label(stat, exp.Method); // Console.Out.WriteLine("Calling: {0}", callee.FullName); if (exp.IsUnPackMethod(callee)) { Variable varToExpose = null; if (receiver != null) { varToExpose = receiver; } else { if (arguments != null && arguments.Count > 0 && arguments[0] is Variable) { varToExpose = (Variable)arguments[0]; } } if (varToExpose != null) { exp.ApplyExpose(varToExpose, lb); // if (dest != null) { exp.pointsToGraph.CopyLocVar(dest, varToExpose); } } return(exp); } if (exp.IsPackMethod(callee)) { Variable varToExpose = null; if (receiver != null) { varToExpose = receiver; } else { if (arguments != null && arguments.Count > 0 && arguments[0] is Variable) { varToExpose = (Variable)arguments[0]; } } if (varToExpose != null) { exp.ApplyUnExpose(varToExpose, lb); } return(exp); } return(base.VisitCall(dest, receiver, callee, arguments, virtcall, stat, arg)); }
/// <summary> /// Join two PointsToAndWriteEffects /// </summary> /// <param name="ptgWe"></param> public override void Join(PointsToState ptg) { base.Join(ptg); if (ptg != null) { ConsistencyState ptgE = (ConsistencyState)ptg; if (consistency != ptgE.consistency) { JoinConsistencyNodes(ptgE.consistency); } //if (exposedNodes != ptgE.exposedNodes) // exposedNodes.AddRange(ptgE.exposedNodes); } }
public static Exception WrongComputedState(ConsistencyState state) => new InvalidOperationException( $"Wrong Computed.State: {state}.");
public static Exception WrongComputedState( ConsistencyState expectedState, ConsistencyState state) => new InvalidOperationException( $"Wrong Computed.State: expected {expectedState}, was {state}.");
protected virtual void CheckExposure(ConsistencyState exp, Variable v) { }
public static void AssertConsistencyStateIsNot(this IHasConsistencyState hasConsistencyState, ConsistencyState unexpectedState) { if (hasConsistencyState.ConsistencyState == unexpectedState) { throw Errors.WrongComputedState(hasConsistencyState.ConsistencyState); } }
public static void AssertConsistencyStateIs(this IHasConsistencyState hasConsistencyState, ConsistencyState expectedState) { if (hasConsistencyState.ConsistencyState != expectedState) { throw Errors.WrongComputedState(expectedState, hasConsistencyState.ConsistencyState); } }
public static bool IsConsistentOrComputing(this ConsistencyState state) => state != ConsistencyState.Invalidated;
public static bool IsConsistent(this ConsistencyState state) => state == ConsistencyState.Consistent;
public static bool IsInvalidated(this ConsistencyState state) => state == ConsistencyState.Invalidated;
public ConsistencyState(ConsistencyState exp) : base(exp) { this.consistency = new Dictionary<IPTAnalysisNode, AbstractValue>(exp.consistency); exposedNodes = new Set<IPTAnalysisNode>(exp.exposedNodes); this.nonNullState = exp.nonNullState; }