|
Static Value-Flow Analysis
|
#include <MTASVFGBuilder.h>
Classes | |
| class | ThreadVFBuildConfig |
| struct | ThreadVFCandidate |
Public Types | |
| enum class | InterferenceEdgeMode { Analysis , SlicingOnly } |
| typedef Set< const StmtSVFGNode * > | SVFGNodeSet |
| typedef NodeBS | SVFGNodeIDSet |
| typedef std::pair< const StmtSVFGNode *, const StmtSVFGNode * > | ThreadVFEdge |
| using | ThreadVFQueryMap = Map< ThreadVFEdge, Set< const ICFGNode * > > |
| using | ThreadVFCandidateList = std::vector< ThreadVFCandidate > |
Public Types inherited from SVF::SVFGBuilder | |
| typedef PointerAnalysis::CallSiteSet | CallSiteSet |
| typedef PointerAnalysis::CallEdgeMap | CallEdgeMap |
| typedef PointerAnalysis::FunctionSet | FunctionSet |
| typedef SVFG::SVFGEdgeSetTy | SVFGEdgeSet |
Protected Member Functions | |
| void | buildSVFG () override |
| Rewrite the SVFG build hook: build the stock SVFG, then add MHP edges. | |
| std::unique_ptr< MRGenerator > | createMRGenerator (BVDataPTAImpl *pta, bool ptrOnlyMSSA) override |
Protected Member Functions inherited from SVF::SVFGBuilder | |
| SVFG * | build (BVDataPTAImpl *pta, VFG::VFGK kind) |
| Create a DDA SVFG. By default actualOut and FormalIN are removed, unless withAOFI is set true. | |
| virtual void | releaseMemory () |
| Release global SVFG. | |
Private Attributes | |
| const SlicedSVFGView * | overlayScope = nullptr |
| Active overlay configuration; defaults suit VFG_pre. | |
| const ThreadVFCandidateList * | overlayCandidates = nullptr |
| bool | recordThreadVFQueries = true |
| false = skip [THREAD-VF] recording | |
| bool | labelInterferenceEdges = true |
| false = VFG_pre (sliced-only): omit edge points-to labels | |
| SVFGNodeSet | storeNodes |
| SVFGNodeSet | loadNodes |
| ThreadVFQueryMap | threadVFQueryMap |
| [THREAD-VF] per-edge query map (see getThreadVFQueryMap). | |
| MHP * | mhp |
| LockAnalysis * | lockAnalysis |
| Map< const StmtSVFGNode *, SVFGNodeIDSet > | predecessorCache |
| Map< const StmtSVFGNode *, SVFGNodeIDSet > | successorCache |
| Map< const StmtSVFGNode *, bool > | spanHeadCache |
| Map< const StmtSVFGNode *, bool > | spanTailCache |
| SVFGEdgeSet | threadAwareEdges |
Additional Inherited Members | |
Protected Attributes inherited from SVF::SVFGBuilder | |
| SVFGEdgeSet | vfEdgesAtIndCallSite |
| SVFG Edges connected at indirect call/ret sites. | |
| std::unique_ptr< SVFG > | svfg |
| bool | SVFGWithIndCall |
| SVFG with precomputed indirect call edges. | |
| bool | SVFGWithPostOpts |
| Build optimised version of SVFG. | |
Definition at line 46 of file MTASVFGBuilder.h.
Definition at line 50 of file MTASVFGBuilder.h.
Definition at line 49 of file MTASVFGBuilder.h.
| using SVF::MTASVFGBuilder::ThreadVFCandidateList = std::vector<ThreadVFCandidate> |
Definition at line 116 of file MTASVFGBuilder.h.
| typedef std::pair<const StmtSVFGNode*, const StmtSVFGNode*> SVF::MTASVFGBuilder::ThreadVFEdge |
A candidate thread-aware value-flow edge s –o--> s' (src store, dst load/store), keyed by its endpoint SVFG nodes.
Definition at line 70 of file MTASVFGBuilder.h.
[THREAD-VF] per-edge query map (MSli §4.2, Fig. 6 rule [THREAD-VF]).
While building VFG_pre we record, for every candidate thread-aware value-flow edge (s,s') the construction evaluates, its Query(s –o--> s') set: the endpoints {s,s'} plus — under a common lock — the in-span witnesses Succ_spl(s) / Pred_spl'(s') that decide TL/HD membership, i.e. whether the edge survives the non-interference test (Def. 2). The query is kept per edge (not pre-unioned) so ILA slicing can restrict the sources to the edges that survive the FSPTA slice — ThreadVF(VFG'_pre) — rather than every candidate pair. Feeding the retained edges' queries into ILA slicing makes the sliced MHP/lock reproduce the same value-flow decisions the main phase makes, while keeping the slice minimal.
The value stores only the additional lock-span witnesses; the endpoint ICFG nodes are implicit in the key and consumers must add them back.
Definition at line 87 of file MTASVFGBuilder.h.
| Enumerator | |
|---|---|
| Analysis | Build labelled edges for FSMPTA. |
| SlicingOnly | Build unlabelled connectivity for VFG_pre slicing. |
Definition at line 52 of file MTASVFGBuilder.h.
|
inline |
Constructor: driven by the interleaving (MHP) and lock analyses.
Definition at line 59 of file MTASVFGBuilder.h.
|
overridedefault |
|
private |
Add a FormalOUT -> ActualOUT inter-procedural indirect ret edge for a join, mirroring SVFG::addInterIndirectVFRetEdge using the public SVFG API (points-to intersection + dedup via hasInterVFGEdge + addSVFGEdge).
Mirror of SVFG::addInterIndirectVFRetEdge over the public SVFG API, so the join edges can be added from the builder without modifying core SVFG.
Definition at line 173 of file MTASVFGBuilder.cpp.
Add a thread-MHP indirect value-flow edge srcId -> dstId carrying pts.
Add (or merge into) a thread-MHP indirect value-flow edge src -> dst.
Definition at line 270 of file MTASVFGBuilder.cpp.
|
overrideprotectedvirtual |
Rewrite the SVFG build hook: build the stock SVFG, then add MHP edges.
Build the stock (thread-oblivious) SVFG, add the FSAM join-related def-use edges (relocated out of core SVFG.cpp), then add thread-aware MHP edges.
Reimplemented from SVF::SVFGBuilder.
Definition at line 126 of file MTASVFGBuilder.cpp.
| void MTASVFGBuilder::clearThreadAwareOverlay | ( | ) |
Remove all currently attached thread-aware interference edges.
Definition at line 133 of file MTASVFGBuilder.cpp.
|
private |
Collect the store/load SVFG nodes to pair for interference edges (all of them, or – when a slice is set – only the kept ones).
Collect all store/load SVFG nodes.
Definition at line 242 of file MTASVFGBuilder.cpp.
|
private |
Connect inter-thread (interference) value-flow edges for MHP pairs.
For every MHP store/load and store/store pair, add the thread-aware (interference) value-flow edges.
Definition at line 600 of file MTASVFGBuilder.cpp.
|
private |
FSAM join-related thread-oblivious value flow (the "return" half of treating a join as a call without a forward): connect each start routine's exit defs (FormalOUT) to the ActualOUT at every site that joins it (FormalOUT -> ActualOUT ret edge). Done here as a post-pass over the stock SVFG, so core SVFG.cpp stays unmodified.
FSAM join-related def-use (the "return" half of treating a join as a call without a forward): for every FormalOUT (a start routine's exit def), connect it to the ActualOUT at each site that joins that routine. Relocated here from core SVFG::connectIndirectSVFGEdges so the stock SVFG stays unmodified.
Definition at line 204 of file MTASVFGBuilder.cpp.
|
overrideprotectedvirtual |
Inject a thread-aware MRGenerator so the MemSSA mod-ref carries the FSAM fork/join side effects (relocated here from core MemRegion).
Reimplemented from SVF::SVFGBuilder.
Definition at line 106 of file MTASVFGBuilder.cpp.
|
private |
Lock-span head/tail tests (non-interference lock-pair pruning).
Backward reachable store SVFG nodes via indirect value flow (lock-span head test).
Definition at line 313 of file MTASVFGBuilder.cpp.
|
private |
Forward reachable store/load SVFG nodes via indirect value flow (lock-span tail test).
Definition at line 360 of file MTASVFGBuilder.cpp.
|
inline |
Definition at line 157 of file MTASVFGBuilder.h.
|
inline |
Definition at line 88 of file MTASVFGBuilder.h.
|
private |
Store -> Load interference: add a thread-aware def-use edge if the store may happen in parallel with and may alias the load, unless excluded by a common lock (then only when the store is a span tail and the load a span head).
Definition at line 507 of file MTASVFGBuilder.cpp.
|
private |
Store -> Store interference (symmetric): add thread-aware def-use edges in both directions, with the same lock-span pruning as store/load.
Definition at line 553 of file MTASVFGBuilder.cpp.
|
private |
Whether, for all lock spans n belongs to, n is the first write (span head).
Definition at line 407 of file MTASVFGBuilder.cpp.
Definition at line 262 of file MTASVFGBuilder.cpp.
|
private |
Whether, for all lock spans n belongs to, n is the last write (span tail).
Definition at line 431 of file MTASVFGBuilder.cpp.
|
private |
Record the [THREAD-VF] slicing sources for one candidate pair s –o--> s' (source = store, destination = load/store). Adds the endpoints, and — when the pair is protected by a common lock — the in-span successor/predecessor witnesses needed to re-decide the non-interference (tail/head) test.
Record the per-edge [THREAD-VF] query for one candidate pair s –o--> s' (see getThreadVFQueryMap for the rule): the endpoints, plus – under a common lock – the in-span Succ_spl(s) / Pred_spl'(s') witnesses. Enumerated fully (the tail/head boolean tests short-circuit; source extraction must not).
Definition at line 465 of file MTASVFGBuilder.cpp.
| void MTASVFGBuilder::replaceThreadAwareOverlay | ( | MHP * | mhp, |
| LockAnalysis * | lockAnalysis, | ||
| const ThreadVFBuildConfig & | config | ||
| ) |
Replace only the ILA-dependent thread-aware overlay. The underlying MemorySSA, stock SVFG, and fork/join value flow remain unchanged.
Definition at line 140 of file MTASVFGBuilder.cpp.
false = VFG_pre (sliced-only): omit edge points-to labels
Definition at line 175 of file MTASVFGBuilder.h.
|
private |
Definition at line 225 of file MTASVFGBuilder.h.
|
private |
Definition at line 230 of file MTASVFGBuilder.h.
|
private |
Definition at line 229 of file MTASVFGBuilder.h.
|
private |
Definition at line 173 of file MTASVFGBuilder.h.
|
private |
Active overlay configuration; defaults suit VFG_pre.
null = whole base SVFG
Definition at line 172 of file MTASVFGBuilder.h.
|
private |
Definition at line 232 of file MTASVFGBuilder.h.
false = skip [THREAD-VF] recording
Definition at line 174 of file MTASVFGBuilder.h.
|
private |
Definition at line 234 of file MTASVFGBuilder.h.
|
private |
Definition at line 235 of file MTASVFGBuilder.h.
|
private |
Definition at line 224 of file MTASVFGBuilder.h.
|
private |
Definition at line 233 of file MTASVFGBuilder.h.
|
private |
Definition at line 236 of file MTASVFGBuilder.h.
|
private |
[THREAD-VF] per-edge query map (see getThreadVFQueryMap).
Definition at line 228 of file MTASVFGBuilder.h.