svf-lib 1.0.1497 → 1.0.1499

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.
@@ -140,11 +140,11 @@ public:
140
140
 
141
141
  VAddrs &getVAddrs(u32_t id) override
142
142
  {
143
- auto it = globalES._varToVAddrs.find(id);
144
- if (it != globalES._varToVAddrs.end())
143
+ auto it = _varToVAddrs.find(id);
144
+ if (it != _varToVAddrs.end())
145
145
  return it->second;
146
146
  else
147
- return _varToVAddrs[id];
147
+ return globalES._varToVAddrs[id];
148
148
  }
149
149
 
150
150
  inline bool inVarToIValTable(u32_t id) const
@@ -201,14 +201,24 @@ public:
201
201
  /// [], call getValueExpr()
202
202
  inline IntervalValue &operator[](u32_t varId)
203
203
  {
204
- auto it = globalES._varToItvVal.find(varId);
205
- if (it != globalES._varToItvVal.end())
204
+ auto localIt = _varToItvVal.find(varId);
205
+ if(localIt != _varToItvVal.end())
206
+ return localIt->second;
207
+ else
206
208
  {
207
- return it->second;
209
+ return globalES._varToItvVal[varId];
208
210
  }
209
- else
211
+ }
212
+
213
+ inline void cpyItvToLocal(u32_t varId)
214
+ {
215
+ auto localIt = _varToItvVal.find(varId);
216
+ // local already have varId
217
+ if (localIt != _varToItvVal.end()) return;
218
+ auto globIt = globalES._varToItvVal.find(varId);
219
+ if (globIt != globalES._varToItvVal.end())
210
220
  {
211
- return _varToItvVal[varId];
221
+ _varToItvVal[varId] = globIt->second;
212
222
  }
213
223
  }
214
224
 
@@ -370,16 +380,29 @@ public:
370
380
 
371
381
  static bool lessThanVarToValMap(const VarToValMap &lhs, const VarToValMap &rhs)
372
382
  {
383
+ if (lhs.empty()) return !rhs.empty();
373
384
  for (const auto &item: lhs)
374
385
  {
375
386
  auto it = rhs.find(item.first);
387
+ if (it == rhs.end()) return false;
376
388
  // judge from expr id
377
- if (!item.second.equals(it->second))
378
- {
379
- return !item.second.geq(it->second);
380
- }
389
+ if (item.second.geq(it->second)) return false;
381
390
  }
382
- return false;
391
+ return true;
392
+ }
393
+
394
+ // lhs >= rhs
395
+ static bool geqVarToValMap(const VarToValMap &lhs, const VarToValMap &rhs)
396
+ {
397
+ if (rhs.empty()) return true;
398
+ for (const auto &item: rhs)
399
+ {
400
+ auto it = lhs.find(item.first);
401
+ if (it == lhs.end()) return false;
402
+ // judge from expr id
403
+ if (!it->second.geq(item.second)) return false;
404
+ }
405
+ return true;
383
406
  }
384
407
 
385
408
  bool operator==(const IntervalExeState &rhs) const
@@ -395,15 +418,13 @@ public:
395
418
 
396
419
  bool operator<(const IntervalExeState &rhs) const
397
420
  {
398
- // judge from path constraint
399
- return (lessThanVarToValMap(_varToItvVal, rhs.getVarToVal()) ||
400
- lessThanVarToValMap(_locToItvVal, rhs.getLocToVal()));
421
+ return !(*this >= rhs);
401
422
  }
402
423
 
403
424
 
404
425
  bool operator>=(const IntervalExeState &rhs) const
405
426
  {
406
- return !(*this < rhs);
427
+ return geqVarToValMap(_varToItvVal, rhs.getVarToVal()) && geqVarToValMap(_locToItvVal, rhs.getLocToVal());
407
428
  }
408
429
 
409
430
  void clear()
@@ -438,9 +438,19 @@ public:
438
438
  }
439
439
  }
440
440
 
441
- std::string toString() const
441
+ const std::string toString() const
442
442
  {
443
- return "[" + lb().to_string() + ", " + ub().to_string() + "]";
443
+ std::string str;
444
+ std::stringstream rawStr(str);
445
+ if (this->isBottom())
446
+ {
447
+ rawStr << "⊥";
448
+ }
449
+ else
450
+ {
451
+ rawStr << "[" << lb().to_string() << ", " << ub().to_string() << "]";
452
+ }
453
+ return rawStr.str();
444
454
  }
445
455
 
446
456
  }; // end class IntervalValue
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.1497",
3
+ "version": "1.0.1499",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {