svf-tools 1.0.1278 → 1.0.1280

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.1278",
3
+ "version": "1.0.1280",
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": {
@@ -163,7 +163,13 @@ public:
163
163
  /// or a subset, depending on the client's wish.
164
164
  /// TODO: interfaces are getting unwieldy, an initialised object may be better.
165
165
  /// TODO: kind of sucks pta can't be const here because getPts isn't.
166
- static std::vector<NodeID> cluster(BVDataPTAImpl *pta, const std::vector<std::pair<NodeID, unsigned>> keys, std::vector<std::pair<hclust_fast_methods, std::vector<NodeID>>> &candidates, std::string evalSubtitle="");
166
+ static std::vector<NodeID> cluster(
167
+ BVDataPTAImpl *pta,
168
+ const std::vector<std::pair<NodeID, unsigned>> keys,
169
+ std::vector<std::pair<hclust_fast_methods, std::vector<NodeID>>> &candidates,
170
+ std::string evalSubtitle="",
171
+ bool printStat=true
172
+ );
167
173
 
168
174
  // Returns a reverse node mapping for mapping generated by cluster().
169
175
  static std::vector<NodeID> getReverseNodeMapping(const std::vector<NodeID> &nodeMapping);
@@ -207,8 +213,11 @@ public:
207
213
  // From all the candidates, returns the best mapping for pointsToSets (points-to set -> # occurrences).
208
214
  static inline std::pair<hclust_fast_methods, std::vector<NodeID>> determineBestMapping(
209
215
  const std::vector<std::pair<hclust_fast_methods, std::vector<NodeID>>> &candidates,
210
- Map<PointsTo, unsigned> pointsToSets, const std::string &evalSubtitle, double &evalTime);
211
-
216
+ Map<PointsTo, unsigned> pointsToSets,
217
+ const std::string &evalSubtitle,
218
+ double &evalTime,
219
+ bool printStat
220
+ );
212
221
  };
213
222
  };
214
223
 
@@ -190,7 +190,13 @@ const std::string NodeIDAllocator::Clusterer::LargestRegion = "LargestRegion";
190
190
  const std::string NodeIDAllocator::Clusterer::BestCandidate = "BestCandidate";
191
191
  const std::string NodeIDAllocator::Clusterer::NumNonTrivialRegionObjects = "NumNonTrivObj";
192
192
 
