svf-tools 1.0.1198 → 1.0.1200

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-tools",
3
- "version": "1.0.1198",
3
+ "version": "1.0.1200",
4
4
  "description": "* <b>[TypeClone](https://github.com/SVF-tools/SVF/wiki/TypeClone) published in our [ECOOP paper](https://yuleisui.github.io/publications/ecoop20.pdf) is now available in SVF </b> * <b>SVF now uses a single script for its build. Just type [`source ./build.sh`](https://github.com/SVF-tools/SVF/blob/master/build.sh) in your terminal, that's it!</b> * <b>SVF now supports LLVM-10.0.0! </b> * <b>We thank [bsauce](https://github.com/bsauce) for writing a user manual of SVF ([link1](https://www.jianshu.com/p/068a08ec749c) and [link2](https://www.jianshu.com/p/777c30d4240e)) in Chinese </b> * <b>SVF now supports LLVM-9.0.0 (Thank [Byoungyoung Lee](https://github.com/SVF-tools/SVF/issues/142) for his help!). </b> * <b>SVF now supports a set of [field-sensitive pointer analyses](https://yuleisui.github.io/publications/sas2019a.pdf). </b> * <b>[Use SVF as an external lib](https://github.com/SVF-tools/SVF/wiki/Using-SVF-as-a-lib-in-your-own-tool) for your own project (Contributed by [Hongxu Chen](https://github.com/HongxuChen)). </b> * <b>SVF now supports LLVM-7.0.0. </b> * <b>SVF now supports Docker. [Try SVF in Docker](https://github.com/SVF-tools/SVF/wiki/Try-SVF-in-Docker)! </b> * <b>SVF now supports [LLVM-6.0.0](https://github.com/svf-tools/SVF/pull/38) (Contributed by [Jack Anthony](https://github.com/jackanth)). </b> * <b>SVF now supports [LLVM-4.0.0](https://github.com/svf-tools/SVF/pull/23) (Contributed by Jared Carlson. Thank [Jared](https://github.com/jcarlson23) and [Will](https://github.com/dtzWill) for their in-depth [discussions](https://github.com/svf-tools/SVF/pull/18) about updating SVF!) </b> * <b>SVF now supports analysis for C++ programs.</b> <br />",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -267,7 +267,6 @@ private:
267
267
  */
268
268
  void collectCycleHeads(const std::list<const ICFGWTOComp*>& comps);
269
269
 
270
-
271
270
  /**
272
271
  * handle SVF Statement like CmpStmt, CallStmt, GepStmt, LoadStmt, StoreStmt, etc.
273
272
  *
@@ -42,6 +42,7 @@
42
42
  #include <cstdlib>
43
43
  #include <vector>
44
44
  #include <deque>
45
+ #include <list>
45
46
  #include <set>
46
47
 
47
48
  namespace SVF
@@ -141,6 +142,20 @@ class FIFOWorkList
141
142
  public:
142
143
  FIFOWorkList() {}
143
144
 
145
+ /// Construct from a vector, pushing all elements in order
146
+ explicit FIFOWorkList(const std::vector<Data>& vec)
147
+ {
148
+ for (const Data& d : vec)
149
+ push(d);
150
+ }
151
+
152
+ /// Construct from a list, pushing all elements in order
153
+ explicit FIFOWorkList(const std::list<Data>& lst)
154
+ {
155
+ for (const Data& d : lst)
156
+ push(d);
157
+ }
158
+
144
159
  ~FIFOWorkList() {}
145
160
 
146
161
  inline bool empty() const
@@ -233,6 +248,20 @@ class FILOWorkList
233
248
  public:
234
249
  FILOWorkList() {}
235
250
 
251
+ /// Construct from a vector, pushing all elements in order
252
+ explicit FILOWorkList(const std::vector<Data>& vec)
253
+ {
254
+ for (const Data& d : vec)
255
+ push(d);
256
+ }
257
+
258
+ /// Construct from a list, pushing all elements in order
259
+ explicit FILOWorkList(const std::list<Data>& lst)
260
+ {
261
+ for (const Data& d : lst)
262
+ push(d);
263
+ }
264
+
236
265
  ~FILOWorkList() {}
237
266
 
238
267
  inline bool empty() const
@@ -807,46 +807,31 @@ std::vector<const ICFGNode*> AbstractInterpretation::getNextNodesOfCycle(const I
807
807
  }
808
808
 
809
809
  /**
810
- * Handle a function using worklist algorithm
811
- * This replaces the recursive WTO component handling with explicit worklist iteration
810
+ * Handle a function using worklist algorithm guided by WTO order.
811
+ * All top-level WTO components are pushed into the worklist upfront,
812
+ * so the traversal order is exactly the WTO order — each node is
813
+ * visited once, and cycles are handled as whole components.
812
814
  */
813
815
  void AbstractInterpretation::handleFunction(const ICFGNode* funEntry, const CallICFGNode* caller)
814
816
  {
815
- FIFOWorkList<const ICFGNode*> worklist;
816
- worklist.push(funEntry);
817
+ auto it = funcToWTO.find(funEntry->getFun());
818
+ if (it == funcToWTO.end())
819
+ return;
820
+
821
+ // Push all top-level WTO components into the worklist in WTO order
822
+ FIFOWorkList<const ICFGWTOComp*> worklist(it->second->getWTOComponents());
817
823
 
818
824
  while (!worklist.empty())
819
825
  {
820
- const ICFGNode* node = worklist.pop();
826
+ const ICFGWTOComp* comp = worklist.pop();
821
827
 
822
- // Check if this node is a cycle head
823
- if (cycleHeadToCycle.find(node) != cycleHeadToCycle.end())
828
+ if (const ICFGSingletonWTO* singleton = SVFUtil::dyn_cast<ICFGSingletonWTO>(comp))
824
829
  {
825
- const ICFGCycleWTO* cycle = cycleHeadToCycle[node];
826
- handleLoopOrRecursion(cycle, caller);
827
-
828
- // Push nodes outside the cycle to the worklist
829
- std::vector<const ICFGNode*> cycleNextNodes = getNextNodesOfCycle(cycle);
830
- for (const ICFGNode* nextNode : cycleNextNodes)
831
- {
832
- worklist.push(nextNode);
833
- }
830
+ handleICFGNode(singleton->getICFGNode());
834
831
  }
835
- else
832
+ else if (const ICFGCycleWTO* cycle = SVFUtil::dyn_cast<ICFGCycleWTO>(comp))
836
833
  {
837
- // Handle regular node
838
- if (!handleICFGNode(node))
839
- {
840
- // Fixpoint reached or infeasible, skip successors
841
- continue;
842
- }
843
-
844
- // Push successor nodes to the worklist
845
- std::vector<const ICFGNode*> nextNodes = getNextNodes(node);
846
- for (const ICFGNode* nextNode : nextNodes)
847
- {
848
- worklist.push(nextNode);
849
- }
834
+ handleLoopOrRecursion(cycle, caller);
850
835
  }
851
836
  }
852
837
  }