public void Unify(RootEnvironment rootEnv, StackEntryState other, BoolRef changed) { var type = Type.Lub(rootEnv, other.Type, changed); var upperBound = default(TypeRef); if (UpperBound != null && other.UpperBound != null) { upperBound = UpperBound.Glb(rootEnv, other.UpperBound, changed); } else if (other.UpperBound != null) { upperBound = other.UpperBound; changed.Set(); } else { upperBound = UpperBound; } if (upperBound != null && !type.IsAssignableTo(rootEnv, upperBound)) { throw new InvalidOperationException("stack entries are not unifiable"); } var pointsTo = PointsTo.Lub(other.PointsTo, changed); UpperBound = upperBound; Type = type; PointsTo = pointsTo; }
public MachineState PopPush(int n, StackEntryState entry) { if (n > Depth) { throw new InvalidOperationException("stack is too shallow"); } var stack = new Seq <StackEntryState>(Depth - n + 1); stack.Add(entry); for (var i = n; i < Depth; i++) { stack.Add(innerState.Value.Stack[i]); } return(CloneForward(stack)); }
public void Unify(RootEnvironment rootEnv, StackEntryState other, BoolRef changed) { var type = Type.Lub(rootEnv, other.Type, changed); var upperBound = default(TypeRef); if (UpperBound != null && other.UpperBound != null) upperBound = UpperBound.Glb(rootEnv, other.UpperBound, changed); else if (other.UpperBound != null) { upperBound = other.UpperBound; changed.Set(); } else upperBound = UpperBound; if (upperBound != null && !type.IsAssignableTo(rootEnv, upperBound)) throw new InvalidOperationException("stack entries are not unifiable"); var pointsTo = PointsTo.Lub(other.PointsTo, changed); UpperBound = upperBound; Type = type; PointsTo = pointsTo; }
public bool IsEquivalentTo(RootEnvironment rootEnv, StackEntryState other) { return(Type.IsEquivalentTo(rootEnv, other.Type) && PointsTo.Lte(other.PointsTo) && other.PointsTo.Lte(PointsTo)); }
public MachineState Push(StackEntryState entry) { return(PopPush(0, entry)); }
public MachineState Push(StackEntryState entry) { return PopPush(0, entry); }
public MachineState PopPush(int n, StackEntryState entry) { if (n > Depth) throw new InvalidOperationException("stack is too shallow"); var stack = new Seq<StackEntryState>(Depth - n + 1); stack.Add(entry); for (var i = n; i < Depth; i++) stack.Add(innerState.Value.Stack[i]); return CloneForward(stack); }
public bool IsEquivalentTo(RootEnvironment rootEnv, StackEntryState other) { return Type.IsEquivalentTo(rootEnv, other.Type) && PointsTo.Lte(other.PointsTo) && other.PointsTo.Lte(PointsTo); }