public override Domain <E, V> Call <TypeList, ArgList> (APC pc, Method method, bool virt, TypeList extraVarargs, V dest, ArgList args, Domain <E, V> data) { this.callSiteCache [pc] = data; if (!MetaDataProvider.IsStatic(method)) { return(AssumeNonNull(args [0], data)); } return(data); }
public MethodSubroutine(SubroutineFacade SubroutineFacade, Method method, Label startLabel, SubroutineWithHandlersBuilder <Label, Handler> builder) : base(SubroutineFacade, startLabel, builder) { this.method = method; IMetaDataProvider metaDataProvider = this.SubroutineFacade.MetaDataProvider; builder.BuildBlocks(startLabel, this); BlockWithLabels <Label> targetBlock = GetTargetBlock(startLabel); Commit(); TypeNode type = metaDataProvider.DeclaringType(method); Subroutine invariant = this.SubroutineFacade.GetInvariant(type); if (invariant != null && !metaDataProvider.IsConstructor(method) && !metaDataProvider.IsStatic(method)) { AddEdgeSubroutine(Entry, targetBlock, invariant, EdgeTag.Entry); Subroutine requires = this.SubroutineFacade.GetRequires(method); if (requires != null) { AddEdgeSubroutine(Entry, targetBlock, requires, EdgeTag.Entry); } } else { AddEdgeSubroutine(Entry, targetBlock, this.SubroutineFacade.GetRequires(method), EdgeTag.Entry); } if (this.blocks_ending_in_return_point == null) { return; } Subroutine ensures = this.SubroutineFacade.GetEnsures(method); bool putInvariantAfterExit = !metaDataProvider.IsStatic(method) && !metaDataProvider.IsFinalizer(method) && !metaDataProvider.IsDispose(method); foreach (var block in this.blocks_ending_in_return_point) { if (putInvariantAfterExit) { AddEdgeSubroutine(block, Exit, invariant, EdgeTag.Exit); } AddEdgeSubroutine(block, Exit, ensures, EdgeTag.Exit); } if (ensures != null) { throw new NotImplementedException(); } this.blocks_ending_in_return_point = null; }
public override bool TrySetType(TypeNode expectedType, IMetaDataProvider metaDataProvider, out TypeNode resultType) { if (typeof(T) == typeof(Parameter)) { var p = (Parameter)(object)this.Element; TypeNode type = metaDataProvider.ParameterType(p); this.isManagedPointer = metaDataProvider.IsManagedPointer(type); ResultType = resultType = metaDataProvider.ManagedPointer(type); return(true); } if (typeof(T) == typeof(Field)) { var f = (Field)(object)this.Element; TypeNode type = metaDataProvider.FieldType(f); this.isStatic = metaDataProvider.IsStatic(f); this.isManagedPointer = metaDataProvider.IsManagedPointer(type); ResultType = resultType = metaDataProvider.ManagedPointer(type); TypeNode declaringType = metaDataProvider.DeclaringType(f); if (metaDataProvider.IsManagedPointer(expectedType)) { expectedType = metaDataProvider.ElementType(expectedType); } expectedType = metaDataProvider.Unspecialized(expectedType); if (!metaDataProvider.IsStatic(f) && declaringType.Equals(expectedType) && (!metaDataProvider.DerivesFrom(expectedType, declaringType) || !metaDataProvider.IsProtected(f) && !metaDataProvider.IsPublic(f))) { this.castTo = metaDataProvider.FullName(declaringType); } return(true); } if (typeof(T) == typeof(Local)) { var local = (Local)(object)this.Element; TypeNode type = metaDataProvider.LocalType(local); this.isManagedPointer = metaDataProvider.IsManagedPointer(type); ResultType = resultType = metaDataProvider.ManagedPointer(type); return(true); } if (typeof(T) == typeof(Method)) { var method = (Method)(object)this.Element; ResultType = resultType = !IsAddressOf ? metaDataProvider.ReturnType(method) : metaDataProvider.ManagedPointer(metaDataProvider.ReturnType(method)); if (metaDataProvider.IsManagedPointer(expectedType)) { expectedType = metaDataProvider.ElementType(expectedType); } expectedType = metaDataProvider.Unspecialized(expectedType); TypeNode declaringType = metaDataProvider.DeclaringType(method); if (!metaDataProvider.IsStatic(method) && declaringType.Equals(expectedType) && (!metaDataProvider.DerivesFrom(expectedType, declaringType) || !metaDataProvider.IsProtected(method) && !metaDataProvider.IsPublic(method))) { this.castTo = metaDataProvider.FullName(declaringType); } return(true); } ResultType = resultType = default(TypeNode); return(false); }