diff options
Diffstat (limited to 'src/expr/node_manager.cpp')
-rw-r--r-- | src/expr/node_manager.cpp | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/expr/node_manager.cpp b/src/expr/node_manager.cpp index 9006bf4d9..207f1f492 100644 --- a/src/expr/node_manager.cpp +++ b/src/expr/node_manager.cpp @@ -29,6 +29,7 @@ #include "util/Assert.h" #include "util/options.h" +#include "util/stats.h" #include "util/tls.h" #include <algorithm> @@ -84,22 +85,28 @@ struct NVReclaim { }; NodeManager::NodeManager(context::Context* ctxt) : - d_attrManager(ctxt) { - Options options; - init(options); + d_optionsAllocated(new Options()), + d_options(d_optionsAllocated), + d_statisticsRegistry(new StatisticsRegistry()), + d_attrManager(ctxt), + d_nodeUnderDeletion(NULL), + d_inReclaimZombies(false) { + init(); } NodeManager::NodeManager(context::Context* ctxt, const Options& options) : - d_attrManager(ctxt) { - init(options); + d_optionsAllocated(NULL), + d_options(&options), + d_statisticsRegistry(new StatisticsRegistry()), + d_attrManager(ctxt), + d_nodeUnderDeletion(NULL), + d_inReclaimZombies(false) { + init(); } -inline void NodeManager::init(const Options& options) { - d_nodeUnderDeletion = NULL; - d_inReclaimZombies = false; - d_earlyTypeChecking = options.earlyTypeChecking; +inline void NodeManager::init() { poolInsert( &expr::NodeValue::s_null ); for(unsigned i = 0; i < unsigned(kind::LAST_KIND); ++i) { @@ -145,6 +152,9 @@ NodeManager::~NodeManager() { } Debug("gc:leaks") << ":end:" << std::endl; } + + delete d_statisticsRegistry; + delete d_optionsAllocated; } void NodeManager::reclaimZombies() { @@ -440,7 +450,7 @@ TypeNode NodeManager::getType(TNode n, bool check) Debug("getType") << "getting type for " << n << std::endl; - if(needsCheck && !d_earlyTypeChecking) { + if(needsCheck && !d_options->earlyTypeChecking) { /* Iterate and compute the children bottom up. This avoids stack overflows in computeType() when the Node graph is really deep, which should only affect us when we're type checking lazily. */ |