public BlockWithLabels <Label> GetBlock(Label label) { IMetaDataProvider metadataDecoder = this.SubroutineFacade.MetaDataProvider; BlockWithLabels <Label> block; if (!this.LabelsThatStartBlocks.TryGetValue(label, out block)) { Pair <Method, bool> methodVirtualPair; Method constructor; if (Builder == null) { throw new InvalidOperationException("Builder must be not null"); } if (Builder.IsMethodCallSite(label, out methodVirtualPair)) { int parametersCount = metadataDecoder.Parameters(methodVirtualPair.Key).Count; block = new MethodCallBlock <Label> (methodVirtualPair.Key, this, ref this.BlockIdGenerator, parametersCount, methodVirtualPair.Value); } else if (Builder.IsNewObjSite(label, out constructor)) { int parametersCount = metadataDecoder.Parameters(constructor).Count; block = new NewObjCallBlock <Label> (constructor, parametersCount, this, ref this.BlockIdGenerator); } else { block = NewBlock(); } if (Builder.IsTargetLabel(label)) { this.LabelsThatStartBlocks.Add(label, block); } } return(block); }
public override Domain <E, V> Entry(APC pc, Method method, Domain <E, V> data) { APC at = ContextProvider.MethodContext.CFG.Next(pc); Domain <E, V> domain = data; IIndexable <Parameter> parameters = MetaDataProvider.Parameters(method); TypeNode eventArgsType; bool systemType = MetaDataProvider.TryGetSystemType("System.EventArgs", out eventArgsType); for (int i = 0; i < parameters.Count; i++) { Parameter p = parameters [i]; TypeNode pType = MetaDataProvider.ParameterType(p); if (MetaDataProvider.IsManagedPointer(pType)) { V sv; if (ContextProvider.ValueContext.TryParameterValue(at, p, out sv)) { domain = AssumeNonNull(sv, domain); } } else { V sv; if (i == 0 && parameters.Count == 1 && MetaDataProvider.IsArray(pType) && MetaDataProvider.Name(method) == "Main" && MetaDataProvider.IsStatic(method) && ContextProvider.ValueContext.TryParameterValue(pc, p, out sv)) { domain = AssumeNonNull(sv, domain); } } } V sv1; if (systemType && parameters.Count == 2 && MetaDataProvider.Equal(MetaDataProvider.System_Object, MetaDataProvider.ParameterType(parameters [0])) && MetaDataProvider.DerivesFrom(MetaDataProvider.ParameterType(parameters [1]), eventArgsType) && ContextProvider.ValueContext.TryParameterValue(pc, parameters [1], out sv1)) { domain = AssumeNonNull(sv1, domain); } if (!MetaDataProvider.IsStatic(method) && ContextProvider.ValueContext.TryParameterValue(pc, MetaDataProvider.This(method), out sv1)) { domain = AssumeNonNull(sv1, domain); } return(domain); }