/// <inheritdoc /> public void MergeAtSubprogram(Snapshot snapshot, List <Snapshot> snapshots, ProgramPointBase[] extendedPoints) { TrackingMergeStructureWorker structureWorker = new TrackingMergeStructureWorker(Factories, snapshot, snapshots); structureWorker.MergeStructure(); ISnapshotStructureProxy structure = structureWorker.Structure; TrackingMergeDataWorker dataWorker = new TrackingMergeDataWorker(Factories, snapshot, structure.Readonly, snapshots); dataWorker.MergeData(); ISnapshotDataProxy data = dataWorker.Data; int localLevel = structure.Readonly.CallLevel; var structureTracker = structure.Writeable.WriteableChangeTracker; structureTracker.SetCallLevel(localLevel); structureTracker.SetConnectionType(TrackerConnectionType.SUBPROGRAM_MERGE); var dataTracker = data.Writeable.WriteableChangeTracker; dataTracker.SetCallLevel(localLevel); dataTracker.SetConnectionType(TrackerConnectionType.SUBPROGRAM_MERGE); for (int x = 0; x < snapshots.Count; x++) { Snapshot callSnapshot = (Snapshot)extendedPoints[x].OutSet.Snapshot; Snapshot mergeAncestor = snapshots[x]; structureTracker.AddCallTracker(callSnapshot, mergeAncestor.Structure.Readonly.ReadonlyChangeTracker); dataTracker.AddCallTracker(callSnapshot, mergeAncestor.Data.Readonly.ReadonlyChangeTracker); } snapshot.SetMemoryMergeResult(localLevel, structure, data); }
/// <inheritdoc /> public void Extend(Snapshot extendedSnapshot, Snapshot sourceSnapshot) { ISnapshotStructureProxy structure = Factories.SnapshotStructureFactory.CopyInstance(sourceSnapshot.Structure); ISnapshotDataProxy data = Factories.SnapshotDataFactory.CopyInstance(sourceSnapshot.Data); extendedSnapshot.SetMemoryMergeResult(sourceSnapshot.CallLevel, structure, data); }
/// <inheritdoc /> public void ExtendAsCall(Snapshot extendedSnapshot, Snapshot sourceSnapshot, ProgramPointGraph calleeProgramPoint, MemoryEntry thisObject) { ISnapshotStructureProxy structure = Factories.SnapshotStructureFactory.CopyInstance(sourceSnapshot.Structure); ISnapshotDataProxy data = Factories.SnapshotDataFactory.CopyInstance(sourceSnapshot.Data); int localLevel = sourceSnapshot.CallLevel + 1; structure.Writeable.AddLocalLevel(); extendedSnapshot.SetMemoryMergeResult(localLevel, structure, data); }
private IIndexDefinition getIndexDefinitionOrUndefined(MemoryIndex index, ISnapshotStructureProxy snapshotStructure, IIndexDefinition emptyDefinition) { IIndexDefinition definition = null; if (!snapshotStructure.Readonly.TryGetIndexDefinition(index, out definition)) { definition = emptyDefinition; } return(definition); }
/// <inheritdoc /> public void MergeWithCall(Snapshot snapshot, Snapshot callSnapshot, List <Snapshot> snapshots) { int localLevel = callSnapshot.CallLevel; MergeWorker worker = new MergeWorker(Factories, snapshot, snapshots, localLevel, true); worker.Merge(); ISnapshotStructureProxy structure = worker.Structure; ISnapshotDataProxy data = worker.Data; snapshot.SetMemoryMergeResult(localLevel, structure, data); }
/// <inheritdoc /> public ISnapshotStructureProxy CopyInstance(ISnapshotStructureProxy oldData) { LazyCopySnapshotStructureProxy proxy = oldData as LazyCopySnapshotStructureProxy; if (proxy != null) { return proxy.Copy(); } else { throw new InvalidCastException("Argument is not of type CopySnapshotStructureProxy"); } }
/// <summary> /// Initializes a new instance of the <see cref="CopyCommitWorker"/> class. /// </summary> /// <param name="factories">The factories.</param> /// <param name="snapshot">The snapshot.</param> /// <param name="simplifyLimit">The simplify limit.</param> /// <param name="newStructure">The new structure.</param> /// <param name="oldStructure">The old structure.</param> /// <param name="newData">The new data.</param> /// <param name="oldData">The old data.</param> public CopyCommitWorker(ModularMemoryModelFactories factories, Snapshot snapshot, int simplifyLimit, ISnapshotStructureProxy newStructure, ISnapshotStructureProxy oldStructure, ISnapshotDataProxy newData, ISnapshotDataProxy oldData) { Factories = factories; this.snapshot = snapshot; this.simplifyLimit = simplifyLimit; this.assistant = snapshot.MemoryAssistant; this.newStructure = newStructure; this.oldStructure = oldStructure; this.newData = newData; this.oldData = oldData; }
/// <summary> /// Merges the data. /// </summary> /// <param name="targetStructure">The target structure.</param> public void MergeData(ISnapshotStructureProxy targetStructure) { Structure = targetStructure; this.targetStructure = targetStructure.Readonly; isStructureWriteable = false; createSnapshotContexts(); collectDataChanges(); createNewData(); mergeObjectDefinitions(); mergeMemoryStacksRoots(); processMergeOperations(); }
/// <inheritdoc /> public void ExtendAsCall(Snapshot extendedSnapshot, Snapshot sourceSnapshot, ProgramPointGraph calleeProgramPoint, MemoryEntry thisObject) { int localLevel = calleeProgramPoint.ProgramPointGraphID; ISnapshotStructureProxy structure = Factories.SnapshotStructureFactory.CopyInstance(sourceSnapshot.Structure); if (!structure.Writeable.ContainsStackWithLevel(localLevel)) { structure.Writeable.AddStackLevel(localLevel); } structure.Writeable.SetLocalStackLevelNumber(localLevel); structure.Writeable.WriteableChangeTracker.SetCallLevel(localLevel); structure.Writeable.WriteableChangeTracker.SetConnectionType(TrackerConnectionType.CALL_EXTEND); ISnapshotDataProxy data = Factories.SnapshotDataFactory.CopyInstance(sourceSnapshot.Data); data.Writeable.WriteableChangeTracker.SetCallLevel(localLevel); data.Writeable.WriteableChangeTracker.SetConnectionType(TrackerConnectionType.CALL_EXTEND); extendedSnapshot.SetMemoryMergeResult(localLevel, structure, data); }
/// <inheritdoc /> public void Merge(Snapshot snapshot, List <Snapshot> snapshots) { TrackingMergeStructureWorker structureWorker = new TrackingMergeStructureWorker(Factories, snapshot, snapshots); structureWorker.MergeStructure(); ISnapshotStructureProxy structure = structureWorker.Structure; TrackingMergeDataWorker dataWorker = new TrackingMergeDataWorker(Factories, snapshot, structure.Readonly, snapshots); dataWorker.MergeData(); ISnapshotDataProxy data = dataWorker.Data; int localLevel = structure.Readonly.CallLevel; structure.Writeable.WriteableChangeTracker.SetCallLevel(localLevel); structure.Writeable.WriteableChangeTracker.SetConnectionType(TrackerConnectionType.MERGE); data.Writeable.WriteableChangeTracker.SetCallLevel(localLevel); data.Writeable.WriteableChangeTracker.SetConnectionType(TrackerConnectionType.MERGE); snapshot.SetMemoryMergeResult(localLevel, structure, data); }