svf-lib 1.0.1263 → 1.0.1265

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.
@@ -94,6 +94,8 @@ public:
94
94
  static double numOfNonterminalEdges; // Number of nonterminal labeled edges
95
95
  static double numOfStartEdges; // Number of start nonterminal labeled edges
96
96
  // Solver
97
+ static double numOfIteration; // Number solving Iteration
98
+ static double numOfChecks; // Number of checks
97
99
  static double timeOfSolving; // time of solving CFL Reachability
98
100
  //@}
99
101
 
@@ -47,6 +47,8 @@ public:
47
47
  typedef CFLGrammar::Production Production;
48
48
  typedef CFLGrammar::Symbol Symbol;
49
49
 
50
+ static double numOfChecks;
51
+
50
52
  CFLSolver(CFLGraph* _graph, CFLGrammar* _grammar): graph(_graph), grammar(_grammar)
51
53
  {
52
54
  }
@@ -57,6 +59,12 @@ public:
57
59
  delete grammar;
58
60
  }
59
61
 
62
+ /// Initialize worklist
63
+ void initialize();
64
+
65
+ /// Process CFLEdge
66
+ void processCFLEdge(const CFLEdge* Y_edge);
67
+
60
68
  /// Start solving
61
69
  void solve();
62
70
 
@@ -38,36 +38,28 @@
38
38
  namespace SVF
39
39
  {
40
40
 
41
- class CFLAlias;
42
- class CFLVF;
43
- class SVFIR;
44
- class ConstraintGraph;
45
-
46
41
  /*!
47
42
  * Statistics of CFL's analysis
48
43
  */
49
44
  class CFLStat : public PTAStat
50
45
  {
51
-
52
46
  private:
53
47
  CFLBase* pta;
54
48
 
55
49
  public:
56
- /// CFL Stat
57
- u32_t _NumofCFLGraphNode;
58
-
59
50
  CFLStat(CFLBase* p);
60
51
 
61
52
  virtual ~CFLStat()
62
53
  {
63
-
64
54
  }
65
55
 
66
56
  virtual void performStat();
67
57
 
68
- void collectCFLInfo(CFLGraph* CFLGraph);
58
+ void CFLGraphStat();
69
59
 
70
60
  void CFLGrammarStat();
61
+
62
+ void CFLSolverStat();
71
63
  };
72
64
 
73
65
  } // End namespace SVF
@@ -84,47 +84,57 @@ public:
84
84
  ~CFLNode() override = default;
85
85
 
86
86
  /// Different Kind(label) associated edges set
87
- typedef std::map <CFLEdge::GEdgeKind, CFLEdge::CFLEdgeSetTy> CFLEdgeDataTy;
87
+ typedef std::map <GrammarBase::Symbol, CFLEdge::CFLEdgeSetTy> CFLEdgeDataTy;
88
88
 
89
89
  private:
90
90
  CFLEdgeDataTy inCFLEdges;
91
91
  CFLEdgeDataTy outCFLEdges;
92
92
 
93
93
  public:
94
- inline const CFLEdge::CFLEdgeSetTy& getInEdgeWithTy(CFLEdge::GEdgeKind k)
94
+ inline const CFLEdge::CFLEdgeSetTy& getInEdgeWithTy(GrammarBase::Symbol s)
95
95
  {
96
- return inCFLEdges[k];
96
+ return inCFLEdges[s];
97
97
  }
98
98
 
99
- inline const CFLEdge::CFLEdgeSetTy& getOutEdgeWithTy(CFLEdge::GEdgeKind k)
99
+ inline const CFLEdge::CFLEdgeSetTy& getOutEdgeWithTy(GrammarBase::Symbol s)
100
100
  {
101
- return outCFLEdges[k];
101
+ return outCFLEdges[s];
102
102
  }
103
103
 
104
- inline bool addInEdgeWithKind(CFLEdge* inEdge, CFLEdge::GEdgeKind k)
104
+ inline bool addInEdgeWithKind(CFLEdge* inEdge, GrammarBase::Symbol s)
105
105
  {
106
106
  assert(inEdge->getDstID() == this->getId());
107
- bool added1 = addIncomingEdge(inEdge);
108
- bool added2 = inCFLEdges[k].insert(inEdge).second;
107
+ bool added1 = GenericNode::addIncomingEdge(inEdge);
108
+ bool added2 = inCFLEdges[s].insert(inEdge).second;
109
109
 
110
110
  return added1 && added2;
111
111
  }
112
112
 
113
- inline bool addOutEdgeWithKind(CFLEdge* outEdge, CFLEdge::GEdgeKind k)
113
+ inline bool addIngoingEdge(CFLEdge* inEdge)
114
+ {
115
+ return addInEdgeWithKind(inEdge, inEdge->getEdgeKind());
116
+ }
117
+
118
+ inline bool addOutEdgeWithKind(CFLEdge* outEdge, GrammarBase::Symbol s)
114
119
  {
115
120
  assert(outEdge->getSrcID() == this->getId());
116
- bool added1 = addOutgoingEdge(outEdge);
117
- bool added2 = outCFLEdges[k].insert(outEdge).second;
121
+ bool added1 = GenericNode::addOutgoingEdge(outEdge);
122
+ bool added2 = outCFLEdges[s].insert(outEdge).second;
118
123
 
119
124
  return added1 && added2;
120
125
  }
121
126
 
127
+ inline bool addOutgoingEdge(CFLEdge* OutEdge)
128
+ {
129
+ return addOutEdgeWithKind(OutEdge, OutEdge->getEdgeKind());
130
+ }
131
+
122
132
  inline bool removeCFLInEdge(CFLEdge* inEdge)
123
133
  {
124
134
  u32_t num1 = removeIncomingEdge(inEdge);
125
135
 
126
- CFLEdge::GEdgeKind k = inEdge->getEdgeKind();
127
- u32_t num2 = inCFLEdges[k].erase(inEdge);
136
+ GrammarBase::Symbol s = inEdge->getEdgeKind();
137
+ u32_t num2 = inCFLEdges[s].erase(inEdge);
128
138
 
129
139
  return num1 && num2;
130
140
  }
@@ -133,8 +143,8 @@ public:
133
143
  {
134
144
  u32_t num1 = removeOutgoingEdge(outEdge);
135
145
 
136
- CFLEdge::GEdgeKind k = outEdge->getEdgeKind();
137
- u32_t num2 = outCFLEdges[k].erase(outEdge);
146
+ GrammarBase::Symbol s = outEdge->getEdgeKind();
147
+ u32_t num2 = outCFLEdges[s].erase(outEdge);
138
148
 
139
149
  return num1 && num2;
140
150
  }
Binary file
@@ -94,6 +94,8 @@ public:
94
94
  static double numOfNonterminalEdges; // Number of nonterminal labeled edges
95
95
  static double numOfStartEdges; // Number of start nonterminal labeled edges
96
96
  // Solver
97
+ static double numOfIteration; // Number solving Iteration
98
+ static double numOfChecks; // Number of checks
97
99
  static double timeOfSolving; // time of solving CFL Reachability
98
100
  //@}
99
101
 
@@ -47,6 +47,8 @@ public:
47
47
  typedef CFLGrammar::Production Production;
48
48
  typedef CFLGrammar::Symbol Symbol;
49
49
 
50
+ static double numOfChecks;
51
+
50
52
  CFLSolver(CFLGraph* _graph, CFLGrammar* _grammar): graph(_graph), grammar(_grammar)
51
53
  {
52
54
  }
@@ -57,6 +59,12 @@ public:
57
59
  delete grammar;
58
60
  }
59
61
 
62
+ /// Initialize worklist
63
+ void initialize();
64
+
65
+ /// Process CFLEdge
66
+ void processCFLEdge(const CFLEdge* Y_edge);
67
+
60
68
  /// Start solving
61
69
  void solve();
62
70
 
@@ -38,36 +38,28 @@
38
38
  namespace SVF
39
39
  {
40
40
 
41
- class CFLAlias;
42
- class CFLVF;
43
- class SVFIR;
44
- class ConstraintGraph;
45
-
46
41
  /*!
47
42
  * Statistics of CFL's analysis
48
43
  */
49
44
  class CFLStat : public PTAStat
50
45
  {
51
-
52
46
  private:
53
47
  CFLBase* pta;
54
48
 
55
49
  public:
56
- /// CFL Stat
57
- u32_t _NumofCFLGraphNode;
58
-
59
50
  CFLStat(CFLBase* p);
60
51
 
61
52
  virtual ~CFLStat()
62
53
  {
63
-
64
54
  }
65
55
 
66
56
  virtual void performStat();
67
57
 
68
- void collectCFLInfo(CFLGraph* CFLGraph);
58
+ void CFLGraphStat();
69
59
 
70
60
  void CFLGrammarStat();
61
+
62
+ void CFLSolverStat();
71
63
  };
72
64
 
73
65
  } // End namespace SVF