193
- std::vector<NodeID> NodeIDAllocator::Clusterer::cluster(BVDataPTAImpl *pta, const std::vector<std::pair<NodeID, unsigned>> keys, std::vector<std::pair<hclust_fast_methods, std::vector<NodeID>>> &candidates, std::string evalSubtitle)
193
+ std::vector<NodeID> NodeIDAllocator::Clusterer::cluster(
194
+ BVDataPTAImpl *pta,
195
+ const std::vector<std::pair<NodeID, unsigned>> keys,
196
+ std::vector<std::pair<hclust_fast_methods, std::vector<NodeID>>> &candidates,
197
+ std::string evalSubtitle,
198
+ bool printStat
199
+ )
194
200
  {
195
201
  assert(pta != nullptr && "Clusterer::cluster: given null BVDataPTAImpl");
196
202
  assert(Options::NodeAllocStrat() == Strategy::DENSE && "Clusterer::cluster: only dense allocation clustering currently supported");
@@ -385,8 +391,8 @@ std::vector<NodeID> NodeIDAllocator::Clusterer::cluster(BVDataPTAImpl *pta, cons
385
391
  }
386
392
 
387
393
  // Work out which of the mappings we generated looks best.
388
- std::pair<hclust_fast_methods, std::vector<NodeID>> bestMapping = determineBestMapping(candidates, pointsToSets,
389
- evalSubtitle, evalTime);
394
+ std::pair<hclust_fast_methods, std::vector<NodeID>> bestMapping =
395
+ determineBestMapping(candidates, pointsToSets, evalSubtitle, evalTime, printStat);
390
396
 
391
397
  overallStats[DistanceMatrixTime] = std::to_string(distanceMatrixTime);
392
398
  overallStats[DendrogramTraversalTime] = std::to_string(dendrogramTraversalTime);
@@ -395,7 +401,10 @@ std::vector<NodeID> NodeIDAllocator::Clusterer::cluster(BVDataPTAImpl *pta, cons
395
401
  overallStats[TotalTime] = std::to_string(distanceMatrixTime + dendrogramTraversalTime + fastClusterTime + regioningTime + evalTime);
396
402
 
397
403
  overallStats[BestCandidate] = SVFUtil::hclustMethodToString(bestMapping.first);
398
- printStats(evalSubtitle + ": overall", overallStats);
404
+ if (printStat)
405
+ {
406
+ printStats(evalSubtitle + ": overall", overallStats);
407
+ }
399
408
 
400
409
  return bestMapping.second;
401
410
  }
@@ -655,13 +664,17 @@ void NodeIDAllocator::Clusterer::evaluate(const std::vector<NodeID> &nodeMap, co
655
664
  // Work out which of the mappings we generated looks best.
656
665
  std::pair<hclust_fast_methods, std::vector<NodeID>> NodeIDAllocator::Clusterer::determineBestMapping(
657
666
  const std::vector<std::pair<hclust_fast_methods, std::vector<NodeID>>> &candidates,
658
- Map<PointsTo, unsigned> pointsToSets, const std::string &evalSubtitle, double &evalTime)
667
+ Map<PointsTo, unsigned> pointsToSets,
668
+ const std::string &evalSubtitle,
669
+ double &evalTime,
670
+ bool printStat
671
+ )
659
672
  {
660
673
  // In case we're not comparing anything, set to first "candidate".
661
674
  std::pair<hclust_fast_methods, std::vector<NodeID>> bestMapping = candidates[0];
662
675
  // Number of bits required for the best candidate.
663
676
  size_t bestWords = std::numeric_limits<size_t>::max();
664
- if (evalSubtitle != "" || (enum hclust_fast_methods)Options::ClusterMethod() == HCLUST_METHOD_SVF_BEST)
677
+ if ((enum hclust_fast_methods)Options::ClusterMethod() == HCLUST_METHOD_SVF_BEST)
665
678
  {
666
679
  for (const std::pair<hclust_fast_methods, std::vector<NodeID>> &candidate : candidates)
667
680
  {
@@ -675,7 +688,10 @@ std::pair<hclust_fast_methods, std::vector<NodeID>> NodeIDAllocator::Clusterer::
675
688
  evaluate(candidateMapping, pointsToSets, candidateStats, true);
676
689
  const double clkEnd = PTAStat::getClk(true);
677
690
  evalTime += (clkEnd - clkStart) / TIMEINTERVAL;
678
- printStats(evalSubtitle + ": candidate " + candidateMethodName, candidateStats);
691
+ if (printStat)
692
+ {
693
+ printStats(evalSubtitle + ": candidate " + candidateMethodName, candidateStats);
694
+ }
679
695
 
680
696
  size_t candidateWords = 0;
681
697
  if (Options::PtType() == PointsTo::SBV) candidateWords = std::stoull(candidateStats[NewSbvNumWords]);
@@ -431,7 +431,6 @@ void Andersen::initialize()
431
431
  */
432
432
  void Andersen::finalize()
433
433
  {
434
- // TODO: check -stat too.
435
434
  // TODO: broken
436
435
  if (Options::ClusterAnder())
437
436
  {
@@ -440,7 +439,10 @@ void Andersen::finalize()
440
439
  // TODO: should we use liveOnly?
441
440
  // TODO: parameterise final arg.
442
441
  NodeIDAllocator::Clusterer::evaluate(*PointsTo::getCurrentBestNodeMapping(), ptd->getAllPts(true), stats, true);
443
- NodeIDAllocator::Clusterer::printStats("post-main", stats);
442
+ if (print_stat)
443
+ {
444
+ NodeIDAllocator::Clusterer::printStats("post-main", stats);
445
+ }
444
446
  }
445
447
 
446
448
  /// sanitize field insensitive obj
@@ -917,7 +919,9 @@ void Andersen::cluster(void) const
917
919
 
918
920
  std::vector<std::pair<hclust_fast_methods, std::vector<NodeID>>> candidates;
919
921
  PointsTo::MappingPtr nodeMapping =
920
- std::make_shared<std::vector<NodeID>>(NodeIDAllocator::Clusterer::cluster(steens, keys, candidates, "aux-steens"));
922
+ std::make_shared<std::vector<NodeID>>(
923
+ NodeIDAllocator::Clusterer::cluster(steens, keys, candidates, "aux-steens", print_stat)
924
+ );
921
925
  PointsTo::MappingPtr reverseNodeMapping =
922
926
  std::make_shared<std::vector<NodeID>>(NodeIDAllocator::Clusterer::getReverseNodeMapping(*nodeMapping));
923
927
 
@@ -188,14 +188,9 @@ void FlowSensitive::finalize()
188
188
  Map<PointsTo, unsigned> allPts = ptd->getAllPts(true);
189
189
  // TODO: parameterise final arg.
190
190
  NodeIDAllocator::Clusterer::evaluate(*PointsTo::getCurrentBestNodeMapping(), allPts, stats, true);
191
- NodeIDAllocator::Clusterer::printStats("post-main: best", stats);
192
-
193
- // Do the same for the candidates. TODO: probably temporary for eval. purposes.
194
- for (std::pair<hclust_fast_methods, std::vector<NodeID>> &candidate : candidateMappings)
191
+ if (print_stat)
195
192
  {
196
- // Can reuse stats, since we're always filling it with `evaluate`, it will always be overwritten.
197
- NodeIDAllocator::Clusterer::evaluate(candidate.second, allPts, stats, true);
198
- NodeIDAllocator::Clusterer::printStats("post-main: candidate " + SVFUtil::hclustMethodToString(candidate.first), stats);
193
+ NodeIDAllocator::Clusterer::printStats("post-main: best", stats);
199
194
  }
200
195
  }
201
196
 
@@ -831,7 +826,9 @@ void FlowSensitive::cluster(void)
831
826
  keys.emplace_back(pair.first, 1);
832
827
 
833
828
  PointsTo::MappingPtr nodeMapping =
834
- std::make_shared<std::vector<NodeID>>(NodeIDAllocator::Clusterer::cluster(ander, keys, candidateMappings, "aux-ander"));
829
+ std::make_shared<std::vector<NodeID>>(
830
+ NodeIDAllocator::Clusterer::cluster(ander, keys, candidateMappings, "aux-ander", print_stat)
831
+ );
835
832
  PointsTo::MappingPtr reverseNodeMapping =
836
833
  std::make_shared<std::vector<NodeID>>(NodeIDAllocator::Clusterer::getReverseNodeMapping(*nodeMapping));
837
834
 
@@ -791,7 +791,9 @@ void VersionedFlowSensitive::cluster(void)
791
791
  }
792
792
 
793
793
  PointsTo::MappingPtr nodeMapping =
794
- std::make_shared<std::vector<NodeID>>(NodeIDAllocator::Clusterer::cluster(ander, keys, candidateMappings, "aux-ander"));
794
+ std::make_shared<std::vector<NodeID>>(
795
+ NodeIDAllocator::Clusterer::cluster(ander, keys, candidateMappings, "aux-ander", print_stat)
796
+ );
795
797
  PointsTo::MappingPtr reverseNodeMapping =
796
798
  std::make_shared<std::vector<NodeID>>(NodeIDAllocator::Clusterer::getReverseNodeMapping(*nodeMapping));
797
799