svf-lib 1.0.2078 → 1.0.2080
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SVF-linux/Release-build/bin/ae +0 -0
- package/SVF-linux/Release-build/bin/cfl +0 -0
- package/SVF-linux/Release-build/bin/dvf +0 -0
- package/SVF-linux/Release-build/bin/llvm2svf +0 -0
- package/SVF-linux/Release-build/bin/mta +0 -0
- package/SVF-linux/Release-build/bin/saber +0 -0
- package/SVF-linux/Release-build/bin/svf-ex +0 -0
- package/SVF-linux/Release-build/bin/wpa +0 -0
- package/SVF-linux/Release-build/include/AE/Svfexe/AbstractInterpretation.h +1 -1
- package/SVF-linux/Release-build/include/DDA/ContextDDA.h +2 -2
- package/SVF-linux/Release-build/include/DDA/DDAVFSolver.h +5 -5
- package/SVF-linux/Release-build/include/DDA/FlowDDA.h +1 -1
- package/SVF-linux/Release-build/include/Graphs/ICFG.h +2 -2
- package/SVF-linux/Release-build/include/Graphs/ThreadCallGraph.h +24 -24
- package/SVF-linux/Release-build/include/Graphs/VFG.h +4 -4
- package/SVF-linux/Release-build/include/MSSA/MemRegion.h +4 -4
- package/SVF-linux/Release-build/include/MTA/LockAnalysis.h +1 -1
- package/SVF-linux/Release-build/include/MTA/MHP.h +2 -2
- package/SVF-linux/Release-build/include/MTA/PCG.h +3 -3
- package/SVF-linux/Release-build/include/MTA/TCT.h +7 -7
- package/SVF-linux/Release-build/include/MemoryModel/PointerAnalysis.h +13 -13
- package/SVF-linux/Release-build/include/SABER/SaberSVFGBuilder.h +1 -1
- package/SVF-linux/Release-build/include/SABER/SrcSnkDDA.h +7 -7
- package/SVF-linux/Release-build/include/SVF-LLVM/SVFIRBuilder.h +1 -1
- package/SVF-linux/Release-build/include/Util/CallGraphBuilder.h +5 -5
- package/SVF-linux/Release-build/lib/libSvfCore.a +0 -0
- package/SVF-linux/Release-build/lib/libSvfLLVM.a +0 -0
- package/SVF-osx/Release-build/bin/ae +0 -0
- package/SVF-osx/Release-build/bin/cfl +0 -0
- package/SVF-osx/Release-build/bin/dvf +0 -0
- package/SVF-osx/Release-build/bin/llvm2svf +0 -0
- package/SVF-osx/Release-build/bin/mta +0 -0
- package/SVF-osx/Release-build/bin/saber +0 -0
- package/SVF-osx/Release-build/bin/svf-ex +0 -0
- package/SVF-osx/Release-build/bin/wpa +0 -0
- package/SVF-osx/Release-build/include/AE/Svfexe/AbstractInterpretation.h +1 -1
- package/SVF-osx/Release-build/include/DDA/ContextDDA.h +2 -2
- package/SVF-osx/Release-build/include/DDA/DDAVFSolver.h +5 -5
- package/SVF-osx/Release-build/include/DDA/FlowDDA.h +1 -1
- package/SVF-osx/Release-build/include/Graphs/ICFG.h +2 -2
- package/SVF-osx/Release-build/include/Graphs/ThreadCallGraph.h +24 -30
- package/SVF-osx/Release-build/include/Graphs/VFG.h +4 -4
- package/SVF-osx/Release-build/include/MSSA/MemRegion.h +4 -4
- package/SVF-osx/Release-build/include/MTA/LockAnalysis.h +42 -32
- package/SVF-osx/Release-build/include/MTA/MHP.h +34 -54
- package/SVF-osx/Release-build/include/MTA/MTAStat.h +1 -2
- package/SVF-osx/Release-build/include/MTA/TCT.h +43 -25
- package/SVF-osx/Release-build/include/MemoryModel/PointerAnalysis.h +13 -13
- package/SVF-osx/Release-build/include/SABER/SaberSVFGBuilder.h +1 -1
- package/SVF-osx/Release-build/include/SABER/SrcSnkDDA.h +7 -7
- package/SVF-osx/Release-build/include/SVF-LLVM/SVFIRBuilder.h +1 -1
- package/SVF-osx/Release-build/include/Util/CallGraphBuilder.h +5 -5
- package/SVF-osx/Release-build/include/Util/CxtStmt.h +13 -12
- package/SVF-osx/Release-build/include/Util/Options.h +1 -20
- package/SVF-osx/Release-build/include/Util/SVFUtil.h +8 -43
- package/SVF-osx/Release-build/include/Util/ThreadAPI.h +42 -85
- package/SVF-osx/Release-build/lib/libSvfCore.a +0 -0
- package/SVF-osx/Release-build/lib/libSvfLLVM.a +0 -0
- package/package.json +1 -1
- package/SVF-osx/Release-build/include/MTA/FSMPTA.h +0 -270
- package/SVF-osx/Release-build/include/MTA/MTAResultValidator.h +0 -448
- package/SVF-osx/Release-build/include/MTA/PCG.h +0 -229
- /package/{SVF-osx → SVF-linux}/Release-build/include/Graphs/PTACallGraph.h +0 -0
- /package/{SVF-linux → SVF-osx}/Release-build/include/Graphs/CallGraph.h +0 -0
|
@@ -133,8 +133,8 @@ public:
|
|
|
133
133
|
/// Whether call/return inside recursion
|
|
134
134
|
inline virtual bool isEdgeInRecursion(CallSiteID csId)
|
|
135
135
|
{
|
|
136
|
-
const SVFFunction* caller =
|
|
137
|
-
const SVFFunction* callee =
|
|
136
|
+
const SVFFunction* caller = getCallGraph()->getCallerOfCallSite(csId);
|
|
137
|
+
const SVFFunction* callee = getCallGraph()->getCalleeOfCallSite(csId);
|
|
138
138
|
return inSameCallGraphSCC(caller, callee);
|
|
139
139
|
}
|
|
140
140
|
/// Update call graph.
|
|
@@ -49,8 +49,8 @@ class DDAVFSolver
|
|
|
49
49
|
friend class DDAStat;
|
|
50
50
|
public:
|
|
51
51
|
typedef SCCDetection<SVFG*> SVFGSCC;
|
|
52
|
-
typedef SCCDetection<
|
|
53
|
-
typedef
|
|
52
|
+
typedef SCCDetection<CallGraph*> CallGraphSCC;
|
|
53
|
+
typedef CallGraphEdge::CallInstSet CallInstSet;
|
|
54
54
|
typedef SVFIR::CallSiteSet CallSiteSet;
|
|
55
55
|
typedef OrderedSet<DPIm> DPTItemSet;
|
|
56
56
|
typedef OrderedMap<DPIm, CPtSet> DPImToCPtSetMap;
|
|
@@ -505,7 +505,7 @@ protected:
|
|
|
505
505
|
{
|
|
506
506
|
CallInstSet csSet;
|
|
507
507
|
/// use pre-analysis call graph to approximate all potential callsites
|
|
508
|
-
_ander->
|
|
508
|
+
_ander->getCallGraph()->getIndCallSitesInvokingCallee(fun,csSet);
|
|
509
509
|
for(CallInstSet::const_iterator it = csSet.begin(), eit = csSet.end(); it!=eit; ++it)
|
|
510
510
|
{
|
|
511
511
|
NodeID funPtr = _pag->getFunPtr(*it);
|
|
@@ -624,7 +624,7 @@ protected:
|
|
|
624
624
|
return (getSVFGSCCRepNode(edge->getSrcID()) == getSVFGSCCRepNode(edge->getDstID()));
|
|
625
625
|
}
|
|
626
626
|
/// Set callgraph
|
|
627
|
-
inline void setCallGraph (
|
|
627
|
+
inline void setCallGraph (CallGraph* cg)
|
|
628
628
|
{
|
|
629
629
|
_callGraph = cg;
|
|
630
630
|
}
|
|
@@ -775,7 +775,7 @@ protected:
|
|
|
775
775
|
SVFG* _svfg; ///< SVFG
|
|
776
776
|
AndersenWaveDiff* _ander; ///< Andersen's analysis
|
|
777
777
|
NodeBS candidateQueries; ///< candidate pointers;
|
|
778
|
-
|
|
778
|
+
CallGraph* _callGraph; ///< CallGraph
|
|
779
779
|
CallGraphSCC* _callGraphSCC; ///< SCC for CallGraph
|
|
780
780
|
SVFGSCC* _svfgSCC; ///< SCC for SVFG
|
|
781
781
|
DPTItemSet backwardVisited; ///< visited map during backward traversing
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
namespace SVF
|
|
39
39
|
{
|
|
40
40
|
|
|
41
|
-
class
|
|
41
|
+
class CallGraph;
|
|
42
42
|
|
|
43
43
|
/*!
|
|
44
44
|
* Interprocedural Control-Flow Graph (ICFG)
|
|
@@ -117,7 +117,7 @@ public:
|
|
|
117
117
|
void view();
|
|
118
118
|
|
|
119
119
|
/// update ICFG for indirect calls
|
|
120
|
-
void updateCallGraph(
|
|
120
|
+
void updateCallGraph(CallGraph* callgraph);
|
|
121
121
|
|
|
122
122
|
/// Whether node is in a loop
|
|
123
123
|
inline bool isInLoop(const ICFGNode *node)
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
#ifndef RCG_H_
|
|
31
31
|
#define RCG_H_
|
|
32
32
|
|
|
33
|
-
#include "Graphs/
|
|
33
|
+
#include "Graphs/CallGraph.h"
|
|
34
34
|
#include "MemoryModel/PointerAnalysisImpl.h"
|
|
35
35
|
|
|
36
36
|
namespace SVF
|
|
@@ -41,13 +41,13 @@ class ThreadAPI;
|
|
|
41
41
|
/*!
|
|
42
42
|
* PTA thread fork edge from fork site to the entry of a start routine function
|
|
43
43
|
*/
|
|
44
|
-
class ThreadForkEdge: public
|
|
44
|
+
class ThreadForkEdge: public CallGraphEdge
|
|
45
45
|
{
|
|
46
46
|
|
|
47
47
|
public:
|
|
48
48
|
/// Constructor
|
|
49
|
-
ThreadForkEdge(
|
|
50
|
-
|
|
49
|
+
ThreadForkEdge(CallGraphNode* s, CallGraphNode* d, CallSiteID csId) :
|
|
50
|
+
CallGraphEdge(s, d, CallGraphEdge::TDForkEdge, csId)
|
|
51
51
|
{
|
|
52
52
|
}
|
|
53
53
|
/// Destructor
|
|
@@ -61,9 +61,9 @@ public:
|
|
|
61
61
|
{
|
|
62
62
|
return true;
|
|
63
63
|
}
|
|
64
|
-
static inline bool classof(const
|
|
64
|
+
static inline bool classof(const CallGraphEdge *edge)
|
|
65
65
|
{
|
|
66
|
-
return edge->getEdgeKind() ==
|
|
66
|
+
return edge->getEdgeKind() == CallGraphEdge::TDForkEdge;
|
|
67
67
|
}
|
|
68
68
|
//@}
|
|
69
69
|
|
|
@@ -78,19 +78,19 @@ public:
|
|
|
78
78
|
return rawstr.str();
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
typedef GenericNode<
|
|
81
|
+
typedef GenericNode<CallGraphNode, ThreadForkEdge>::GEdgeSetTy ForkEdgeSet;
|
|
82
82
|
};
|
|
83
83
|
|
|
84
84
|
/*!
|
|
85
85
|
* PTA thread join edge from the exit of a start routine function to a join point of the thread
|
|
86
86
|
*/
|
|
87
|
-
class ThreadJoinEdge: public
|
|
87
|
+
class ThreadJoinEdge: public CallGraphEdge
|
|
88
88
|
{
|
|
89
89
|
|
|
90
90
|
public:
|
|
91
91
|
/// Constructor
|
|
92
|
-
ThreadJoinEdge(
|
|
93
|
-
|
|
92
|
+
ThreadJoinEdge(CallGraphNode* s, CallGraphNode* d, CallSiteID csId) :
|
|
93
|
+
CallGraphEdge(s, d, CallGraphEdge::TDJoinEdge, csId)
|
|
94
94
|
{
|
|
95
95
|
}
|
|
96
96
|
/// Destructor
|
|
@@ -102,9 +102,9 @@ public:
|
|
|
102
102
|
{
|
|
103
103
|
return true;
|
|
104
104
|
}
|
|
105
|
-
static inline bool classof(const
|
|
105
|
+
static inline bool classof(const CallGraphEdge *edge)
|
|
106
106
|
{
|
|
107
|
-
return edge->getEdgeKind() ==
|
|
107
|
+
return edge->getEdgeKind() == CallGraphEdge::TDJoinEdge;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
virtual const std::string toString() const
|
|
@@ -118,19 +118,19 @@ public:
|
|
|
118
118
|
return rawstr.str();
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
typedef GenericNode<
|
|
121
|
+
typedef GenericNode<CallGraphNode, ThreadJoinEdge>::GEdgeSetTy JoinEdgeSet;
|
|
122
122
|
};
|
|
123
123
|
|
|
124
124
|
/*!
|
|
125
125
|
* hare_parallel_for edge from fork site to the entry of a start routine function
|
|
126
126
|
*/
|
|
127
|
-
class HareParForEdge: public
|
|
127
|
+
class HareParForEdge: public CallGraphEdge
|
|
128
128
|
{
|
|
129
129
|
|
|
130
130
|
public:
|
|
131
131
|
/// Constructor
|
|
132
|
-
HareParForEdge(
|
|
133
|
-
|
|
132
|
+
HareParForEdge(CallGraphNode* s, CallGraphNode* d, CallSiteID csId) :
|
|
133
|
+
CallGraphEdge(s, d, CallGraphEdge::HareParForEdge, csId)
|
|
134
134
|
{
|
|
135
135
|
}
|
|
136
136
|
/// Destructor
|
|
@@ -144,20 +144,20 @@ public:
|
|
|
144
144
|
{
|
|
145
145
|
return true;
|
|
146
146
|
}
|
|
147
|
-
static inline bool classof(const
|
|
147
|
+
static inline bool classof(const CallGraphEdge *edge)
|
|
148
148
|
{
|
|
149
|
-
return edge->getEdgeKind() ==
|
|
149
|
+
return edge->getEdgeKind() == CallGraphEdge::HareParForEdge;
|
|
150
150
|
}
|
|
151
151
|
//@}
|
|
152
152
|
|
|
153
|
-
typedef GenericNode<
|
|
153
|
+
typedef GenericNode<CallGraphNode, HareParForEdge>::GEdgeSetTy ParForEdgeSet;
|
|
154
154
|
};
|
|
155
155
|
|
|
156
156
|
|
|
157
157
|
/*!
|
|
158
158
|
* Thread sensitive call graph
|
|
159
159
|
*/
|
|
160
|
-
class ThreadCallGraph: public
|
|
160
|
+
class ThreadCallGraph: public CallGraph
|
|
161
161
|
{
|
|
162
162
|
|
|
163
163
|
public:
|
|
@@ -186,9 +186,9 @@ public:
|
|
|
186
186
|
{
|
|
187
187
|
return true;
|
|
188
188
|
}
|
|
189
|
-
static inline bool classof(const
|
|
189
|
+
static inline bool classof(const CallGraph *g)
|
|
190
190
|
{
|
|
191
|
-
return g->getKind() ==
|
|
191
|
+
return g->getKind() == CallGraph::ThdCallGraph;
|
|
192
192
|
}
|
|
193
193
|
//@}
|
|
194
194
|
|
|
@@ -237,7 +237,7 @@ public:
|
|
|
237
237
|
assert(it != callinstToThreadJoinEdgesMap.end() && "call instruction does not have a valid callee");
|
|
238
238
|
return it->second.end();
|
|
239
239
|
}
|
|
240
|
-
inline void getJoinSites(const
|
|
240
|
+
inline void getJoinSites(const CallGraphNode* routine, InstSet& csSet)
|
|
241
241
|
{
|
|
242
242
|
for(CallInstToJoinEdgesMap::const_iterator it = callinstToThreadJoinEdgesMap.begin(), eit = callinstToThreadJoinEdgesMap.end(); it!=eit; ++it)
|
|
243
243
|
{
|
|
@@ -356,12 +356,6 @@ public:
|
|
|
356
356
|
void addDirectJoinEdge(const CallICFGNode* cs,const CallSiteSet& forksite);
|
|
357
357
|
//@}
|
|
358
358
|
|
|
359
|
-
/// Add direct/indirect parallel for edges
|
|
360
|
-
//@{
|
|
361
|
-
void addDirectParForEdge(const CallICFGNode* cs);
|
|
362
|
-
void addIndirectParForEdge(const CallICFGNode* cs, const SVFFunction* callee);
|
|
363
|
-
//@}
|
|
364
|
-
|
|
365
359
|
|
|
366
360
|
/// map call instruction to its CallGraphEdge map
|
|
367
361
|
inline void addThreadForkEdgeSetMap(const CallICFGNode* cs, ThreadForkEdge* edge)
|
|
@@ -394,7 +388,7 @@ public:
|
|
|
394
388
|
}
|
|
395
389
|
|
|
396
390
|
/// has thread join edge
|
|
397
|
-
inline ThreadJoinEdge* hasThreadJoinEdge(const CallICFGNode* call,
|
|
391
|
+
inline ThreadJoinEdge* hasThreadJoinEdge(const CallICFGNode* call, CallGraphNode* joinFunNode, CallGraphNode* threadRoutineFunNode, CallSiteID csId) const
|
|
398
392
|
{
|
|
399
393
|
ThreadJoinEdge joinEdge(joinFunNode,threadRoutineFunNode, csId);
|
|
400
394
|
CallInstToJoinEdgesMap::const_iterator it = callinstToThreadJoinEdgesMap.find(call);
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
#include "SVFIR/SVFIR.h"
|
|
35
|
-
#include "Graphs/
|
|
35
|
+
#include "Graphs/CallGraph.h"
|
|
36
36
|
#include "Graphs/VFGNode.h"
|
|
37
37
|
#include "Graphs/VFGEdge.h"
|
|
38
38
|
|
|
@@ -100,7 +100,7 @@ protected:
|
|
|
100
100
|
FunToVFGNodesMapTy funToVFGNodesMap; ///< map a function to its VFGNodes;
|
|
101
101
|
|
|
102
102
|
GlobalVFGNodeSet globalVFGNodes; ///< set of global store VFG nodes
|
|
103
|
-
|
|
103
|
+
CallGraph* callgraph;
|
|
104
104
|
SVFIR* pag;
|
|
105
105
|
VFGK kind;
|
|
106
106
|
|
|
@@ -109,7 +109,7 @@ protected:
|
|
|
109
109
|
|
|
110
110
|
public:
|
|
111
111
|
/// Constructor
|
|
112
|
-
VFG(
|
|
112
|
+
VFG(CallGraph* callgraph, VFGK k = FULLSVFG);
|
|
113
113
|
|
|
114
114
|
/// Destructor
|
|
115
115
|
virtual ~VFG()
|
|
@@ -136,7 +136,7 @@ public:
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
/// Return CallGraph
|
|
139
|
-
inline
|
|
139
|
+
inline CallGraph* getCallGraph() const
|
|
140
140
|
{
|
|
141
141
|
return callgraph;
|
|
142
142
|
}
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
#define MEMORYREGION_H_
|
|
36
36
|
|
|
37
37
|
#include "Graphs/ICFG.h"
|
|
38
|
-
#include "Graphs/
|
|
38
|
+
#include "Graphs/CallGraph.h"
|
|
39
39
|
#include "Graphs/SCC.h"
|
|
40
40
|
#include "SVFIR/SVFIR.h"
|
|
41
41
|
#include "Util/WorkList.h"
|
|
@@ -175,7 +175,7 @@ public:
|
|
|
175
175
|
/// SVFIR edge list
|
|
176
176
|
typedef SVFIR::SVFStmtList SVFStmtList;
|
|
177
177
|
/// Call Graph SCC
|
|
178
|
-
typedef SCCDetection<
|
|
178
|
+
typedef SCCDetection<CallGraph*> SCC;
|
|
179
179
|
|
|
180
180
|
MRSet& getMRSet()
|
|
181
181
|
{
|
|
@@ -196,7 +196,7 @@ private:
|
|
|
196
196
|
|
|
197
197
|
BVDataPTAImpl* pta;
|
|
198
198
|
SCC* callGraphSCC;
|
|
199
|
-
|
|
199
|
+
CallGraph* callGraph;
|
|
200
200
|
bool ptrOnlyMSSA;
|
|
201
201
|
|
|
202
202
|
/// Map a function to all its memory regions
|
|
@@ -330,7 +330,7 @@ protected:
|
|
|
330
330
|
}
|
|
331
331
|
|
|
332
332
|
/// Mod-Ref analysis for callsite invoking this callGraphNode
|
|
333
|
-
virtual void modRefAnalysis(
|
|
333
|
+
virtual void modRefAnalysis(CallGraphNode* callGraphNode, WorkList& worklist);
|
|
334
334
|
|
|
335
335
|
/// Get Mod-Ref of a callee function
|
|
336
336
|
virtual bool handleCallsiteModRef(NodeBS& mod, NodeBS& ref, const CallICFGNode* cs, const SVFFunction* fun);
|
|
@@ -58,11 +58,11 @@ public:
|
|
|
58
58
|
|
|
59
59
|
typedef NodeBS LockSet;
|
|
60
60
|
typedef TCT::InstVec InstVec;
|
|
61
|
-
typedef Set<const
|
|
61
|
+
typedef Set<const ICFGNode*> InstSet;
|
|
62
62
|
typedef InstSet CISpan;
|
|
63
|
-
typedef Map<const
|
|
63
|
+
typedef Map<const ICFGNode*, CISpan>CILockToSpan;
|
|
64
64
|
typedef Set<const SVFFunction*> FunSet;
|
|
65
|
-
typedef Map<const
|
|
65
|
+
typedef Map<const ICFGNode*, InstSet> InstToInstSetMap;
|
|
66
66
|
typedef Map<CxtStmt, ValDomain> CxtStmtToLockFlagMap;
|
|
67
67
|
typedef FIFOWorkList<CxtStmt> CxtStmtWorkList;
|
|
68
68
|
typedef Set<CxtStmt> LockSpan;
|
|
@@ -71,13 +71,13 @@ public:
|
|
|
71
71
|
|
|
72
72
|
typedef Map<CxtLock, LockSpan> CxtLockToSpan;
|
|
73
73
|
typedef Map<CxtLock, NodeBS> CxtLockToLockSet;
|
|
74
|
-
typedef Map<const
|
|
75
|
-
typedef Map<const
|
|
74
|
+
typedef Map<const ICFGNode*, NodeBS> LockSiteToLockSet;
|
|
75
|
+
typedef Map<const ICFGNode*, LockSpan> InstToCxtStmtSet;
|
|
76
76
|
typedef Map<CxtStmt, CxtLockSet> CxtStmtToCxtLockSet;
|
|
77
77
|
typedef FIFOWorkList<CxtLockProc> CxtLockProcVec;
|
|
78
78
|
typedef Set<CxtLockProc> CxtLockProcSet;
|
|
79
79
|
|
|
80
|
-
typedef Map<const
|
|
80
|
+
typedef Map<const ICFGNode*, CxtStmtSet> InstToCxtStmt;
|
|
81
81
|
|
|
82
82
|
LockAnalysis(TCT* t) : tct(t), lockTime(0),numOfTotalQueries(0), numOfLockedQueries(0), lockQueriesTime(0)
|
|
83
83
|
{
|
|
@@ -88,7 +88,7 @@ public:
|
|
|
88
88
|
/// (2) maps a context-sensitive lock site to its corresponding lock span.
|
|
89
89
|
void analyze();
|
|
90
90
|
void analyzeIntraProcedualLock();
|
|
91
|
-
bool intraForwardTraverse(const
|
|
91
|
+
bool intraForwardTraverse(const ICFGNode* lock, InstSet& unlockset, InstSet& forwardInsts);
|
|
92
92
|
bool intraBackwardTraverse(const InstSet& unlockset, InstSet& backwardInsts);
|
|
93
93
|
|
|
94
94
|
void collectCxtLock();
|
|
@@ -100,14 +100,14 @@ public:
|
|
|
100
100
|
/// Intraprocedural locks
|
|
101
101
|
//@{
|
|
102
102
|
/// Return true if the lock is an intra-procedural lock
|
|
103
|
-
inline bool isIntraLock(const
|
|
103
|
+
inline bool isIntraLock(const ICFGNode* lock) const
|
|
104
104
|
{
|
|
105
105
|
assert(locksites.find(lock)!=locksites.end() && "not a lock site?");
|
|
106
106
|
return ciLocktoSpan.find(lock)!=ciLocktoSpan.end();
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
/// Add intra-procedural lock
|
|
110
|
-
inline void addIntraLock(const
|
|
110
|
+
inline void addIntraLock(const ICFGNode* lockSite, const InstSet& stmts)
|
|
111
111
|
{
|
|
112
112
|
for(InstSet::const_iterator it = stmts.begin(), eit = stmts.end(); it!=eit; ++it)
|
|
113
113
|
{
|
|
@@ -117,7 +117,7 @@ public:
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
/// Add intra-procedural lock
|
|
120
|
-
inline void addCondIntraLock(const
|
|
120
|
+
inline void addCondIntraLock(const ICFGNode* lockSite, const InstSet& stmts)
|
|
121
121
|
{
|
|
122
122
|
for(InstSet::const_iterator it = stmts.begin(), eit = stmts.end(); it!=eit; ++it)
|
|
123
123
|
{
|
|
@@ -126,18 +126,18 @@ public:
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
/// Return true if a statement is inside an intra-procedural lock
|
|
129
|
-
inline bool isInsideIntraLock(const
|
|
129
|
+
inline bool isInsideIntraLock(const ICFGNode* stmt) const
|
|
130
130
|
{
|
|
131
131
|
return instCILocksMap.find(stmt)!=instCILocksMap.end() || isInsideCondIntraLock(stmt);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
/// Return true if a statement is inside a partial lock/unlock pair (conditional lock with unconditional unlock)
|
|
135
|
-
inline bool isInsideCondIntraLock(const
|
|
135
|
+
inline bool isInsideCondIntraLock(const ICFGNode* stmt) const
|
|
136
136
|
{
|
|
137
137
|
return instTocondCILocksMap.find(stmt)!=instTocondCILocksMap.end();
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
inline const InstSet& getIntraLockSet(const
|
|
140
|
+
inline const InstSet& getIntraLockSet(const ICFGNode* stmt) const
|
|
141
141
|
{
|
|
142
142
|
InstToInstSetMap::const_iterator it = instCILocksMap.find(stmt);
|
|
143
143
|
assert(it!=instCILocksMap.end() && "intralock not found!");
|
|
@@ -148,7 +148,7 @@ public:
|
|
|
148
148
|
/// Context-sensitive locks
|
|
149
149
|
//@{
|
|
150
150
|
/// Add inter-procedural context-sensitive lock
|
|
151
|
-
inline void addCxtLock(const CallStrCxt& cxt,const
|
|
151
|
+
inline void addCxtLock(const CallStrCxt& cxt,const ICFGNode* inst)
|
|
152
152
|
{
|
|
153
153
|
CxtLock cxtlock(cxt,inst);
|
|
154
154
|
cxtLockset.insert(cxtlock);
|
|
@@ -200,12 +200,12 @@ public:
|
|
|
200
200
|
/// Context-sensitive statement and lock spans
|
|
201
201
|
//@{
|
|
202
202
|
/// Get LockSet and LockSpan
|
|
203
|
-
inline bool hasCxtStmtfromInst(const
|
|
203
|
+
inline bool hasCxtStmtfromInst(const ICFGNode* inst) const
|
|
204
204
|
{
|
|
205
205
|
InstToCxtStmtSet::const_iterator it = instToCxtStmtSet.find(inst);
|
|
206
206
|
return (it != instToCxtStmtSet.end());
|
|
207
207
|
}
|
|
208
|
-
inline const CxtStmtSet& getCxtStmtfromInst(const
|
|
208
|
+
inline const CxtStmtSet& getCxtStmtfromInst(const ICFGNode* inst) const
|
|
209
209
|
{
|
|
210
210
|
InstToCxtStmtSet::const_iterator it = instToCxtStmtSet.find(inst);
|
|
211
211
|
assert(it != instToCxtStmtSet.end());
|
|
@@ -269,7 +269,7 @@ public:
|
|
|
269
269
|
|
|
270
270
|
|
|
271
271
|
/// Check if one instruction's context stmt is in a lock span
|
|
272
|
-
inline bool hasOneCxtInLockSpan(const
|
|
272
|
+
inline bool hasOneCxtInLockSpan(const ICFGNode *I, LockSpan lspan) const
|
|
273
273
|
{
|
|
274
274
|
if(!hasCxtStmtfromInst(I))
|
|
275
275
|
return false;
|
|
@@ -284,7 +284,7 @@ public:
|
|
|
284
284
|
return false;
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
-
inline bool hasAllCxtInLockSpan(const
|
|
287
|
+
inline bool hasAllCxtInLockSpan(const ICFGNode *I, LockSpan lspan) const
|
|
288
288
|
{
|
|
289
289
|
if(!hasCxtStmtfromInst(I))
|
|
290
290
|
return false;
|
|
@@ -303,15 +303,15 @@ public:
|
|
|
303
303
|
/// Check if two Instructions are protected by common locks
|
|
304
304
|
/// echo inst may have multiple cxt stmt
|
|
305
305
|
/// we check whether every cxt stmt of instructions is protected by a common lock.
|
|
306
|
-
bool isProtectedByCommonLock(const
|
|
307
|
-
bool isProtectedByCommonCxtLock(const
|
|
306
|
+
bool isProtectedByCommonLock(const ICFGNode *i1, const ICFGNode *i2);
|
|
307
|
+
bool isProtectedByCommonCxtLock(const ICFGNode *i1, const ICFGNode *i2);
|
|
308
308
|
bool isProtectedByCommonCxtLock(const CxtStmt& cxtStmt1, const CxtStmt& cxtStmt2);
|
|
309
|
-
bool isProtectedByCommonCILock(const
|
|
309
|
+
bool isProtectedByCommonCILock(const ICFGNode *i1, const ICFGNode *i2);
|
|
310
310
|
|
|
311
|
-
bool isInSameSpan(const
|
|
312
|
-
bool isInSameCSSpan(const
|
|
311
|
+
bool isInSameSpan(const ICFGNode *I1, const ICFGNode *I2);
|
|
312
|
+
bool isInSameCSSpan(const ICFGNode *i1, const ICFGNode *i2) const;
|
|
313
313
|
bool isInSameCSSpan(const CxtStmt& cxtStmt1, const CxtStmt& cxtStmt2) const;
|
|
314
|
-
bool isInSameCISpan(const
|
|
314
|
+
bool isInSameCISpan(const ICFGNode *i1, const ICFGNode *i2) const;
|
|
315
315
|
|
|
316
316
|
inline u32_t getNumOfCxtLocks()
|
|
317
317
|
{
|
|
@@ -339,14 +339,14 @@ private:
|
|
|
339
339
|
void handleIntra(const CxtStmt& cts);
|
|
340
340
|
|
|
341
341
|
/// Handle call relations
|
|
342
|
-
void handleCallRelation(CxtLockProc& clp, const
|
|
342
|
+
void handleCallRelation(CxtLockProc& clp, const CallGraphEdge* cgEdge, CallSite call);
|
|
343
343
|
|
|
344
344
|
/// Return true it a lock matches an unlock
|
|
345
345
|
bool isAliasedLocks(const CxtLock& cl1, const CxtLock& cl2)
|
|
346
346
|
{
|
|
347
347
|
return isAliasedLocks(cl1.getStmt(), cl2.getStmt());
|
|
348
348
|
}
|
|
349
|
-
bool isAliasedLocks(const
|
|
349
|
+
bool isAliasedLocks(const ICFGNode* i1, const ICFGNode* i2)
|
|
350
350
|
{
|
|
351
351
|
/// todo: must alias
|
|
352
352
|
return tct->getPTA()->alias(getLockVal(i1), getLockVal(i2));
|
|
@@ -430,27 +430,37 @@ private:
|
|
|
430
430
|
//@}
|
|
431
431
|
|
|
432
432
|
/// Push calling context
|
|
433
|
-
void pushCxt(CallStrCxt& cxt, const
|
|
433
|
+
void pushCxt(CallStrCxt& cxt, const CallICFGNode* call, const SVFFunction* callee);
|
|
434
434
|
/// Match context
|
|
435
|
-
bool matchCxt(CallStrCxt& cxt, const
|
|
435
|
+
bool matchCxt(CallStrCxt& cxt, const CallICFGNode* call, const SVFFunction* callee);
|
|
436
436
|
|
|
437
437
|
/// Whether it is a lock site
|
|
438
|
-
inline bool isTDFork(const
|
|
438
|
+
inline bool isTDFork(const ICFGNode* call)
|
|
439
439
|
{
|
|
440
440
|
return getTCG()->getThreadAPI()->isTDFork(call);
|
|
441
441
|
}
|
|
442
442
|
/// Whether it is a lock site
|
|
443
|
-
inline bool isTDAcquire(const
|
|
443
|
+
inline bool isTDAcquire(const ICFGNode* call)
|
|
444
444
|
{
|
|
445
445
|
return getTCG()->getThreadAPI()->isTDAcquire(call);
|
|
446
446
|
}
|
|
447
447
|
/// Whether it is a unlock site
|
|
448
|
-
inline bool isTDRelease(const
|
|
448
|
+
inline bool isTDRelease(const ICFGNode* call)
|
|
449
449
|
{
|
|
450
450
|
return getTCG()->getThreadAPI()->isTDRelease(call);
|
|
451
451
|
}
|
|
452
|
+
/// Whether it is a callsite
|
|
453
|
+
inline bool isCallSite(const ICFGNode* inst)
|
|
454
|
+
{
|
|
455
|
+
return tct->isCallSite(inst);
|
|
456
|
+
}
|
|
457
|
+
/// Whether it is calling an external function
|
|
458
|
+
inline bool isExtCall(const ICFGNode* inst)
|
|
459
|
+
{
|
|
460
|
+
return tct->isExtCall(inst);
|
|
461
|
+
}
|
|
452
462
|
/// Get lock value
|
|
453
|
-
inline const SVFValue* getLockVal(const
|
|
463
|
+
inline const SVFValue* getLockVal(const ICFGNode* call)
|
|
454
464
|
{
|
|
455
465
|
return getTCG()->getThreadAPI()->getLockVal(call);
|
|
456
466
|
}
|