public Variable(JST.Identifier id, ArgLocal argLocal, bool isInit, bool isReadOnly, CST.TypeRef type) { Id = id; ArgLocal = argLocal; IsInit = isInit; IsReadOnly = isReadOnly; Type = type; }
public TypeRef ArgLocalType(ArgLocal argLocal, int index) { switch (argLocal) { case ArgLocal.Arg: return(ValueParameters[index].Type); case ArgLocal.Local: return(Locals[index].Type); default: throw new ArgumentOutOfRangeException(); } }
public MachineState PopAddArgLocalPointsTo(int n, ArgLocal argLocal, int index, PointsTo pointsTo) { if (n > Depth) { throw new InvalidOperationException("stack is too shallow"); } var stack = new Seq <StackEntryState>(Depth - n); for (var i = n; i < Depth; i++) { stack.Add(innerState.Value.Stack[i]); } return(CloneWithArgLocalPointsTo(stack, argLocal, index, pointsTo)); }
private IntSet ArgLocalToLiveness(ArgLocal argLocal) { switch (argLocal) { case ArgLocal.Arg: return(argsAlive); case ArgLocal.Local: return(localsAlive); default: throw new ArgumentOutOfRangeException("argLocal"); } }
public PointsTo ArgLocalPointsTo(ArgLocal argLocal, int index) { var key = ArgLocalInstruction.Key(argLocal, index); var pt = default(PointsTo); if (argLocalToPointsTo.TryGetValue(key, out pt)) { return(pt); } else { return(PointsTo.MakeBottom(argsAlive.Capacity, localsAlive.Capacity)); } }
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 static PointsTo MakeArgLocal(int nArgs, int nLocals, ArgLocal argLocal, int index) { switch (argLocal) { case ArgLocal.Arg: return(new PointsTo (IntPowersetDomain.Singleton(nArgs, index), IntPowersetDomain.Bottom(nLocals), BooleanDomain.Bottom)); case ArgLocal.Local: return(new PointsTo (IntPowersetDomain.Bottom(nArgs), IntPowersetDomain.Singleton(nLocals, index), BooleanDomain.Bottom)); default: throw new ArgumentOutOfRangeException("argLocal"); } }
public static MessageContext ArgOrLocal(MessageContext parent, ArgLocal argLocal, int index) { return(new MessageContext (parent, null, sb => { switch (argLocal) { case ArgLocal.Arg: sb.Append("Argument "); break; case ArgLocal.Local: sb.Append("Local "); break; default: throw new ArgumentOutOfRangeException(); } sb.Append(index.ToString()); })); }
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); }
public static Effects MakeArgLocal(int nArgs, int nLocals, ArgLocal argLocal, int index, bool isWrite, bool couldThrow) { switch (argLocal) { case ArgLocal.Arg: return(new Effects (ReadWriteVectorDomain.FromSameElementExcept (ReadWriteDomain.Bottom, nArgs, new ReadWriteDomain(true, isWrite), index), ReadWriteVectorDomain.FromSameElement(ReadWriteDomain.Bottom, nLocals), ReadWriteDomain.Bottom, new BooleanDomain(couldThrow))); case ArgLocal.Local: return(new Effects (ReadWriteVectorDomain.FromSameElement(ReadWriteDomain.Bottom, nArgs), ReadWriteVectorDomain.FromSameElementExcept (ReadWriteDomain.Bottom, nLocals, new ReadWriteDomain(true, isWrite), index), ReadWriteDomain.Bottom, new BooleanDomain(couldThrow))); default: throw new ArgumentOutOfRangeException("argLocal"); } }
public bool ArgLocalIsAlive(ArgLocal argLocal, int index) { return ArgLocalToLiveness(argLocal)[index]; }
public bool ArgLocalIsAlive(ArgLocal argLocal, int index) { return(innerState.Value.ArgsLocalsState.ArgLocalIsAlive(argLocal, index)); }
public void ReadArgLocal(MachineState nextState, ArgLocal argLocal, int index, BoolRef changed) { innerState.Value.ArgsLocalsState.PropogateBackwards(nextState.innerState.Value.ArgsLocalsState, argLocal, index, true, changed); }
public PointsTo ArgLocalPointsTo(ArgLocal argLocal, int index) { return(innerState.Value.ArgsLocalsState.ArgLocalPointsTo(argLocal, index)); }
public PointsTo ArgLocalPointsTo(ArgLocal argLocal, int index) { return innerState.Value.ArgsLocalsState.ArgLocalPointsTo(argLocal, index); }
public bool ArgLocalIsAlive(ArgLocal argLocal, int index) { return(ArgLocalToLiveness(argLocal)[index]); }
public InnerMachineState CloneWithArgLocalPointsTo(IImSeq<StackEntryState> stack, ArgLocal argLocal, int index, PointsTo pointsTo) { return new InnerMachineState(stack, ArgsLocalsState.CloneWithArgLocalPointsTo(argLocal, index, pointsTo)); }
private IntSet ArgLocalToLiveness(ArgLocal argLocal) { switch (argLocal) { case ArgLocal.Arg: return argsAlive; case ArgLocal.Local: return localsAlive; default: throw new ArgumentOutOfRangeException("argLocal"); } }
public InnerMachineState CloneWithArgLocalPointsTo(IImSeq <StackEntryState> stack, ArgLocal argLocal, int index, PointsTo pointsTo) { return(new InnerMachineState(stack, ArgsLocalsState.CloneWithArgLocalPointsTo(argLocal, index, pointsTo))); }
public bool ArgLocalIsAlive(ArgLocal argLocal, int index) { return innerState.Value.ArgsLocalsState.ArgLocalIsAlive(argLocal, index); }
public MachineState PopAddArgLocalPointsTo(int n, ArgLocal argLocal, int index, PointsTo pointsTo) { if (n > Depth) throw new InvalidOperationException("stack is too shallow"); var stack = new Seq<StackEntryState>(Depth - n); for (var i = n; i < Depth; i++) stack.Add(innerState.Value.Stack[i]); return CloneWithArgLocalPointsTo(stack, argLocal, index, pointsTo); }
public PointsTo ArgLocalPointsTo(ArgLocal argLocal, int index) { var key = ArgLocalInstruction.Key(argLocal, index); var pt = default(PointsTo); if (argLocalToPointsTo.TryGetValue(key, out pt)) return pt; else return PointsTo.MakeBottom(argsAlive.Capacity, localsAlive.Capacity); }
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 TypeRef ArgLocalType(ArgLocal argLocal, int index) { switch (argLocal) { case ArgLocal.Arg: return ValueParameters[index].Type; case ArgLocal.Local: return Locals[index].Type; default: throw new ArgumentOutOfRangeException(); } }
public static MessageContext ArgOrLocal(ArgLocal argLocal, int index) { return(ArgOrLocal(null, argLocal, index)); }
public MachineState CloneWithArgLocalPointsTo(IImSeq<StackEntryState> stack, ArgLocal argLocal, int index, PointsTo pointsTo) { return new MachineState(RootEnv, nArgs, nLocals, innerState.Value.CloneWithArgLocalPointsTo(stack, argLocal, index, pointsTo)); }
public MachineState CloneWithArgLocalPointsTo(IImSeq <StackEntryState> stack, ArgLocal argLocal, int index, PointsTo pointsTo) { return(new MachineState(RootEnv, nArgs, nLocals, innerState.Value.CloneWithArgLocalPointsTo(stack, argLocal, index, pointsTo))); }
private PointsTo ArgLocalPT(ArgLocal argLocal, int index) { var key = ArgLocalInstruction.Key(argLocal, index); if (stackLocPTCache == null) stackLocPTCache = new Map<string, PointsTo>(); var pt = default(PointsTo); if (!stackLocPTCache.TryGetValue(key, out pt)) { pt = PointsTo.MakeArgLocal(method.ValueParameters.Count, method.Locals.Count, argLocal, index); stackLocPTCache.Add(key, pt); } return pt; }