private void extendCallSink(ExtensionSinkPoint point, FlowOutputSet inSet) { inSet.StartTransaction(); inSet.Extend(point.OwningExtension.Owner.OutSet); //Services.FlowResolver.CallDispatchMerge(_inSet, OwningExtension.Branches); inSet.CommitTransaction(); }
/// <summary> /// Initializes a new instance of the <see cref="ForwardAnalysisBase" /> class. /// Create forward analysis object for given entry method graph. /// </summary> /// <param name="entryMethodGraph">Control flow graph of method which is entry point of analysis</param> /// <param name="createSnapshotDelegate">Method that creates a snapshot used during analysis</param> public ForwardAnalysisBase(Weverca.ControlFlowGraph.ControlFlowGraph entryMethodGraph, CreateSnapshot createSnapshotDelegate) { _createSnapshotDelegate = createSnapshotDelegate; WideningLimit = int.MaxValue; SimplifyLimit = int.MaxValue; EntryInput = createEmptySet(); EntryInput.StartTransaction(); EntryCFG = entryMethodGraph; }
private void extendCallExtension(ExtensionPoint point, FlowOutputSet inSet) { inSet.StartTransaction(); if (point.Type == ExtensionType.ParallelCall) { inSet.ExtendAsCall(point.Caller.OutSet, point.Graph, point.Flow.CalledObject, point.Flow.Arguments); } else { inSet.Extend(point.Caller.OutSet); } inSet.CommitTransaction(); }
private void setOrderedArguments(FlowOutputSet callInput, IEnumerable <ValuePoint> arguments, LangElement declaration) { var index = 0; foreach (var arg in arguments) { var argVar = argument(index); var argumentEntry = callInput.GetVariable(new VariableIdentifier(argVar)); //assign value for parameter var argumentValue = arg.Value.ReadMemory(Output); argumentEntry.WriteMemory(callInput.Snapshot, argumentValue); ++index; } }
private void setNamedArguments(FlowOutputSet callInput, CallSignature?callSignature, Signature signature, IEnumerable <ValuePoint> arguments) { int i = 0; foreach (var arg in arguments) { if (i >= signature.FormalParams.Count) { break; } var param = signature.FormalParams [i]; var argumentVar = callInput.GetVariable(new VariableIdentifier(param.Name)); var argumentValue = arg.Value.ReadMemory(Output); argumentVar.WriteMemory(callInput.Snapshot, argumentValue); ++i; } // TODO: if (arguments.Count() < signature.FormalParams.Count) and exists i > arguments.Count() signature.FormalParams[i].InitValue != null }
private void standardExtend(IEnumerable <ProgramPointBase> inputs, FlowOutputSet inSet) { var inputSets = new List <FlowInputSet>(); foreach (var input in inputs) { var outSet = GetOutSet(input); var assumeParent = input as AssumePoint; if (outSet == null || (assumeParent != null && !assumeParent.Assumed)) { continue; } inputSets.Add(outSet); } inSet.StartTransaction(); inSet.Extend(inputSets.ToArray()); inSet.CommitTransaction(); }
/// <summary> /// Initialize program point with given input and output sets /// </summary> /// <param name="input">Input set of program point</param> /// <param name="output">Output set of program point</param> internal void Initialize(FlowOutputSet input, FlowOutputSet output) { if (_isInitialized) { throw new NotSupportedException("Initialization can be run only once"); } _isInitialized = true; _inSet = input; _outSet = output; if (_inSet.Snapshot != null) { //can be null in TestEntry _inSet.Snapshot.Assistant.RegisterProgramPoint(this); } if (_outSet.Snapshot != null) { //can be null in TestEntry _outSet.Snapshot.Assistant.RegisterProgramPoint(this); } }
/// <summary> /// Extend snapshot as a call to function/method callee from given callerContext /// </summary> /// <param name="callerContext">The caller context.</param> /// <param name="callee">Program point graph of the callee (identification of function or method that was called).</param> /// <param name="thisObject">The this object.</param> /// <param name="arguments">The arguments.</param> internal void ExtendAsCall(FlowOutputSet callerContext, ProgramPointGraph callee, MemoryEntry thisObject, MemoryEntry[] arguments) { Snapshot.ExtendAsCall(getSnapshot(callerContext), callee, thisObject, arguments); }
private void forwardExtend(ProgramPointBase point, IEnumerable <ProgramPointBase> inputs, FlowOutputSet inSet) { var extensionPoint = point as ExtensionPoint; var sinkPoint = point as ExtensionSinkPoint; if (extensionPoint != null) { extendCallExtension(extensionPoint, inSet); } else if (sinkPoint != null) { extendCallSink(sinkPoint, inSet); } else { standardExtend(inputs, inSet); } }