// Clone the points-to info, and start with nothing alive public ArgsLocalsState CloneForward() { var res = new ArgsLocalsState(argsAlive.Capacity, localsAlive.Capacity); foreach (var kv in argLocalToPointsTo) { res.argLocalToPointsTo.Add(kv.Key, kv.Value); } return(res); }
public void ReadPointer(ArgsLocalsState other, PointsTo pointsTo, BoolRef changed) { var newArgsAlive = other.argsAlive.Clone(); foreach (var argIndex in pointsTo.Args.Members) { newArgsAlive[argIndex] = true; } argsAlive.UnionInPlace(newArgsAlive, changed); var newLocalsAlive = other.localsAlive.Clone(); foreach (var localIndex in pointsTo.Locals.Members) { newLocalsAlive[localIndex] = true; } localsAlive.UnionInPlace(newLocalsAlive, changed); }
public ArgsLocalsState CloneWithArgLocalPointsTo(ArgLocal argLocal, int index, PointsTo pointsTo) { var key = ArgLocalInstruction.Key(argLocal, index); var res = new ArgsLocalsState(argsAlive.Capacity, localsAlive.Capacity); foreach (var kv in argLocalToPointsTo) { if (kv.Key != key) { res.argLocalToPointsTo.Add(kv.Key, kv.Value); } } if (!pointsTo.IsBottom) { res.argLocalToPointsTo.Add(key, pointsTo); } return(res); }
public void Unify(ArgsLocalsState other, BoolRef changed) { foreach (var kv in other.argLocalToPointsTo) { var pt = default(PointsTo); if (!kv.Value.IsBottom) { if (argLocalToPointsTo.TryGetValue(kv.Key, out pt)) { argLocalToPointsTo[kv.Key] = pt.Lub(kv.Value, changed); } else { changed.Set(); argLocalToPointsTo.Add(kv.Key, kv.Value); } } } argsAlive.UnionInPlace(other.argsAlive, changed); localsAlive.UnionInPlace(other.localsAlive, changed); }
public void SourceToTargetTransition(ArgsLocalsState other, BoolRef changed) { // Any pointers in source are pointers in target foreach (var kv in argLocalToPointsTo) { var pt = default(PointsTo); if (!kv.Value.IsBottom) { if (other.argLocalToPointsTo.TryGetValue(kv.Key, out pt)) { other.argLocalToPointsTo[kv.Key] = pt.Lub(kv.Value, changed); } else { changed.Set(); other.argLocalToPointsTo.Add(kv.Key, kv.Value); } } } // Anything alive in target is alive in source argsAlive.UnionInPlace(other.argsAlive, changed); localsAlive.UnionInPlace(other.localsAlive, changed); }
public void PropogateBackwards(ArgsLocalsState other, ArgLocal argLocal, int index, bool isAlive, BoolRef changed) { var newArgsAlive = other.argsAlive.Clone(); var newLocalsAlive = other.localsAlive.Clone(); if (index >= 0) { switch (argLocal) { case ArgLocal.Arg: newArgsAlive[index] = isAlive; break; case ArgLocal.Local: newLocalsAlive[index] = isAlive; break; default: throw new ArgumentOutOfRangeException("argLocal"); } } argsAlive.UnionInPlace(newArgsAlive, changed); localsAlive.UnionInPlace(newLocalsAlive, changed); }
private InnerMachineState(IImSeq <StackEntryState> stack, ArgsLocalsState argsLocalsState) { Stack = stack; Ids = null; ArgsLocalsState = argsLocalsState; }
// New empty stack and bottom args and locals state public InnerMachineState(int nArgs, int nLocals) { Stack = new Seq <StackEntryState>(); Ids = null; ArgsLocalsState = new ArgsLocalsState(nArgs, nLocals); }
private InnerMachineState(IImSeq<StackEntryState> stack, ArgsLocalsState argsLocalsState) { Stack = stack; Ids = null; ArgsLocalsState = argsLocalsState; }
public void SourceToTargetTransition(ArgsLocalsState other, BoolRef changed) { // Any pointers in source are pointers in target foreach (var kv in argLocalToPointsTo) { var pt = default(PointsTo); if (!kv.Value.IsBottom) { if (other.argLocalToPointsTo.TryGetValue(kv.Key, out pt)) other.argLocalToPointsTo[kv.Key] = pt.Lub(kv.Value, changed); else { changed.Set(); other.argLocalToPointsTo.Add(kv.Key, kv.Value); } } } // Anything alive in target is alive in source argsAlive.UnionInPlace(other.argsAlive, changed); localsAlive.UnionInPlace(other.localsAlive, changed); }
// New empty stack and bottom args and locals state public InnerMachineState(int nArgs, int nLocals) { Stack = new Seq<StackEntryState>(); Ids = null; ArgsLocalsState = new ArgsLocalsState(nArgs, nLocals); }
public void ReadPointer(ArgsLocalsState other, PointsTo pointsTo, BoolRef changed) { var newArgsAlive = other.argsAlive.Clone(); foreach (var argIndex in pointsTo.Args.Members) newArgsAlive[argIndex] = true; argsAlive.UnionInPlace(newArgsAlive, changed); var newLocalsAlive = other.localsAlive.Clone(); foreach (var localIndex in pointsTo.Locals.Members) newLocalsAlive[localIndex] = true; localsAlive.UnionInPlace(newLocalsAlive, changed); }
public void Unify(ArgsLocalsState other, BoolRef changed) { foreach (var kv in other.argLocalToPointsTo) { var pt = default(PointsTo); if (!kv.Value.IsBottom) { if (argLocalToPointsTo.TryGetValue(kv.Key, out pt)) argLocalToPointsTo[kv.Key] = pt.Lub(kv.Value, changed); else { changed.Set(); argLocalToPointsTo.Add(kv.Key, kv.Value); } } } argsAlive.UnionInPlace(other.argsAlive, changed); localsAlive.UnionInPlace(other.localsAlive, changed); }
public ArgsLocalsState CloneWithArgLocalPointsTo(ArgLocal argLocal, int index, PointsTo pointsTo) { var key = ArgLocalInstruction.Key(argLocal, index); var res = new ArgsLocalsState(argsAlive.Capacity, localsAlive.Capacity); foreach (var kv in argLocalToPointsTo) { if (kv.Key != key) res.argLocalToPointsTo.Add(kv.Key, kv.Value); } if (!pointsTo.IsBottom) res.argLocalToPointsTo.Add(key, pointsTo); return res; }
// Clone the points-to info, and start with nothing alive public ArgsLocalsState CloneForward() { var res = new ArgsLocalsState(argsAlive.Capacity, localsAlive.Capacity); foreach (var kv in argLocalToPointsTo) res.argLocalToPointsTo.Add(kv.Key, kv.Value); return res; }