svf-tools 1.0.1277 → 1.0.1279

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.1277",
3
+ "version": "1.0.1279",
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);
@@ -206,9 +212,12 @@ public:
206
212
 
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
- const std::vector<std::pair<hclust_fast_methods, std::vector<NodeID>>> &candidates,
210
- Map<PointsTo, unsigned> pointsToSets, const std::string &evalSubtitle, double &evalTime);
211
-
215
+ const std::vector<std::pair<hclust_fast_methods, std::vector<NodeID>>> &candidates,
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,7 @@ 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) { printStats(evalSubtitle + ": overall", overallStats); }
399
405
 
400
406
  return bestMapping.second;
401
407
  }
@@ -654,14 +660,18 @@ void NodeIDAllocator::Clusterer::evaluate(const std::vector<NodeID> &nodeMap, co
654
660
 
655
661
  // Work out which of the mappings we generated looks best.
656
662
  std::pair<hclust_fast_methods, std::vector<NodeID>> NodeIDAllocator::Clusterer::determineBestMapping(
657
- const std::vector<std::pair<hclust_fast_methods, std::vector<NodeID>>> &candidates,
658
- Map<PointsTo, unsigned> pointsToSets, const std::string &evalSubtitle, double &evalTime)
663
+ const std::vector<std::pair<hclust_fast_methods, std::vector<NodeID>>> &candidates,
664
+ Map<PointsTo, unsigned> pointsToSets,
665
+ const std::string &evalSubtitle,
666
+ double &evalTime,
667
+ bool printStat
668
+ )
659
669
  {
660
670
  // In case we're not comparing anything, set to first "candidate".
661
671
  std::pair<hclust_fast_methods, std::vector<NodeID>> bestMapping = candidates[0];
662
672
  // Number of bits required for the best candidate.
663
673
  size_t bestWords = std::numeric_limits<size_t>::max();
664
- if (evalSubtitle != "" || (enum hclust_fast_methods)Options::ClusterMethod() == HCLUST_METHOD_SVF_BEST)
674
+ if ((enum hclust_fast_methods)Options::ClusterMethod() == HCLUST_METHOD_SVF_BEST)
665
675
  {
666
676
  for (const std::pair<hclust_fast_methods, std::vector<NodeID>> &candidate : candidates)
667
677
  {
@@ -675,7 +685,7 @@ std::pair<hclust_fast_methods, std::vector<NodeID>> NodeIDAllocator::Clusterer::
675
685
  evaluate(candidateMapping, pointsToSets, candidateStats, true);
676
686
  const double clkEnd = PTAStat::getClk(true);
677
687
  evalTime += (clkEnd - clkStart) / TIMEINTERVAL;
678
- printStats(evalSubtitle + ": candidate " + candidateMethodName, candidateStats);
688
+ if (printStat) { printStats(evalSubtitle + ": candidate " + candidateMethodName, candidateStats); }
679
689
 
680
690
  size_t candidateWords = 0;
681
691
  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,7 @@ 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) { NodeIDAllocator::Clusterer::printStats("post-main", stats); }
444
443
  }
445
444
 
446
445
  /// sanitize field insensitive obj
@@ -917,7 +916,9 @@ void Andersen::cluster(void) const
917
916
 
918
917
  std::vector<std::pair<hclust_fast_methods, std::vector<NodeID>>> candidates;
919
918
  PointsTo::MappingPtr nodeMapping =
920
- std::make_shared<std::vector<NodeID>>(NodeIDAllocator::Clusterer::cluster(steens, keys, candidates, "aux-steens"));
919
+ std::make_shared<std::vector<NodeID>>(
920
+ NodeIDAllocator::Clusterer::cluster(steens, keys, candidates, "aux-steens", print_stat)
921
+ );
921
922
  PointsTo::MappingPtr reverseNodeMapping =
922
923
  std::make_shared<std::vector<NodeID>>(NodeIDAllocator::Clusterer::getReverseNodeMapping(*nodeMapping));
923
924
 
@@ -188,15 +188,7 @@ 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)
195
- {
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);
199
- }
191
+ if (print_stat) { NodeIDAllocator::Clusterer::printStats("post-main: best", stats); }
200
192
  }
201
193
 
202
194
  BVDataPTAImpl::finalize();
@@ -831,7 +823,9 @@ void FlowSensitive::cluster(void)
831
823
  keys.emplace_back(pair.first, 1);
832
824
 
833
825
  PointsTo::MappingPtr nodeMapping =
834
- std::make_shared<std::vector<NodeID>>(NodeIDAllocator::Clusterer::cluster(ander, keys, candidateMappings, "aux-ander"));
826
+ std::make_shared<std::vector<NodeID>>(
827
+ NodeIDAllocator::Clusterer::cluster(ander, keys, candidateMappings, "aux-ander", print_stat)
828
+ );
835
829
  PointsTo::MappingPtr reverseNodeMapping =
836
830
  std::make_shared<std::vector<NodeID>>(NodeIDAllocator::Clusterer::getReverseNodeMapping(*nodeMapping));
837
831
 
@@ -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