Hi Ted, This commit is causing clang/test/Analysis/taint-tester.c to fail. Chad
On Feb 16, 2012, at 12:19 PM, Ted Kremenek wrote: > Author: kremenek > Date: Thu Feb 16 14:19:30 2012 > New Revision: 150720 > > URL: http://llvm.org/viewvc/llvm-project?rev=150720&view=rev > Log: > Move ExplodedNode reclaimation out of ExprEngine and into CoreEngine. Also > have it based on adding predecessors/successors, not node allocation. No > measurable performance change. > > Modified: > cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h > cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp > cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp > cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp > > Modified: > cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h?rev=150720&r1=150719&r2=150720&view=diff > ============================================================================== > --- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h > (original) > +++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h > Thu Feb 16 14:19:30 2012 > @@ -25,6 +25,7 @@ > #include "llvm/ADT/SmallVector.h" > #include "llvm/ADT/FoldingSet.h" > #include "llvm/ADT/SmallPtrSet.h" > +#include "llvm/ADT/DenseSet.h" > #include "llvm/Support/Allocator.h" > #include "llvm/ADT/OwningPtr.h" > #include "llvm/ADT/GraphTraits.h" > @@ -240,6 +241,7 @@ > class ExplodedGraph { > protected: > friend class CoreEngine; > + friend class ExplodedNode; > > // Type definitions. > typedef std::vector<ExplodedNode *> NodeVector; > @@ -265,16 +267,13 @@ > unsigned NumNodes; > > /// A list of recently allocated nodes that can potentially be recycled. > - NodeVector ChangedNodes; > + llvm::DenseSet<ExplodedNode*> ChangedNodes; > > /// A list of nodes that can be reused. > NodeVector FreeNodes; > > /// A flag that indicates whether nodes should be recycled. > bool reclaimNodes; > - > - /// Counter to determine when to reclaim nodes. > - unsigned reclaimCounter; > > public: > > @@ -361,12 +360,12 @@ > llvm::DenseMap<const void*, const void*> *InverseMap) > const; > > /// Enable tracking of recently allocated nodes for potential reclamation > - /// when calling reclaimRecentlyAllocatedNodes(). > + /// when calling reclaimChangedNodes(). > void enableNodeReclamation() { reclaimNodes = true; } > > /// Reclaim "uninteresting" nodes created since the last time this method > /// was called. > - void reclaimRecentlyAllocatedNodes(); > + void reclaimChangedNodes(); > > private: > bool shouldCollect(const ExplodedNode *node); > > Modified: cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp?rev=150720&r1=150719&r2=150720&view=diff > ============================================================================== > --- cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp (original) > +++ cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp Thu Feb 16 14:19:30 2012 > @@ -192,6 +192,7 @@ > --Steps; > } > > + getGraph().reclaimChangedNodes(); > const WorkListUnit& WU = WList->dequeue(); > > // Set the current block counter. > > Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp?rev=150720&r1=150719&r2=150720&view=diff > ============================================================================== > --- cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp (original) > +++ cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp Thu Feb 16 14:19:30 > 2012 > @@ -45,10 +45,8 @@ > // Cleanup. > //===----------------------------------------------------------------------===// > > -static const unsigned CounterTop = 1000; > - > ExplodedGraph::ExplodedGraph() > - : NumNodes(0), reclaimNodes(false), reclaimCounter(CounterTop) {} > + : NumNodes(0), reclaimNodes(false) {} > > ExplodedGraph::~ExplodedGraph() {} > > @@ -127,19 +125,12 @@ > node->~ExplodedNode(); > } > > -void ExplodedGraph::reclaimRecentlyAllocatedNodes() { > +void ExplodedGraph::reclaimChangedNodes() { > if (ChangedNodes.empty()) > return; > > - // Only periodically relcaim nodes so that we can build up a set of > - // nodes that meet the reclamation criteria. Freshly created nodes > - // by definition have no successor, and thus cannot be reclaimed (see > below). > - assert(reclaimCounter > 0); > - if (--reclaimCounter != 0) > - return; > - reclaimCounter = CounterTop; > - > - for (NodeVector::iterator it = ChangedNodes.begin(), et = > ChangedNodes.end(); > + for (llvm::DenseSet<ExplodedNode*>::iterator it = > + ChangedNodes.begin(), et = ChangedNodes.end(); > it != et; ++it) { > ExplodedNode *node = *it; > if (shouldCollect(node)) > @@ -160,6 +151,12 @@ > assert (!V->isSink()); > Preds.addNode(V, G); > V->Succs.addNode(this, G); > + if (G.reclaimNodes) { > + if (Succs.size() == 1 && Preds.size() == 1) > + G.ChangedNodes.insert(this); > + if (V->Succs.size() == 1 && V->Preds.size() == 1) > + G.ChangedNodes.insert(V); > + } > #ifndef NDEBUG > if (NodeAuditor) NodeAuditor->AddEdge(V, this); > #endif > @@ -256,9 +253,6 @@ > > new (V) NodeTy(L, State, IsSink); > > - if (reclaimNodes) > - ChangedNodes.push_back(V); > - > // Insert the node into the node set and return it. > Nodes.InsertNode(V, InsertPos); > ++NumNodes; > > Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp?rev=150720&r1=150719&r2=150720&view=diff > ============================================================================== > --- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp (original) > +++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp Thu Feb 16 14:19:30 2012 > @@ -238,10 +238,7 @@ > } > > void ExprEngine::ProcessStmt(const CFGStmt S, > - ExplodedNode *Pred) { > - // Reclaim any unnecessary nodes in the ExplodedGraph. > - G.reclaimRecentlyAllocatedNodes(); > - > + ExplodedNode *Pred) { > currentStmt = S.getStmt(); > PrettyStackTraceLoc CrashInfo(getContext().getSourceManager(), > currentStmt->getLocStart(), > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
