Conversation
VSharp.SILI.Core/PathCondition.fs
Outdated
| let condConsts = discoverConstants [cond] |> PersistentSet.ofSeq | ||
| let pufWithNewConsts = | ||
| condConsts | ||
| |> PersistentSet.filter (fun t -> None = PersistentUnionFind.tryFind t pc.constants) | ||
| |> PersistentSet.fold PersistentUnionFind.add pc.constants | ||
| let constsWithSources = | ||
| Seq.map | ||
| (function | ||
| | ConstantT(_, src, _) as constant -> constant, src | ||
| | _ -> __unreachable__() | ||
| ) | ||
| // Merge sets of constants dependent in terms of ISymbolicConstantSource | ||
| let pufMergedByConstantSource = | ||
| Seq.allPairs | ||
| (condConsts |> PersistentSet.toSeq |> constsWithSources) | ||
| (pc.constants |> PersistentUnionFind.toSeq |> constsWithSources) | ||
| |> Seq.filter (fun ((_, src1), (_, src2)) -> not <| src1.IndependentWith src2) | ||
| |> Seq.fold (fun puf ((const1, _), (const2, _)) -> PersistentUnionFind.union const1 const2 puf) pufWithNewConsts | ||
| (* | ||
| Merge sets of constants dependent in terms of reachability in graph where | ||
| edge between constants means that they are contained in the same condition | ||
| *) | ||
| let pufMergedByDependentCondition = | ||
| condConsts | ||
| |> someSetElement | ||
| |> function | ||
| | Some(parent) -> | ||
| PersistentSet.fold (fun puf t -> PersistentUnionFind.union t parent puf) pufMergedByConstantSource condConsts | ||
| | None -> pufMergedByConstantSource | ||
| {constants = pufMergedByDependentCondition | ||
| conditionsWithConstants = | ||
| condConsts | ||
| |> someSetElement | ||
| |> (fun head -> PersistentDict.add cond head pc.conditionsWithConstants)} |
There was a problem hiding this comment.
Лучше это выделить в отдельную функцию
VSharp.SILI.Core/Memory.fs
Outdated
| |> function | ||
| | Some(fragment) -> fragment | ||
| | None -> pc |
There was a problem hiding this comment.
Вероятно, Option.defaultValue здесь будет лучше смотреться
VSharp.SILI.Core/PathCondition.fs
Outdated
| let constsWithSources = | ||
| Seq.map | ||
| (function | ||
| | ConstantT(_, src, _) as constant -> constant, src | ||
| | _ -> __unreachable__() | ||
| ) | ||
| // Merge sets of constants dependent in terms of ISymbolicConstantSource | ||
| let pufMergedByConstantSource = | ||
| Seq.allPairs | ||
| (condConsts |> PersistentSet.toSeq |> constsWithSources) | ||
| (pc.constants |> PersistentUnionFind.toSeq |> constsWithSources) | ||
| |> Seq.filter (fun ((_, src1), (_, src2)) -> not <| src1.IndependentWith src2) |
There was a problem hiding this comment.
Source из константы не нужен в последствии, поэтому вместо создания последовательности из пар (константа, source), стоит объявить функцию, которая будет принимать пару конастант и сравнивать их source
VSharp.SILI.Core/PathCondition.fs
Outdated
| pc.conditionsWithConstants | ||
| |> PersistentDict.fold groupConditionsByUnionFindParent PersistentDict.empty | ||
| |> PersistentDict.toSeq | ||
| |> Seq.map conditionsGroupToPathCondition No newline at end of file |
There was a problem hiding this comment.
Стоит добавить пустую строчку, чтобы гит не ругался
VSharp.SILI.Core/PathCondition.fs
Outdated
| |> function | ||
| | Some(someConst) -> PersistentUnionFind.tryFind someConst pc.constants | ||
| | None -> None |
There was a problem hiding this comment.
Тут можно использовать Option.bind
VSharp.Utils/PersistentUnionFind.fs
Outdated
| traverse unwrappedNext updatedDict | ||
| else updatedDict | ||
| let subsetElements = traverse a PersistentDict.empty | ||
| {elements = subsetElements} No newline at end of file |
There was a problem hiding this comment.
Нужно добавить пустую строчку в конец файла
| else HeapRef (Constant "this" {baseSource = {key = ThisKey m; time = Some VectorTime.zero}} AddressType) declaringType | ||
|
|
||
| let fillWithParametersAndThis state (method : System.Reflection.MethodBase) = | ||
| let parameters = method.GetParameters() |> Seq.map (fun param -> |
There was a problem hiding this comment.
В этом месте не уверен по поводу того, нужно ли вместе с параметрами добавить что-то в allocatedTypes у state
|
Сломалась версия runtime, пофикшу |
| // |> Seq.filter (fun atom -> z3Model.Eval(atom, false).IsTrue) | ||
| // |> Seq.map (fun atom -> paths.[atom]) | ||
| SmtSat { mdl = model; usedPaths = [](*usedPaths*) } | ||
| builder.ClearT2E() |
There was a problem hiding this comment.
Немного напрягло, что пришлось чистить кэш (иначе в модель попадали лишние константы из кэша)
|
Перенесено в общий пуллреквест с оптимизациями |
No description provided.