svf-lib 1.0.2542 → 1.0.2544

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.
@@ -352,7 +352,7 @@ public:
352
352
  /// freed addresses intact. Used when building a cycle snapshot so the
353
353
  /// ValVar set is controlled by the caller rather than whatever was
354
354
  /// cached at the seed node.
355
- void clearVars()
355
+ void clearValVars()
356
356
  {
357
357
  _varToAbsVal.clear();
358
358
  }
@@ -149,6 +149,11 @@ public:
149
149
  svfStateMgr->updateAbstractState(node, state);
150
150
  }
151
151
 
152
+ inline bool hasAbsValue(const SVFVar* var, const ICFGNode* node)
153
+ {
154
+ return svfStateMgr->hasAbstractValue(var, node);
155
+ }
156
+
152
157
  inline const AbstractValue& getAbsValue(const SVFVar* var, const ICFGNode* node)
153
158
  {
154
159
  return svfStateMgr->getAbstractValue(var, node);
@@ -180,6 +185,30 @@ private:
180
185
  /// Handle a WTO cycle (loop or recursive function) using widening/narrowing iteration
181
186
  virtual void handleLoopOrRecursion(const ICFGCycleWTO* cycle, const CallICFGNode* caller = nullptr);
182
187
 
188
+ // ---- Semi-sparse cycle helpers ----
189
+ // ValVars whose def-site is inside the cycle but NOT cycle_head do not
190
+ // flow through cycle_head's merge in semi-sparse mode, so the around-merge
191
+ // widening cannot observe them. getFullCycleHeadState pulls these ValVars
192
+ // into a single AbstractState snapshot so widen/narrow can treat ValVars
193
+ // and ObjVars uniformly; after widen/narrow we scatter the ValVars back
194
+ // to their def-sites.
195
+
196
+ /// Build a full cycle-head AbstractState: the ObjVars currently at
197
+ /// cycle_head combined with every cycle ValVar pulled from its
198
+ /// def-site. Skips ValVars without a stored value to avoid the
199
+ /// top-fallback contamination. In dense mode this is equivalent to
200
+ /// trace[cycle_head] since ValVars already live there.
201
+ AbstractState getFullCycleHeadState(const ICFGCycleWTO* cycle);
202
+
203
+ /// Widen prev with cur; write the widened state to trace[cycle_head]
204
+ /// and scatter its ValVars back to their def-sites. Returns true
205
+ /// when the widened result equals prev (fixpoint).
206
+ bool widenCycleState(const AbstractState& prev, const AbstractState& cur,
207
+ const ICFGCycleWTO* cycle);
208
+ /// Narrow prev with cur; write the narrowed state back and scatter.
209
+ bool narrowCycleState(const AbstractState& prev, const AbstractState& cur,
210
+ const ICFGCycleWTO* cycle);
211
+
183
212
  /// Handle a function body via worklist-driven WTO traversal starting from funEntry
184
213
  void handleFunction(const ICFGNode* funEntry, const CallICFGNode* caller = nullptr);
185
214
 
@@ -66,6 +66,19 @@ public:
66
66
  /// Dispatch to ValVar or ObjVar overload (checks ObjVar first due to inheritance).
67
67
  const AbstractValue& getAbstractValue(const SVFVar* var, const ICFGNode* node);
68
68
 
69
+ /// Check whether a ValVar has a real stored value reachable by
70
+ /// getAbstractValue. Unlike getAbstractValue, this is side-effect free
71
+ /// and does NOT treat the final top-fallback as "present" — so callers
72
+ /// that plan to write the fetched value back (e.g. cycle widen/narrow)
73
+ /// can distinguish a genuine stored value from the top sentinel.
74
+ bool hasAbstractValue(const ValVar* var, const ICFGNode* node) const;
75
+
76
+ /// Check whether an ObjVar has a stored value at node.
77
+ bool hasAbstractValue(const ObjVar* var, const ICFGNode* node) const;
78
+
79
+ /// Dispatch to ValVar or ObjVar overload.
80
+ bool hasAbstractValue(const SVFVar* var, const ICFGNode* node) const;
81
+
69
82
  /// Write a top-level variable's abstract value into abstractTrace[node].
70
83
  void updateAbstractValue(const ValVar* var, const AbstractValue& val, const ICFGNode* node);
71
84
 
@@ -80,10 +80,10 @@ public:
80
80
 
81
81
  /// Look up the ValVar id set of a WTO cycle. Returns nullptr if the
82
82
  /// cycle is unknown (e.g. dense mode, where the map is never built).
83
- const Set<NodeID>* getCycleValVars(const ICFGCycleWTO* cycle) const
83
+ const Set<const ValVar*> getCycleValVars(const ICFGCycleWTO* cycle) const
84
84
  {
85
85
  auto it = cycleToValVars.find(cycle);
86
- return it == cycleToValVars.end() ? nullptr : &it->second;
86
+ return it == cycleToValVars.end() ? Set<const ValVar*>() : it->second;
87
87
  }
88
88
 
89
89
  private:
@@ -98,7 +98,7 @@ private:
98
98
  /// Pre-computed (semi-sparse only) map from a WTO cycle to the IDs of
99
99
  /// every ValVar whose def-site is inside that cycle, including all
100
100
  /// nested sub-cycles. Empty in dense mode.
101
- Map<const ICFGCycleWTO*, Set<NodeID>> cycleToValVars;
101
+ Map<const ICFGCycleWTO*, Set<const ValVar*>> cycleToValVars;
102
102
  };
103
103
 
104
104
  } // End namespace SVF
