3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-18 09:12:16 +00:00

Optimize calls to Z3_eval_smtlib2_string (#6422)

* Allow reseting the stream of smt2::scanner

* Put the parser of parse_smt2_commands in the cmd_context

* Move parser streams to cmd_context

* Move parser fields from cmd_context to api::context

* Move forward declarations from cmd_context.h to api_context.h

* Change parse_smt2_commands_with_parser to use *& instead of **

* Add tests for Z3_eval_smtlib2_string

* Don't reuse the streams in Z3_eval_smtlib2_string

* Fix indentation

* Add back unnecessary deleted line

Co-authored-by: Nuno Lopes <nuno.lopes@tecnico.ulisboa.pt>
This commit is contained in:
Facundo Domínguez 2022-10-28 17:57:22 -03:00 committed by GitHub
parent a409a4a677
commit 91cdc082c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 154 additions and 9 deletions

View file

@ -50,6 +50,11 @@ namespace realclosure {
class manager;
};
namespace smt2 {
class parser;
void free_parser(parser*);
};
namespace api {
class seq_expr_solver : public expr_solver {
@ -233,6 +238,19 @@ namespace api {
void check_sorts(ast * n);
// ------------------------------------------------
//
// State reused by calls to Z3_eval_smtlib2_string
//
// ------------------------------------------------
//
// The m_parser field is reused by all calls of Z3_eval_smtlib2_string using this context.
// It is an optimization to save the cost of recreating these objects on each invocation.
//
// See https://github.com/Z3Prover/z3/pull/6422 for the motivation
smt2::parser* m_parser = nullptr;
// ------------------------
//
// Polynomial manager & caches