private AbstractStackState <VariabilityInfo> HandleLdloc(ILInstruction ili, AbstractStackState <VariabilityInfo> pre, int index) { Contract.Requires <ArgumentNullException>(pre != null); Contract.Requires <ArgumentException>(index >= 0); return(pre.Push(pre.GetLocal(index)).UniqueSuccessor()); }
private AbstractStackState <VariabilityInfo> HandleLdsfld(ILInstruction ili, AbstractStackState <VariabilityInfo> pre) { FieldInfo field = (FieldInfo)ili.Operand; FieldFacts fieldFacts = FactUniverse.Instance.GetFacts(field); EVariability fieldVar = fieldFacts.IsWritten || fieldFacts.IsSubMutated ? EVariability.ExternVariable : EVariability.Constant; VariabilityInfo newVar = VariabilityInfo.CreateBySingleDef(fieldVar, ili.Index); return(pre .Push(newVar) .UniqueSuccessor()); }
private AbstractStackState <VariabilityInfo> HandleNewobj(ILInstruction ili, AbstractStackState <VariabilityInfo> pre) { ConstructorInfo ctor = (ConstructorInfo)ili.Operand; ParameterInfo[] args = ctor.GetParameters(); AbstractStackState <VariabilityInfo> next = pre; for (int i = 0; i < args.Length; i++) { next = next.Pop(); } return(next .Push(VariabilityInfo.CreateBySingleDef(EVariability.ExternVariable, ili.Index)) .UniqueSuccessor()); }
private AbstractStackState <VariabilityInfo> HandleCall(ILInstruction ili, AbstractStackState <VariabilityInfo> pre, bool isCalli) { MethodBase callee = (MethodBase)ili.Operand; bool hasThis = callee.CallingConvention.HasFlag(CallingConventions.HasThis); EVariability callVar = EVariability.Constant; ParameterInfo[] args = callee.GetParameters(); MethodFacts myFacts = FactUniverse.Instance.GetFacts(Method); MethodFacts calleeFacts = FactUniverse.Instance.GetFacts(callee); AbstractStackState <VariabilityInfo> next = pre; if (hasThis) { callVar = VariabilityOperations.Stronger(callVar, pre[0].Variability); next = pre.Pop(); } for (int i = 0; i < args.Length; i++) { callVar = VariabilityOperations.Stronger(callVar, next[0].Variability); next = next.Pop(); } if (!calleeFacts.IsSideEffectFree) { callVar = EVariability.ExternVariable; } if (calleeFacts.IsStaticEvaluation) { callVar = EVariability.Constant; } if (isCalli) { next = pre.Pop(); } VariabilityInfo callVarI = VariabilityInfo.CreateBySingleDef(callVar, ili.Index); next = UpdateStackState(ili, callVarI, next); Type returnType; if (callee.IsFunction(out returnType)) { next = next.Push(callVarI); } return(next.UniqueSuccessor()); }
private AbstractStackState <VariabilityInfo> HandleLdArg(ILInstruction ili, int narg, AbstractStackState <VariabilityInfo> pre) { MethodFacts myFacts = FactUniverse.Instance.GetFacts(Method); EVariability varia; if (Method.CallingConvention.HasFlag(CallingConventions.HasThis)) { if (narg == 0) { varia = EVariability.Constant; } else { varia = _callPattern.Pattern[narg - 1]; } } else { varia = _callPattern.Pattern[narg]; } return(pre.Push(VariabilityInfo.CreateBySingleDef(varia, ili.Index)).UniqueSuccessor()); }
private AbstractStackState <VariabilityInfo> HandleDup(ILInstruction ili, AbstractStackState <VariabilityInfo> pre) { return(pre.Push(pre[0]).UniqueSuccessor()); }
private AbstractStackState <VariabilityInfo> PushC(ILInstruction ili, AbstractStackState <VariabilityInfo> pre) { return(pre.Push(VariabilityInfo.CreateBySingleDef(EVariability.Constant, ili.Index)).UniqueSuccessor()); }