@@ -352,7 +352,7 @@ public:
352
352
  /// freed addresses intact. Used when building a cycle snapshot so the
353
353
  /// ValVar set is controlled by the caller rather than whatever was
354
354
  /// cached at the seed node.
355
- void clearVars()
355
+ void clearValVars()
356
356
  {
357
357
  _varToAbsVal.clear();
358
358
  }
@@ -149,6 +149,11 @@ public:
149
149
  svfStateMgr->updateAbstractState(node, state);
150
150
  }
151
151
 
152
+ inline bool hasAbsValue(const SVFVar* var, const ICFGNode* node)
153
+ {
154
+ return svfStateMgr->hasAbstractValue(var, node);
155
+ }
156
+
152
157
  inline const AbstractValue& getAbsValue(const SVFVar* var, const ICFGNode* node)
153
158
  {
154
159
  return svfStateMgr->getAbstractValue(var, node);
@@ -180,6 +185,30 @@ private:
180
185
  /// Handle a WTO cycle (loop or recursive function) using widening/narrowing iteration
181
186
  virtual void handleLoopOrRecursion(const ICFGCycleWTO* cycle, const CallICFGNode* caller = nullptr);
182
187
 
188
+ // ---- Semi-sparse cycle helpers ----
189
+ // ValVars whose def-site is inside the cycle but NOT cycle_head do not
190
+ // flow through cycle_head's merge in semi-sparse mode, so the around-merge
191
+ // widening cannot observe them. getFullCycleHeadState pulls these ValVars
192
+ // into a single AbstractState snapshot so widen/narrow can treat ValVars
193
+ // and ObjVars uniformly; after widen/narrow we scatter the ValVars back
194
+ // to their def-sites.
195
+
196
+ /// Build a full cycle-head AbstractState: the ObjVars currently at
197
+ /// cycle_head combined with every cycle ValVar pulled from its
198
+ /// def-site. Skips ValVars without a stored value to avoid the
199
+ /// top-fallback contamination. In dense mode this is equivalent to
200
+ /// trace[cycle_head] since ValVars already live there.
201
+ AbstractState getFullCycleHeadState(const ICFGCycleWTO* cycle);
202
+
203
+ /// Widen prev with cur; write the widened state to trace[cycle_head]
204
+ /// and scatter its ValVars back to their def-sites. Returns true
205
+ /// when the widened result equals prev (fixpoint).
206
+ bool widenCycleState(const AbstractState& prev, const AbstractState& cur,
207
+ const ICFGCycleWTO* cycle);
208
+ /// Narrow prev with cur; write the narrowed state back and scatter.
209
+ bool narrowCycleState(const AbstractState& prev, const AbstractState& cur,
210
+ const ICFGCycleWTO* cycle);
211
+
183
212
  /// Handle a function body via worklist-driven WTO traversal starting from funEntry
184
213
  void handleFunction(const ICFGNode* funEntry, const CallICFGNode* caller = nullptr);
185
214
 
@@ -66,6 +66,19 @@ public:
66
66
  /// Dispatch to ValVar or ObjVar overload (checks ObjVar first due to inheritance).
67
67
  const AbstractValue& getAbstractValue(const SVFVar* var, const ICFGNode* node);
68
68
 
69
+ /// Check whether a ValVar has a real stored value reachable by
70
+ /// getAbstractValue. Unlike getAbstractValue, this is side-effect free
71
+ /// and does NOT treat the final top-fallback as "present" — so callers
72
+ /// that plan to write the fetched value back (e.g. cycle widen/narrow)
73
+ /// can distinguish a genuine stored value from the top sentinel.
74
+ bool hasAbstractValue(const ValVar* var, const ICFGNode* node) const;
75
+
76
+ /// Check whether an ObjVar has a stored value at node.
77
+ bool hasAbstractValue(const ObjVar* var, const ICFGNode* node) const;
78
+
79
+ /// Dispatch to ValVar or ObjVar overload.
80
+ bool hasAbstractValue(const SVFVar* var, const ICFGNode* node) const;
81
+
69
82
  /// Write a top-level variable's abstract value into abstractTrace[node].
70
83
  void updateAbstractValue(const ValVar* var, const AbstractValue& val, const ICFGNode* node);
71
84
 
@@ -80,10 +80,10 @@ public:
80
80
 
81
81
  /// Look up the ValVar id set of a WTO cycle. Returns nullptr if the
82
82
  /// cycle is unknown (e.g. dense mode, where the map is never built).
83
- const Set<NodeID>* getCycleValVars(const ICFGCycleWTO* cycle) const
83
+ const Set<const ValVar*> getCycleValVars(const ICFGCycleWTO* cycle) const
84
84
  {
85
85
  auto it = cycleToValVars.find(cycle);
86
- return it == cycleToValVars.end() ? nullptr : &it->second;
86
+ return it == cycleToValVars.end() ? Set<const ValVar*>() : it->second;
87
87
  }
88
88
 
89
89
  private:
@@ -98,7 +98,7 @@ private:
98
98
  /// Pre-computed (semi-sparse only) map from a WTO cycle to the IDs of
99
99
  /// every ValVar whose def-site is inside that cycle, including all
100
100
  /// nested sub-cycles. Empty in dense mode.
101
- Map<const ICFGCycleWTO*, Set<NodeID>> cycleToValVars;
101
+ Map<const ICFGCycleWTO*, Set<const ValVar*>> cycleToValVars;
102
102
  };
103
103
 
104
104
  } // End namespace SVF
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.2542",
3
+ "version": "1.0.2544",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {