Use a single `NodeManager` per thread (#7204)
authorAndres Noetzli <andres.noetzli@gmail.com>
Fri, 17 Sep 2021 23:14:42 +0000 (16:14 -0700)
committerGitHub <noreply@github.com>
Fri, 17 Sep 2021 23:14:42 +0000 (23:14 +0000)
commit4209fb71c97c06833ef320ad9c73590546c16fa2
tree5155ab68258970de7485b5e3e65d3cd3f79d1078
parent1704b74ffa93b36a2e08e42ca21aad0991ad4d70
Use a single `NodeManager` per thread (#7204)

This changes cvc5 to use a single `NodeManager` per thread (using
`thread_local`). We have decided that this is more convenient because
nodes between solvers in the same thread could be exchanged and that
there isn't really an advantage of having multiple `NodeManager`s per
thread.

One wrinkle of this change is that `NodeManager::init()` must be called
explicitly before the `NodeManager` can be used. This code can currently
not be moved to the constructor of `NodeManager` because the code
indirectly calls `NodeManager::currentNM()`, which leads to a loop
because the `NodeManager` is created in `NodeManager::currentNM()`.
Further refactoring is required to get rid of this restriction.
23 files changed:
src/api/cpp/cvc5.cpp
src/api/cpp/cvc5.h
src/expr/node.h
src/expr/node_manager.cpp
src/expr/node_manager.h
src/expr/type_node.cpp
src/expr/type_node.h
src/main/main.cpp
src/smt/smt_engine.cpp
src/smt/smt_engine_scope.cpp
src/smt/smt_engine_scope.h
src/theory/arrays/theory_arrays_type_rules.cpp
src/theory/datatypes/theory_datatypes_type_rules.cpp
test/unit/node/node_black.cpp
test/unit/node/node_builder_black.cpp
test/unit/node/type_node_white.cpp
test/unit/preprocessing/pass_bv_gauss_white.cpp
test/unit/prop/cnf_stream_white.cpp
test/unit/test_env.h
test/unit/test_node.h
test/unit/test_smt.h
test/unit/theory/theory_arith_cad_white.cpp
test/unit/theory/theory_bags_type_rules_white.cpp