public override LocalsAndOperands <V> EntryPreState(IMethodDefinition method) { // entry pre-state is empty operand stack // with locals initialized // LocalsAndOperands <V> state = new LocalsAndOperands <V>(); // If method has a this, parameter, it is the first argument if (!method.IsStatic && !method.HasExplicitThisParameter) { ITypeDefinition instantiatedThis = GarbageCollectHelper.InstantiatedTypeIfPossible(method.ContainingTypeDefinition); state.Arguments.Add(ValueAbstraction.GetAbstractValueForType(instantiatedThis)); } foreach (IParameterDefinition parameter in method.Parameters) { state.Arguments.Add(ValueAbstraction.GetAbstractValueForType(parameter.Type.ResolvedType)); } foreach (ILocalDefinition localVariable in method.Body.LocalVariables) { ITypeDefinition typeOfLocal = localVariable.Type.ResolvedType; state.Locals.Add(ValueAbstraction.GetAbstractValueForType(typeOfLocal)); } return(state); }
private ITypeDefinition FixupTypeForFlow(ITypeDefinition type) { // If the type is generic but we're not instantiated, we try to instantiate it. // This is required because the CFG is over the completely unspecialized uninstantiated // bytecode while but some instruction *types* (e.g. calls) require instantiate types. // This has got to be slow. // Another alternative would have been to constrcut the CFG over the instantiated type // but this appears to be buggy at the moment. return(GarbageCollectHelper.InstantiatedTypeIfPossible(type)); }