svf-lib 1.0.1276 → 1.0.1278
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/lib/libSvf.a +0 -0
- package/SVF-linux/include/Graphs/ConsGNode.h +48 -24
- package/SVF-linux/include/Graphs/GenericGraph.h +4 -2
- package/SVF-linux/include/Graphs/ICFG.h +3 -2
- package/SVF-linux/include/Graphs/SVFGOPT.h +7 -7
- package/SVF-linux/include/Graphs/VFG.h +3 -2
- package/SVF-linux/include/MSSA/MemSSA.h +6 -6
- package/SVF-linux/include/MemoryModel/PersistentPointsToDS.h +1 -1
- package/SVF-linux/include/MemoryModel/SVFIR.h +3 -1
- package/SVF-linux/include/SABER/SaberCondAllocator.h +7 -2
- package/SVF-linux/include/SVF-FE/IRAnnotator.h +3 -1
- package/SVF-linux/include/Util/SparseBitVector.h +2 -0
- package/SVF-osx/Release-build/lib/libSvf.a +0 -0
- package/SVF-osx/include/DDA/DDAVFSolver.h +1 -2
- package/SVF-osx/include/Graphs/ICFG.h +16 -16
- package/SVF-osx/include/Graphs/ICFGEdge.h +6 -6
- package/SVF-osx/include/Graphs/ICFGNode.h +16 -16
- package/SVF-osx/include/Graphs/IRGraph.h +6 -6
- package/SVF-osx/include/Graphs/ThreadCallGraph.h +2 -2
- package/SVF-osx/include/Graphs/VFGNode.h +1 -1
- package/SVF-osx/include/MSSA/MSSAMuChi.h +11 -11
- package/SVF-osx/include/MSSA/MemRegion.h +2 -2
- package/SVF-osx/include/MSSA/MemSSA.h +13 -13
- package/SVF-osx/include/MTA/FSMPTA.h +1 -1
- package/SVF-osx/include/MTA/LockAnalysis.h +33 -33
- package/SVF-osx/include/MTA/LockResultValidator.h +7 -6
- package/SVF-osx/include/MTA/MHP.h +46 -46
- package/SVF-osx/include/MTA/MTA.h +4 -4
- package/SVF-osx/include/MTA/MTAAnnotator.h +6 -4
- package/SVF-osx/include/MTA/MTAResultValidator.h +51 -44
- package/SVF-osx/include/MTA/PCG.h +22 -27
- package/SVF-osx/include/MTA/TCT.h +28 -37
- package/SVF-osx/include/MemoryModel/SVFStatements.h +11 -6
- package/SVF-osx/include/MemoryModel/SVFVariables.h +4 -4
- package/SVF-osx/include/MemoryModel/SymbolTableInfo.h +13 -19
- package/SVF-osx/include/SABER/ProgSlice.h +5 -5
- package/SVF-osx/include/SABER/SaberCheckerAPI.h +4 -4
- package/SVF-osx/include/SABER/SaberCondAllocator.h +32 -35
- package/SVF-osx/include/SVF-FE/BasicTypes.h +10 -0
- package/SVF-osx/include/SVF-FE/CPPUtil.h +9 -8
- package/SVF-osx/include/SVF-FE/DCHG.h +4 -4
- package/SVF-osx/include/SVF-FE/DataFlowUtil.h +1 -1
- package/SVF-osx/include/SVF-FE/GEPTypeBridgeIterator.h +1 -1
- package/SVF-osx/include/SVF-FE/ICFGBuilder.h +9 -9
- package/SVF-osx/include/SVF-FE/IRAnnotator.h +9 -9
- package/SVF-osx/include/SVF-FE/LLVMModule.h +119 -22
- package/SVF-osx/include/SVF-FE/LLVMUtil.h +31 -52
- package/SVF-osx/include/SVF-FE/SVFIRBuilder.h +14 -20
- package/SVF-osx/include/SVF-FE/SymbolTableBuilder.h +8 -8
- package/SVF-osx/include/Util/Annotator.h +22 -22
- package/SVF-osx/include/Util/BasicTypes.h +476 -72
- package/SVF-osx/include/Util/Casting.h +1 -1
- package/SVF-osx/include/Util/CxtStmt.h +13 -12
- package/SVF-osx/include/Util/SVFBasicTypes.h +0 -78
- package/SVF-osx/include/Util/SVFInstruction.h +40 -0
- package/SVF-osx/include/Util/SVFModule.h +58 -124
- package/SVF-osx/include/Util/SVFUtil.h +48 -39
- package/SVF-osx/include/Util/ThreadAPI.h +17 -28
- package/SVF-osx/include/WPA/WPAPass.h +4 -4
- package/package.json +1 -1
|
@@ -182,7 +182,7 @@ public:
|
|
|
182
182
|
|| node->getNodeKind() == Load;
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
inline const
|
|
185
|
+
inline const SVFInstruction* getInst() const
|
|
186
186
|
{
|
|
187
187
|
/// should return a valid instruction unless it is a global PAGEdge
|
|
188
188
|
return pagEdge->getInst();
|
|
@@ -167,12 +167,12 @@ class LoadMU : public MSSAMU<Cond>
|
|
|
167
167
|
|
|
168
168
|
private:
|
|
169
169
|
const LoadStmt* inst;
|
|
170
|
-
const
|
|
170
|
+
const SVFBasicBlock* bb;
|
|
171
171
|
|
|
172
172
|
public:
|
|
173
173
|
/// Constructor/Destructor for MU
|
|
174
174
|
//@{
|
|
175
|
-
LoadMU(const
|
|
175
|
+
LoadMU(const SVFBasicBlock* b,const LoadStmt* i, const MemRegion* m, Cond c = true) :
|
|
176
176
|
MSSAMU<Cond>(MSSAMU<Cond>::LoadMSSAMU,m,c), inst(i), bb(b)
|
|
177
177
|
{
|
|
178
178
|
}
|
|
@@ -189,7 +189,7 @@ public:
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
/// Return basic block
|
|
192
|
-
inline const
|
|
192
|
+
inline const SVFBasicBlock* getBasicBlock() const
|
|
193
193
|
{
|
|
194
194
|
return bb;
|
|
195
195
|
}
|
|
@@ -244,7 +244,7 @@ public:
|
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
/// Return basic block
|
|
247
|
-
inline const
|
|
247
|
+
inline const SVFBasicBlock* getBasicBlock() const
|
|
248
248
|
{
|
|
249
249
|
return callsite->getCallSite()->getParent();
|
|
250
250
|
}
|
|
@@ -461,12 +461,12 @@ template<class Cond>
|
|
|
461
461
|
class StoreCHI : public MSSACHI<Cond>
|
|
462
462
|
{
|
|
463
463
|
private:
|
|
464
|
-
const
|
|
464
|
+
const SVFBasicBlock* bb;
|
|
465
465
|
const StoreStmt* inst;
|
|
466
466
|
public:
|
|
467
467
|
/// Constructors for StoreCHI
|
|
468
468
|
//@{
|
|
469
|
-
StoreCHI(const
|
|
469
|
+
StoreCHI(const SVFBasicBlock* b, const StoreStmt* i, const MemRegion* m, Cond c = true) :
|
|
470
470
|
MSSACHI<Cond>(MSSADEF::StoreMSSACHI,m,c), bb(b), inst(i)
|
|
471
471
|
{
|
|
472
472
|
}
|
|
@@ -476,7 +476,7 @@ public:
|
|
|
476
476
|
//@}
|
|
477
477
|
|
|
478
478
|
/// Get basic block
|
|
479
|
-
inline const
|
|
479
|
+
inline const SVFBasicBlock* getBasicBlock() const
|
|
480
480
|
{
|
|
481
481
|
return bb;
|
|
482
482
|
}
|
|
@@ -535,7 +535,7 @@ public:
|
|
|
535
535
|
//@}
|
|
536
536
|
|
|
537
537
|
/// Return basic block
|
|
538
|
-
inline const
|
|
538
|
+
inline const SVFBasicBlock* getBasicBlock() const
|
|
539
539
|
{
|
|
540
540
|
return callsite->getCallSite()->getParent();
|
|
541
541
|
}
|
|
@@ -632,13 +632,13 @@ class MSSAPHI : public MSSADEF
|
|
|
632
632
|
public:
|
|
633
633
|
typedef Map<u32_t,const MRVer*> OPVers;
|
|
634
634
|
private:
|
|
635
|
-
const
|
|
635
|
+
const SVFBasicBlock* bb;
|
|
636
636
|
OPVers opVers;
|
|
637
637
|
Cond cond;
|
|
638
638
|
public:
|
|
639
639
|
/// Constructors for PHI
|
|
640
640
|
//@{
|
|
641
|
-
MSSAPHI(const
|
|
641
|
+
MSSAPHI(const SVFBasicBlock* b, const MemRegion* m, Cond c = true) :
|
|
642
642
|
MSSADEF(MSSADEF::SSAPHI,m), bb(b), cond(c)
|
|
643
643
|
{
|
|
644
644
|
}
|
|
@@ -681,7 +681,7 @@ public:
|
|
|
681
681
|
//@}
|
|
682
682
|
|
|
683
683
|
/// Return the basic block
|
|
684
|
-
inline const
|
|
684
|
+
inline const SVFBasicBlock* getBasicBlock() const
|
|
685
685
|
{
|
|
686
686
|
return bb;
|
|
687
687
|
}
|
|
@@ -470,9 +470,9 @@ public:
|
|
|
470
470
|
}
|
|
471
471
|
//@}
|
|
472
472
|
/// Whether this instruction has SVFIR Edge
|
|
473
|
-
bool hasSVFStmtList(const
|
|
473
|
+
bool hasSVFStmtList(const SVFInstruction* inst);
|
|
474
474
|
/// Given an instruction, get all its the PAGEdge (statement) in sequence
|
|
475
|
-
SVFStmtList& getPAGEdgesFromInst(const
|
|
475
|
+
SVFStmtList& getPAGEdgesFromInst(const SVFInstruction* inst);
|
|
476
476
|
|
|
477
477
|
/// getModRefInfo APIs
|
|
478
478
|
//@{
|
|
@@ -81,7 +81,7 @@ public:
|
|
|
81
81
|
typedef Map<const StoreStmt*, CHISet> StoreToChiSetMap;
|
|
82
82
|
typedef Map<const CallICFGNode*, MUSet> CallSiteToMUSetMap;
|
|
83
83
|
typedef Map<const CallICFGNode*, CHISet> CallSiteToCHISetMap;
|
|
84
|
-
typedef OrderedMap<const
|
|
84
|
+
typedef OrderedMap<const SVFBasicBlock*, PHISet> BBToPhiSetMap;
|
|
85
85
|
//@}
|
|
86
86
|
|
|
87
87
|
/// Map from fun to its entry chi set and return mu set
|
|
@@ -90,8 +90,8 @@ public:
|
|
|
90
90
|
|
|
91
91
|
/// For phi insertion
|
|
92
92
|
//@{
|
|
93
|
-
typedef std::vector<const
|
|
94
|
-
typedef Map<const
|
|
93
|
+
typedef std::vector<const SVFBasicBlock*> BBList;
|
|
94
|
+
typedef Map<const SVFBasicBlock*, MRSet> BBToMRSetMap;
|
|
95
95
|
typedef Map<const MemRegion*, BBList> MemRegToBBsMap;
|
|
96
96
|
//@}
|
|
97
97
|
|
|
@@ -129,7 +129,7 @@ protected:
|
|
|
129
129
|
/// SSA rename for a function
|
|
130
130
|
virtual void SSARename(const SVFFunction& fun);
|
|
131
131
|
/// SSA rename for a basic block
|
|
132
|
-
virtual void SSARenameBB(const
|
|
132
|
+
virtual void SSARenameBB(const SVFBasicBlock& bb);
|
|
133
133
|
private:
|
|
134
134
|
LoadToMUSetMap load2MuSetMap;
|
|
135
135
|
StoreToChiSetMap store2ChiSetMap;
|
|
@@ -175,7 +175,7 @@ private:
|
|
|
175
175
|
if (0 == varKills.count(mr))
|
|
176
176
|
usedRegs.insert(mr);
|
|
177
177
|
}
|
|
178
|
-
inline void collectRegDefs(const
|
|
178
|
+
inline void collectRegDefs(const SVFBasicBlock* bb, const MemRegion* mr)
|
|
179
179
|
{
|
|
180
180
|
varKills.insert(mr);
|
|
181
181
|
reg2BBMap[mr].push_back(bb);
|
|
@@ -184,12 +184,12 @@ private:
|
|
|
184
184
|
|
|
185
185
|
/// Add methods for mus/chis/phis
|
|
186
186
|
//@{
|
|
187
|
-
inline void AddLoadMU(const
|
|
187
|
+
inline void AddLoadMU(const SVFBasicBlock* bb, const LoadStmt* load, const MRSet& mrSet)
|
|
188
188
|
{
|
|
189
189
|
for (MRSet::iterator iter = mrSet.begin(), eiter = mrSet.end(); iter != eiter; ++iter)
|
|
190
190
|
AddLoadMU(bb,load,*iter);
|
|
191
191
|
}
|
|
192
|
-
inline void AddStoreCHI(const
|
|
192
|
+
inline void AddStoreCHI(const SVFBasicBlock* bb, const StoreStmt* store, const MRSet& mrSet)
|
|
193
193
|
{
|
|
194
194
|
for (MRSet::iterator iter = mrSet.begin(), eiter = mrSet.end(); iter != eiter; ++iter)
|
|
195
195
|
AddStoreCHI(bb,store,*iter);
|
|
@@ -204,18 +204,18 @@ private:
|
|
|
204
204
|
for (MRSet::iterator iter = mrSet.begin(), eiter = mrSet.end(); iter != eiter; ++iter)
|
|
205
205
|
AddCallSiteCHI(cs,*iter);
|
|
206
206
|
}
|
|
207
|
-
inline void AddMSSAPHI(const
|
|
207
|
+
inline void AddMSSAPHI(const SVFBasicBlock* bb, const MRSet& mrSet)
|
|
208
208
|
{
|
|
209
209
|
for (MRSet::iterator iter = mrSet.begin(), eiter = mrSet.end(); iter != eiter; ++iter)
|
|
210
210
|
AddMSSAPHI(bb,*iter);
|
|
211
211
|
}
|
|
212
|
-
inline void AddLoadMU(const
|
|
212
|
+
inline void AddLoadMU(const SVFBasicBlock* bb, const LoadStmt* load, const MemRegion* mr)
|
|
213
213
|
{
|
|
214
214
|
LOADMU* mu = new LOADMU(bb,load, mr);
|
|
215
215
|
load2MuSetMap[load].insert(mu);
|
|
216
216
|
collectRegUses(mr);
|
|
217
217
|
}
|
|
218
|
-
inline void AddStoreCHI(const
|
|
218
|
+
inline void AddStoreCHI(const SVFBasicBlock* bb, const StoreStmt* store, const MemRegion* mr)
|
|
219
219
|
{
|
|
220
220
|
STORECHI* chi = new STORECHI(bb,store, mr);
|
|
221
221
|
store2ChiSetMap[store].insert(chi);
|
|
@@ -235,7 +235,7 @@ private:
|
|
|
235
235
|
collectRegUses(mr);
|
|
236
236
|
collectRegDefs(chi->getBasicBlock(),mr);
|
|
237
237
|
}
|
|
238
|
-
inline void AddMSSAPHI(const
|
|
238
|
+
inline void AddMSSAPHI(const SVFBasicBlock* bb, const MemRegion* mr)
|
|
239
239
|
{
|
|
240
240
|
bb2PhiSetMap[bb].insert(new PHI(bb, mr));
|
|
241
241
|
}
|
|
@@ -392,11 +392,11 @@ public:
|
|
|
392
392
|
{
|
|
393
393
|
return callsiteToChiSetMap[cs];
|
|
394
394
|
}
|
|
395
|
-
inline PHISet& getPHISet(const
|
|
395
|
+
inline PHISet& getPHISet(const SVFBasicBlock* bb)
|
|
396
396
|
{
|
|
397
397
|
return bb2PhiSetMap[bb];
|
|
398
398
|
}
|
|
399
|
-
inline bool hasPHISet(const
|
|
399
|
+
inline bool hasPHISet(const SVFBasicBlock* bb) const
|
|
400
400
|
{
|
|
401
401
|
return bb2PhiSetMap.find(bb)!=bb2PhiSetMap.end();
|
|
402
402
|
}
|
|
@@ -104,7 +104,7 @@ public:
|
|
|
104
104
|
typedef Set<const SVFGNode*> SVFGNodeSet;
|
|
105
105
|
typedef std::vector<const SVFGNode*> SVFGNodeVec;
|
|
106
106
|
typedef NodeBS SVFGNodeIDSet;
|
|
107
|
-
typedef Set<const
|
|
107
|
+
typedef Set<const SVFInstruction*> InstSet;
|
|
108
108
|
typedef std::pair<NodeID,NodeID> NodeIDPair;
|
|
109
109
|
typedef Map<SVFGNodeLockSpan, bool> PairToBoolMap;
|
|
110
110
|
|
|
@@ -59,11 +59,11 @@ public:
|
|
|
59
59
|
|
|
60
60
|
typedef NodeBS LockSet;
|
|
61
61
|
typedef TCT::InstVec InstVec;
|
|
62
|
-
typedef Set<const
|
|
62
|
+
typedef Set<const SVFInstruction*> InstSet;
|
|
63
63
|
typedef InstSet CISpan;
|
|
64
|
-
typedef Map<const
|
|
65
|
-
typedef Set<const
|
|
66
|
-
typedef Map<const
|
|
64
|
+
typedef Map<const SVFInstruction*, CISpan>CILockToSpan;
|
|
65
|
+
typedef Set<const SVFFunction*> FunSet;
|
|
66
|
+
typedef Map<const SVFInstruction*, InstSet> InstToInstSetMap;
|
|
67
67
|
typedef Map<CxtStmt, ValDomain> CxtStmtToLockFlagMap;
|
|
68
68
|
typedef FIFOWorkList<CxtStmt> CxtStmtWorkList;
|
|
69
69
|
typedef Set<CxtStmt> LockSpan;
|
|
@@ -72,13 +72,13 @@ public:
|
|
|
72
72
|
|
|
73
73
|
typedef Map<CxtLock, LockSpan> CxtLockToSpan;
|
|
74
74
|
typedef Map<CxtLock, NodeBS> CxtLockToLockSet;
|
|
75
|
-
typedef Map<const
|
|
76
|
-
typedef Map<const
|
|
75
|
+
typedef Map<const SVFInstruction*, NodeBS> LockSiteToLockSet;
|
|
76
|
+
typedef Map<const SVFInstruction*, LockSpan> InstToCxtStmtSet;
|
|
77
77
|
typedef Map<CxtStmt, CxtLockSet> CxtStmtToCxtLockSet;
|
|
78
78
|
typedef FIFOWorkList<CxtLockProc> CxtLockProcVec;
|
|
79
79
|
typedef Set<CxtLockProc> CxtLockProcSet;
|
|
80
80
|
|
|
81
|
-
typedef Map<const
|
|
81
|
+
typedef Map<const SVFInstruction*, CxtStmtSet> InstToCxtStmt;
|
|
82
82
|
|
|
83
83
|
LockAnalysis(TCT* t) : tct(t), lockTime(0),numOfTotalQueries(0), numOfLockedQueries(0), lockQueriesTime(0)
|
|
84
84
|
{
|
|
@@ -89,7 +89,7 @@ public:
|
|
|
89
89
|
/// (2) maps a context-sensitive lock site to its corresponding lock span.
|
|
90
90
|
void analyze();
|
|
91
91
|
void analyzeIntraProcedualLock();
|
|
92
|
-
bool intraForwardTraverse(const
|
|
92
|
+
bool intraForwardTraverse(const SVFInstruction* lock, InstSet& unlockset, InstSet& forwardInsts);
|
|
93
93
|
bool intraBackwardTraverse(const InstSet& unlockset, InstSet& backwardInsts);
|
|
94
94
|
|
|
95
95
|
void collectCxtLock();
|
|
@@ -101,14 +101,14 @@ public:
|
|
|
101
101
|
/// Intraprocedural locks
|
|
102
102
|
//@{
|
|
103
103
|
/// Return true if the lock is an intra-procedural lock
|
|
104
|
-
inline bool isIntraLock(const
|
|
104
|
+
inline bool isIntraLock(const SVFInstruction* lock) const
|
|
105
105
|
{
|
|
106
106
|
assert(locksites.find(lock)!=locksites.end() && "not a lock site?");
|
|
107
107
|
return ciLocktoSpan.find(lock)!=ciLocktoSpan.end();
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
/// Add intra-procedural lock
|
|
111
|
-
inline void addIntraLock(const
|
|
111
|
+
inline void addIntraLock(const SVFInstruction* lockSite, const InstSet& stmts)
|
|
112
112
|
{
|
|
113
113
|
for(InstSet::const_iterator it = stmts.begin(), eit = stmts.end(); it!=eit; ++it)
|
|
114
114
|
{
|
|
@@ -118,7 +118,7 @@ public:
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
/// Add intra-procedural lock
|
|
121
|
-
inline void addCondIntraLock(const
|
|
121
|
+
inline void addCondIntraLock(const SVFInstruction* lockSite, const InstSet& stmts)
|
|
122
122
|
{
|
|
123
123
|
for(InstSet::const_iterator it = stmts.begin(), eit = stmts.end(); it!=eit; ++it)
|
|
124
124
|
{
|
|
@@ -127,18 +127,18 @@ public:
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
/// Return true if a statement is inside an intra-procedural lock
|
|
130
|
-
inline bool isInsideIntraLock(const
|
|
130
|
+
inline bool isInsideIntraLock(const SVFInstruction* stmt) const
|
|
131
131
|
{
|
|
132
132
|
return instCILocksMap.find(stmt)!=instCILocksMap.end() || isInsideCondIntraLock(stmt);
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
/// Return true if a statement is inside a partial lock/unlock pair (conditional lock with unconditional unlock)
|
|
136
|
-
inline bool isInsideCondIntraLock(const
|
|
136
|
+
inline bool isInsideCondIntraLock(const SVFInstruction* stmt) const
|
|
137
137
|
{
|
|
138
138
|
return instTocondCILocksMap.find(stmt)!=instTocondCILocksMap.end();
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
inline const InstSet& getIntraLockSet(const
|
|
141
|
+
inline const InstSet& getIntraLockSet(const SVFInstruction* stmt) const
|
|
142
142
|
{
|
|
143
143
|
InstToInstSetMap::const_iterator it = instCILocksMap.find(stmt);
|
|
144
144
|
assert(it!=instCILocksMap.end() && "intralock not found!");
|
|
@@ -149,7 +149,7 @@ public:
|
|
|
149
149
|
/// Context-sensitive locks
|
|
150
150
|
//@{
|
|
151
151
|
/// Add inter-procedural context-sensitive lock
|
|
152
|
-
inline void addCxtLock(const CallStrCxt& cxt,const
|
|
152
|
+
inline void addCxtLock(const CallStrCxt& cxt,const SVFInstruction* inst)
|
|
153
153
|
{
|
|
154
154
|
CxtLock cxtlock(cxt,inst);
|
|
155
155
|
cxtLockset.insert(cxtlock);
|
|
@@ -193,7 +193,7 @@ public:
|
|
|
193
193
|
//@}
|
|
194
194
|
|
|
195
195
|
/// Return true if it is a candidate function
|
|
196
|
-
inline bool isLockCandidateFun(const
|
|
196
|
+
inline bool isLockCandidateFun(const SVFFunction* fun) const
|
|
197
197
|
{
|
|
198
198
|
return lockcandidateFuncSet.find(fun)!=lockcandidateFuncSet.end();
|
|
199
199
|
}
|
|
@@ -201,12 +201,12 @@ public:
|
|
|
201
201
|
/// Context-sensitive statement and lock spans
|
|
202
202
|
//@{
|
|
203
203
|
/// Get LockSet and LockSpan
|
|
204
|
-
inline bool hasCxtStmtfromInst(const
|
|
204
|
+
inline bool hasCxtStmtfromInst(const SVFInstruction* inst) const
|
|
205
205
|
{
|
|
206
206
|
InstToCxtStmtSet::const_iterator it = instToCxtStmtSet.find(inst);
|
|
207
207
|
return (it != instToCxtStmtSet.end());
|
|
208
208
|
}
|
|
209
|
-
inline const CxtStmtSet& getCxtStmtfromInst(const
|
|
209
|
+
inline const CxtStmtSet& getCxtStmtfromInst(const SVFInstruction* inst) const
|
|
210
210
|
{
|
|
211
211
|
InstToCxtStmtSet::const_iterator it = instToCxtStmtSet.find(inst);
|
|
212
212
|
assert(it != instToCxtStmtSet.end());
|
|
@@ -270,7 +270,7 @@ public:
|
|
|
270
270
|
|
|
271
271
|
|
|
272
272
|
/// Check if one instruction's context stmt is in a lock span
|
|
273
|
-
inline bool hasOneCxtInLockSpan(const
|
|
273
|
+
inline bool hasOneCxtInLockSpan(const SVFInstruction *I, LockSpan lspan) const
|
|
274
274
|
{
|
|
275
275
|
if(!hasCxtStmtfromInst(I))
|
|
276
276
|
return false;
|
|
@@ -285,7 +285,7 @@ public:
|
|
|
285
285
|
return false;
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
-
inline bool hasAllCxtInLockSpan(const
|
|
288
|
+
inline bool hasAllCxtInLockSpan(const SVFInstruction *I, LockSpan lspan) const
|
|
289
289
|
{
|
|
290
290
|
if(!hasCxtStmtfromInst(I))
|
|
291
291
|
return false;
|
|
@@ -304,15 +304,15 @@ public:
|
|
|
304
304
|
/// Check if two Instructions are protected by common locks
|
|
305
305
|
/// echo inst may have multiple cxt stmt
|
|
306
306
|
/// we check whether every cxt stmt of instructions is protected by a common lock.
|
|
307
|
-
bool isProtectedByCommonLock(const
|
|
308
|
-
bool isProtectedByCommonCxtLock(const
|
|
307
|
+
bool isProtectedByCommonLock(const SVFInstruction *i1, const SVFInstruction *i2);
|
|
308
|
+
bool isProtectedByCommonCxtLock(const SVFInstruction *i1, const SVFInstruction *i2);
|
|
309
309
|
bool isProtectedByCommonCxtLock(const CxtStmt& cxtStmt1, const CxtStmt& cxtStmt2);
|
|
310
|
-
bool isProtectedByCommonCILock(const
|
|
310
|
+
bool isProtectedByCommonCILock(const SVFInstruction *i1, const SVFInstruction *i2);
|
|
311
311
|
|
|
312
|
-
bool isInSameSpan(const
|
|
313
|
-
bool isInSameCSSpan(const
|
|
312
|
+
bool isInSameSpan(const SVFInstruction *I1, const SVFInstruction *I2);
|
|
313
|
+
bool isInSameCSSpan(const SVFInstruction *i1, const SVFInstruction *i2) const;
|
|
314
314
|
bool isInSameCSSpan(const CxtStmt& cxtStmt1, const CxtStmt& cxtStmt2) const;
|
|
315
|
-
bool isInSameCISpan(const
|
|
315
|
+
bool isInSameCISpan(const SVFInstruction *i1, const SVFInstruction *i2) const;
|
|
316
316
|
|
|
317
317
|
inline u32_t getNumOfCxtLocks()
|
|
318
318
|
{
|
|
@@ -347,7 +347,7 @@ private:
|
|
|
347
347
|
{
|
|
348
348
|
return isAliasedLocks(cl1.getStmt(), cl2.getStmt());
|
|
349
349
|
}
|
|
350
|
-
bool isAliasedLocks(const
|
|
350
|
+
bool isAliasedLocks(const SVFInstruction* i1, const SVFInstruction* i2)
|
|
351
351
|
{
|
|
352
352
|
/// todo: must alias
|
|
353
353
|
return tct->getPTA()->alias(getLockVal(i1), getLockVal(i2));
|
|
@@ -433,29 +433,29 @@ private:
|
|
|
433
433
|
//@}
|
|
434
434
|
|
|
435
435
|
/// Push calling context
|
|
436
|
-
void pushCxt(CallStrCxt& cxt, const
|
|
436
|
+
void pushCxt(CallStrCxt& cxt, const SVFInstruction* call, const SVFFunction* callee);
|
|
437
437
|
/// Match context
|
|
438
|
-
bool matchCxt(CallStrCxt& cxt, const
|
|
438
|
+
bool matchCxt(CallStrCxt& cxt, const SVFInstruction* call, const SVFFunction* callee);
|
|
439
439
|
|
|
440
440
|
void validateResults();
|
|
441
441
|
|
|
442
442
|
/// Whether it is a lock site
|
|
443
|
-
inline bool isTDFork(const
|
|
443
|
+
inline bool isTDFork(const SVFInstruction* call)
|
|
444
444
|
{
|
|
445
445
|
return getTCG()->getThreadAPI()->isTDFork(call);
|
|
446
446
|
}
|
|
447
447
|
/// Whether it is a lock site
|
|
448
|
-
inline bool isTDAcquire(const
|
|
448
|
+
inline bool isTDAcquire(const SVFInstruction* call)
|
|
449
449
|
{
|
|
450
450
|
return getTCG()->getThreadAPI()->isTDAcquire(call);
|
|
451
451
|
}
|
|
452
452
|
/// Whether it is a unlock site
|
|
453
|
-
inline bool isTDRelease(const
|
|
453
|
+
inline bool isTDRelease(const SVFInstruction* call)
|
|
454
454
|
{
|
|
455
455
|
return getTCG()->getThreadAPI()->isTDRelease(call);
|
|
456
456
|
}
|
|
457
457
|
/// Get lock value
|
|
458
|
-
inline const Value* getLockVal(const
|
|
458
|
+
inline const Value* getLockVal(const SVFInstruction* call)
|
|
459
459
|
{
|
|
460
460
|
return getTCG()->getThreadAPI()->getLockVal(call);
|
|
461
461
|
}
|
|
@@ -19,7 +19,7 @@ class LockResultValidator
|
|
|
19
19
|
{
|
|
20
20
|
public:
|
|
21
21
|
typedef Set<std::string> CxtLockSetStr;
|
|
22
|
-
typedef Map<const
|
|
22
|
+
typedef Map<const SVFInstruction*, CxtLockSetStr> CxtStmtToCxtLockS;
|
|
23
23
|
|
|
24
24
|
typedef unsigned LOCK_FLAG;
|
|
25
25
|
|
|
@@ -38,11 +38,11 @@ public:
|
|
|
38
38
|
}
|
|
39
39
|
private:
|
|
40
40
|
// Get CallICFGNode
|
|
41
|
-
inline CallICFGNode* getCBN(const
|
|
41
|
+
inline CallICFGNode* getCBN(const SVFInstruction* inst)
|
|
42
42
|
{
|
|
43
43
|
return _la->getTCT()->getCallICFGNode(inst);
|
|
44
44
|
}
|
|
45
|
-
const Instruction
|
|
45
|
+
const Instruction* getPreviousMemoryAccessInst( const Instruction* I)
|
|
46
46
|
{
|
|
47
47
|
I = I->getPrevNode();
|
|
48
48
|
while (I)
|
|
@@ -51,10 +51,11 @@ private:
|
|
|
51
51
|
return I;
|
|
52
52
|
SVFFunction* callee = nullptr;
|
|
53
53
|
|
|
54
|
-
if(SVFUtil::
|
|
54
|
+
if(SVFUtil::isCallSite(I))
|
|
55
55
|
{
|
|
56
56
|
PTACallGraph::FunctionSet callees;
|
|
57
|
-
|
|
57
|
+
const SVFInstruction* svfInst = LLVMModuleSet::getLLVMModuleSet()->getSVFInstruction(I);
|
|
58
|
+
_la->getTCT()->getThreadCallGraph()->getCallees(getCBN(svfInst), callees);
|
|
58
59
|
|
|
59
60
|
for(PTACallGraph::FunctionSet::const_iterator cit = callees.begin(),
|
|
60
61
|
ecit = callees.end(); cit!=ecit; cit++)
|
|
@@ -93,7 +94,7 @@ private:
|
|
|
93
94
|
|
|
94
95
|
std::string getOutput(const char* scenario, LOCK_FLAG analysisRes);
|
|
95
96
|
|
|
96
|
-
Set<std::string> getStringArg(const
|
|
97
|
+
Set<std::string> getStringArg(const SVFInstruction* inst, unsigned int arg_num);
|
|
97
98
|
|
|
98
99
|
bool collectLockTargets();
|
|
99
100
|
LOCK_FLAG validateStmtInLock();
|