svf-tools 1.0.1038 → 1.0.1040

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.1038",
3
+ "version": "1.0.1040",
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": {
@@ -123,14 +123,35 @@ public:
123
123
 
124
124
 
125
125
  // Return a handle to the stack of nodes in topological
126
- // order. This will be used to seed the initial solution
126
+ // order. This will be used to seed the initial solution
127
127
  // and improve efficiency.
128
128
  inline GNodeStack &topoNodeStack()
129
129
  {
130
130
  return _T;
131
131
  }
132
132
 
133
- const inline GNODESCCInfoMap &GNodeSCCInfo() const
133
+ inline const GNodeStack& topoNodeStack() const
134
+ {
135
+ return _T;
136
+ }
137
+
138
+ /// Return a handle to the stack of nodes in reverse topological
139
+ /// order. This will be used to seed the initial solution
140
+ /// and improve efficiency.
141
+ inline FIFOWorkList<NodeID> revTopoNodeStack() const
142
+ {
143
+ FIFOWorkList<NodeID> revTopoOrder;
144
+ GNodeStack topoOrder = topoNodeStack();
145
+ while(!topoOrder.empty())
146
+ {
147
+ NodeID nodeID = topoOrder.top();
148
+ topoOrder.pop();
149
+ revTopoOrder.push(nodeID);
150
+ }
151
+ return revTopoOrder;
152
+ }
153
+
154
+ const inline GNODESCCInfoMap &GNodeSCCInfo() const
134
155
  {
135
156
  return _NodeSCCAuxInfo;
136
157
  }
@@ -268,8 +268,6 @@ private:
268
268
  /// Get all the objects in callee's modref escaped via global objects (the chain pts of globals)
269
269
  void getEscapObjviaGlobals(NodeBS& globs, const NodeBS& pts);
270
270
 
271
- /// Get reverse topo call graph scc
272
- void getCallGraphSCCRevTopoOrder(WorkList& worklist);
273
271
 
274
272
  protected:
275
273
  MRGenerator(BVDataPTAImpl* p, bool ptrOnly);
@@ -69,31 +69,23 @@ protected:
69
69
  /// SCC detection
70
70
  this->getSCCDetector()->find();
71
71
 
72
+ assert(nodeStack.empty() && "node stack is not empty, some nodes are not popped properly.");
73
+
72
74
  /// Both rep and sub nodes need to be processed later.
73
75
  /// Collect sub nodes from SCCDetector.
74
- NodeStack revTopoStack;
75
- NodeStack& topoStack = this->getSCCDetector()->topoNodeStack();
76
- while (!topoStack.empty())
76
+ FIFOWorkList<NodeID> revTopoStack = this->getSCCDetector()->revTopoNodeStack();
77
+ while (!revTopoStack.empty())
77
78
  {
78
- NodeID nodeId = topoStack.top();
79
- topoStack.pop();
79
+ NodeID nodeId = revTopoStack.front();
80
+ revTopoStack.pop();
80
81
  const NodeBS& subNodes = this->getSCCDetector()->subNodes(nodeId);
81
82
  for (NodeBS::iterator it = subNodes.begin(), eit = subNodes.end(); it != eit; ++it)
82
83
  {
83
- revTopoStack.push(*it);
84
+ /// restore the topological order.
85
+ nodeStack.push(*it);
84
86
  }
85
87
  }
86
88
 
87
- assert(nodeStack.empty() && "node stack is not empty, some nodes are not popped properly.");
88
-
89
- /// restore the topological order.
90
- while (!revTopoStack.empty())
91
- {
92
- NodeID nodeId = revTopoStack.top();
93
- revTopoStack.pop();
94
- nodeStack.push(nodeId);
95
- }
96
-
97
89
  return nodeStack;
98
90
  }
99
91
  };
@@ -238,12 +238,12 @@ void MRGenerator::collectModRefForCall()
238
238
 
239
239
  DBOUT(DGENERAL, outs() << pasMsg("\t\tPerform Callsite Mod-Ref \n"));
240
240
 
241
- WorkList worklist;
242
- getCallGraphSCCRevTopoOrder(worklist);
241
+ WorkList worklist = callGraphSCC->revTopoNodeStack();
243
242
 
244
243
  while(!worklist.empty())
245
244
  {
246
- NodeID callGraphNodeID = worklist.pop();
245
+ NodeID callGraphNodeID = worklist.front();
246
+ worklist.pop();
247
247
  /// handle all sub scc nodes of this rep node
248
248
  const NodeBS& subNodes = callGraphSCC->subNodes(callGraphNodeID);
249
249
  for(NodeBS::iterator it = subNodes.begin(), eit = subNodes.end(); it!=eit; ++it)
@@ -456,21 +456,6 @@ bool MRGenerator::addModSideEffectOfCallSite(const CallICFGNode* cs, const NodeB
456
456
  }
457
457
 
458
458
 
459
- /*!
460
- * Get the reverse topo order of scc call graph
461
- */
462
- void MRGenerator::getCallGraphSCCRevTopoOrder(WorkList& worklist)
463
- {
464
-
465
- NodeStack& topoOrder = callGraphSCC->topoNodeStack();
466
- while(!topoOrder.empty())
467
- {
468
- NodeID callgraphNodeID = topoOrder.top();
469
- topoOrder.pop();
470
- worklist.push(callgraphNodeID);
471
- }
472
- }
473
-
474
459
  /*!
475
460
  * Get all objects might pass into and pass out of callee(s) from a callsite
476
461
  */
@@ -709,25 +709,16 @@ inline void Andersen::collapseFields()
709
709
  */
710
710
  void Andersen::mergeSccCycle()
711
711
  {
712
- NodeStack revTopoOrder;
713
- NodeStack & topoOrder = getSCCDetector()->topoNodeStack();
712
+ NodeStack topoOrder = getSCCDetector()->topoNodeStack();
713
+
714
714
  while (!topoOrder.empty())
715
715
  {
716
716
  NodeID repNodeId = topoOrder.top();
717
717
  topoOrder.pop();
718
- revTopoOrder.push(repNodeId);
719
718
  const NodeBS& subNodes = getSCCDetector()->subNodes(repNodeId);
720
719
  // merge sub nodes to rep node
721
720
  mergeSccNodes(repNodeId, subNodes);
722
721
  }
723
-
724
- // restore the topological order for later solving.
725
- while (!revTopoOrder.empty())
726
- {
727
- NodeID nodeId = revTopoOrder.top();
728
- revTopoOrder.pop();
729
- topoOrder.push(nodeId);
730
- }
731
722
  }
732
723
 
733
724