/// <summary> /// Processes the root indexes. This is the beginning of an computation which creates the root node from given sets of indexes. /// Used to collect all data from aliased locations. /// </summary> /// <param name="mustIndexes">The must indexes.</param> /// <param name="mayIndexes">The may indexes.</param> /// <param name="values">The values.</param> public void ProcessRootIndexes(HashSet <MemoryIndex> mustIndexes, HashSet <MemoryIndex> mayIndexes, IEnumerable <Value> values) { RootNode = new MemoryEntryCollectorNode(); RootNode.SourceIndexes = new List <SourceIndex>(); RootNode.IsMust = true; foreach (MemoryIndex index in mustIndexes) { RootNode.SourceIndexes.Add(new SourceIndex(index, Snapshot)); RootNode.CollectAliases(index, Snapshot, true); } foreach (MemoryIndex index in mayIndexes) { RootNode.SourceIndexes.Add(new SourceIndex(index, Snapshot)); RootNode.CollectAliases(index, Snapshot, false); } RootNode.CollectValuesFromSources(this); RootNode.VisitValues(values); RootNode.CollectChildren(this); processQueue(); RootMemoryEntry = RootNode.GenerateMemeoryEntry(values); }
/// <summary> /// Processes the root memory entry. This is the beginning of an computation which creates the root node from given memory entry. /// </summary> /// <param name="entry">The entry.</param> public void ProcessRootMemoryEntry(MemoryEntry entry) { RootNode = new MemoryEntryCollectorNode(); RootNode.IsMust = true; RootNode.CollectValuesFromMemoryEntry(entry); RootNode.CollectChildren(this); processQueue(); RootMemoryEntry = entry; }
/// <summary> /// Process all nodes stored in the queue to build the tree. /// </summary> private void processQueue() { while (collectingQueue.Count > 0) { MemoryEntryCollectorNode node = collectingQueue.First.Value; collectingQueue.RemoveFirst(); node.CollectAliasesFromSources(this); node.CollectValuesFromSources(this); node.CollectChildren(this); } }