@@ -84,47 +84,57 @@ public:
84
84
  ~CFLNode() override = default;
85
85
 
86
86
  /// Different Kind(label) associated edges set
87
- typedef std::map <CFLEdge::GEdgeKind, CFLEdge::CFLEdgeSetTy> CFLEdgeDataTy;
87
+ typedef std::map <GrammarBase::Symbol, CFLEdge::CFLEdgeSetTy> CFLEdgeDataTy;
88
88
 
89
89
  private:
90
90
  CFLEdgeDataTy inCFLEdges;
91
91
  CFLEdgeDataTy outCFLEdges;
92
92
 
93
93
  public:
94
- inline const CFLEdge::CFLEdgeSetTy& getInEdgeWithTy(CFLEdge::GEdgeKind k)
94
+ inline const CFLEdge::CFLEdgeSetTy& getInEdgeWithTy(GrammarBase::Symbol s)
95
95
  {
96
- return inCFLEdges[k];
96
+ return inCFLEdges[s];
97
97
  }
98
98
 
99
- inline const CFLEdge::CFLEdgeSetTy& getOutEdgeWithTy(CFLEdge::GEdgeKind k)
99
+ inline const CFLEdge::CFLEdgeSetTy& getOutEdgeWithTy(GrammarBase::Symbol s)
100
100
  {
101
- return outCFLEdges[k];
101
+ return outCFLEdges[s];
102
102
  }
103
103
 
104
- inline bool addInEdgeWithKind(CFLEdge* inEdge, CFLEdge::GEdgeKind k)
104
+ inline bool addInEdgeWithKind(CFLEdge* inEdge, GrammarBase::Symbol s)
105
105
  {
106
106
  assert(inEdge->getDstID() == this->getId());
107
- bool added1 = addIncomingEdge(inEdge);
108
- bool added2 = inCFLEdges[k].insert(inEdge).second;
107
+ bool added1 = GenericNode::addIncomingEdge(inEdge);
108
+ bool added2 = inCFLEdges[s].insert(inEdge).second;
109
109
 
110
110
  return added1 && added2;
111
111
  }
112
112
 
113
- inline bool addOutEdgeWithKind(CFLEdge* outEdge, CFLEdge::GEdgeKind k)
113
+ inline bool addIngoingEdge(CFLEdge* inEdge)
114
+ {
115
+ return addInEdgeWithKind(inEdge, inEdge->getEdgeKind());
116
+ }
117
+
118
+ inline bool addOutEdgeWithKind(CFLEdge* outEdge, GrammarBase::Symbol s)
114
119
  {
115
120
  assert(outEdge->getSrcID() == this->getId());
116
- bool added1 = addOutgoingEdge(outEdge);
117
- bool added2 = outCFLEdges[k].insert(outEdge).second;
121
+ bool added1 = GenericNode::addOutgoingEdge(outEdge);
122
+ bool added2 = outCFLEdges[s].insert(outEdge).second;
118
123
 
119
124
  return added1 && added2;
120
125
  }
121
126
 
127
+ inline bool addOutgoingEdge(CFLEdge* OutEdge)
128
+ {
129
+ return addOutEdgeWithKind(OutEdge, OutEdge->getEdgeKind());
130
+ }
131
+
122
132
  inline bool removeCFLInEdge(CFLEdge* inEdge)
123
133
  {
124
134
  u32_t num1 = removeIncomingEdge(inEdge);
125
135
 
126
- CFLEdge::GEdgeKind k = inEdge->getEdgeKind();
127
- u32_t num2 = inCFLEdges[k].erase(inEdge);
136
+ GrammarBase::Symbol s = inEdge->getEdgeKind();
137
+ u32_t num2 = inCFLEdges[s].erase(inEdge);
128
138
 
129
139
  return num1 && num2;
130
140
  }
@@ -133,8 +143,8 @@ public:
133
143
  {
134
144
  u32_t num1 = removeOutgoingEdge(outEdge);
135
145
 
136
- CFLEdge::GEdgeKind k = outEdge->getEdgeKind();
137
- u32_t num2 = outCFLEdges[k].erase(outEdge);
146
+ GrammarBase::Symbol s = outEdge->getEdgeKind();
147
+ u32_t num2 = outCFLEdges[s].erase(outEdge);
138
148
 
139
149
  return num1 && num2;
140
150
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.1263",
3
+ "version": "1.0.1265",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {