The remaining calls to smt::currentResourceManager are in the bitblasters, which should probably update to Env. FYI @mpreiner .
new theory::Evaluator(nullptr, d_options.strings.stringsAlphaCard));
d_statisticsRegistry->registerTimer("global::totalTime").start();
d_resourceManager = std::make_unique<ResourceManager>(*d_statisticsRegistry, d_options);
+ d_rewriter->d_resourceManager = d_resourceManager.get();
}
Env::~Env() {}
d_bbRegistrar.get(),
d_nullContext.get(),
nullptr,
- smt::currentResourceManager(),
+ d_env.getResourceManager(),
prop::FormulaLitPolicy::INTERNAL,
"theory::bv::BVSolverBitblast"));
}
vector<RewriteStackElement> rewriteStack;
rewriteStack.push_back(RewriteStackElement(node, theoryId));
- ResourceManager* rm = NULL;
- bool hasSlvEngine = smt::solverEngineInScope();
- if (hasSlvEngine)
- {
- rm = smt::currentResourceManager();
- }
// Rewrite until the stack is empty
for (;;){
- if (hasSlvEngine)
+ if (d_resourceManager != nullptr)
{
- rm->spendResource(Resource::RewriteStep);
+ d_resourceManager->spendResource(Resource::RewriteStep);
}
// Get the top of the recursion stack
* The main rewriter class.
*/
class Rewriter {
- friend class cvc5::Env; // to initialize the evaluators of this class
+ friend class cvc5::Env; // to set the resource manager
public:
Rewriter();
void clearCachesInternal();
+ /** The resource manager, for tracking resource usage */
+ ResourceManager* d_resourceManager;
+
/** Theory rewriters used by this rewriter instance */
TheoryRewriter* d_theoryRewriters[theory::THEORY_LAST];
}
}
-Rewriter::Rewriter() : d_tpg(nullptr) {}
+Rewriter::Rewriter() : d_resourceManager(nullptr), d_tpg(nullptr) {}
void Rewriter::clearCachesInternal()
{
#include "theory/theory_inference_manager.h"
#include "smt/smt_statistics_registry.h"
-#include "smt/solver_engine_scope.h"
#include "theory/output_channel.h"
#include "theory/rewriter.h"
#include "theory/theory.h"
void TheoryInferenceManager::trustedConflict(TrustNode tconf, InferenceId id)
{
d_conflictIdStats << id;
- smt::currentResourceManager()->spendResource(id);
+ resourceManager()->spendResource(id);
Trace("im") << "(conflict " << id << " " << tconf.getProven() << ")"
<< std::endl;
d_out.trustedConflict(tconf);
}
}
d_lemmaIdStats << id;
- smt::currentResourceManager()->spendResource(id);
+ resourceManager()->spendResource(id);
Trace("im") << "(lemma " << id << " " << tlem.getProven() << ")" << std::endl;
// shouldn't send trivially true or false lemmas
Assert(!Rewriter::rewrite(tlem.getProven()).isConst());
ProofGenerator* pg)
{
d_factIdStats << iid;
- smt::currentResourceManager()->spendResource(iid);
+ resourceManager()->spendResource(iid);
// make the node corresponding to the explanation
Node expn = NodeManager::currentNM()->mkAnd(exp);
Trace("im") << "(fact " << iid << " " << (pol ? Node(atom) : atom.notNode())