diff options
author | Morgan Deters <mdeters@gmail.com> | 2011-04-01 00:56:42 +0000 |
---|---|---|
committer | Morgan Deters <mdeters@gmail.com> | 2011-04-01 00:56:42 +0000 |
commit | 159cb7ee8b6f28f3784a3f24b371760c2ab77f86 (patch) | |
tree | d510bfa3e4977b5c532d9ab82b6cd5d9581365a3 /src/expr/node_manager.h | |
parent | ceca24424da629db2e133f7864b0bac03ad44829 (diff) |
This commit is a merge from the "betterstats" branch, which:
* Makes Options an "omnipresent thread-local global" (like the notion
of the "current NodeManager" was already). Options::current() accesses
this structure.
* Removes Options from constructors and data structures everywhere
(this cleans up a lot of things).
* No longer uses StatisticsRegistry statically. An instance of the
registry is created and linked to a NodeManager.
* StatisticsRegistry::current() is similar to Options::current(), but
the pointer is stowed in the NodeManager (rather than stored)
* The static functions of StatisticsRegistry have been left, for backward
compatibility; they now use the "current" statistics registry.
* SmtEngine::getStatisticsRegistry() is a public accessor for the
registry; this is needed by main() to reach in and get the registry,
for flushing statistics at the end.
Diffstat (limited to 'src/expr/node_manager.h')
-rw-r--r-- | src/expr/node_manager.h | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/src/expr/node_manager.h b/src/expr/node_manager.h index d8a690da5..36720bbb3 100644 --- a/src/expr/node_manager.h +++ b/src/expr/node_manager.h @@ -39,10 +39,11 @@ #include "context/context.h" #include "util/configuration_private.h" #include "util/tls.h" +#include "util/options.h" namespace CVC4 { -struct Options; +class StatisticsRegistry; namespace expr { @@ -77,6 +78,10 @@ class NodeManager { static CVC4_THREADLOCAL(NodeManager*) s_current; + const Options* d_optionsAllocated; + const Options* d_options; + StatisticsRegistry* d_statisticsRegistry; + NodeValuePool d_nodeValuePool; expr::attr::AttributeManager d_attrManager; @@ -120,12 +125,6 @@ class NodeManager { Node d_operators[kind::LAST_KIND]; /** - * Whether to do early type checking (only effective in debug - * builds; other builds never do early type checking). - */ - bool d_earlyTypeChecking; - - /** * Look up a NodeValue in the pool associated to this NodeManager. * The NodeValue argument need not be a "completely-constructed" * NodeValue. In particular, "non-inlined" constants are permitted @@ -247,7 +246,7 @@ class NodeManager { TypeNode computeType(TNode n, bool check = false) throw (TypeCheckingExceptionPrivate, AssertionException); - void init(const Options& options); + void init(); public: @@ -255,9 +254,19 @@ public: explicit NodeManager(context::Context* ctxt, const Options& options); ~NodeManager(); - /** The node manager in the current context. */ + /** The node manager in the current public-facing CVC4 library context */ static NodeManager* currentNM() { return s_current; } + /** Get this node manager's options */ + const Options* getOptions() const { + return d_options; + } + + /** Get this node manager's statistics registry */ + StatisticsRegistry* getStatisticsRegistry() const { + return d_statisticsRegistry; + } + // general expression-builders /** Create a node with one child. */ @@ -600,13 +609,19 @@ public: NodeManagerScope(NodeManager* nm) : d_oldNodeManager(NodeManager::s_current) { + // There are corner cases where nm can be NULL and it's ok. + // For example, if you write { Expr e; }, then when the null + // Expr is destructed, there's no active node manager. + //Assert(nm != NULL); NodeManager::s_current = nm; + Options::s_current = nm ? nm->d_options : NULL; Debug("current") << "node manager scope: " << NodeManager::s_current << "\n"; } ~NodeManagerScope() { NodeManager::s_current = d_oldNodeManager; + Options::s_current = d_oldNodeManager ? d_oldNodeManager->d_options : NULL; Debug("current") << "node manager scope: " << "returning to " << NodeManager::s_current << "\n"; } |