3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-04 14:25:46 +00:00

moving to resource managed cancellation

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2015-12-11 17:46:22 -08:00
parent 1aea9722cb
commit 521271e559
11 changed files with 34 additions and 48 deletions

View file

@ -1610,6 +1610,7 @@ void cmd_context::validate_model() {
model_evaluator evaluator(*(md.get()), p);
contains_array_op_proc contains_array(m());
{
scoped_rlimit _rlimit(m().limit(), 0);
cancel_eh<reslimit> eh(m().limit());
expr_ref r(m());
scoped_ctrl_c ctrlc(eh);

View file

@ -35,7 +35,7 @@ context_params::context_params() {
m_smtlib2_compliant = false;
m_well_sorted_check = false;
m_timeout = UINT_MAX;
m_rlimit = UINT_MAX;
m_rlimit = 0;
updt_params();
}
@ -153,7 +153,7 @@ void context_params::updt_params(params_ref const & p) {
void context_params::collect_param_descrs(param_descrs & d) {
d.insert("timeout", CPK_UINT, "default timeout (in milliseconds) used for solvers", "4294967295");
d.insert("rlimit", CPK_UINT, "default resource limit used for solvers", "4294967295");
d.insert("rlimit", CPK_UINT, "default resource limit used for solvers. Unrestricted when set to 0.", "0");
d.insert("well_sorted_check", CPK_BOOL, "type checker", "false");
d.insert("type_check", CPK_BOOL, "type checker (alias for well_sorted_check)", "true");
d.insert("auto_config", CPK_BOOL, "use heuristics to automatically select solver and configure it", "true");

View file

@ -63,11 +63,13 @@ public:
last_result->get_model(md);
expr_ref r(ctx.m());
unsigned timeout = m_params.get_uint("timeout", UINT_MAX);
unsigned rlimit = m_params.get_uint("rlimit", 0);
model_evaluator ev(*(md.get()), m_params);
cancel_eh<reslimit> eh(ctx.m().limit());
{
scoped_ctrl_c ctrlc(eh);
scoped_timer timer(timeout, &eh);
scoped_rlimit _rlimit(ctx.m().limit(), rlimit);
cmd_context::scoped_watch sw(ctx);
try {
ev(m_target, r);

View file

@ -73,9 +73,11 @@ public:
unsigned cache_sz;
unsigned num_steps = 0;
unsigned timeout = m_params.get_uint("timeout", UINT_MAX);
unsigned rlimit = m_params.get_uint("rlimit", UINT_MAX);
bool failed = false;
cancel_eh<reslimit> eh(ctx.m().limit());
{
scoped_rlimit _rlimit(ctx.m().limit(), rlimit);
scoped_ctrl_c ctrlc(eh);
scoped_timer timer(timeout, &eh);
cmd_context::scoped_watch sw(ctx);

View file

@ -188,6 +188,7 @@ public:
tref->set_logic(ctx.get_logic());
ast_manager & m = ctx.m();
unsigned timeout = p.get_uint("timeout", UINT_MAX);
unsigned rlimit = p.get_uint("rlimit", 0);
goal_ref g = alloc(goal, m, ctx.produce_proofs(), ctx.produce_models(), ctx.produce_unsat_cores());
assert_exprs_from(ctx, *g);
TRACE("check_sat_using", g->display(tout););
@ -201,6 +202,7 @@ public:
tactic & t = *tref;
cancel_eh<reslimit> eh(m.limit());
{
scoped_rlimit _rlimit(m.limit(), rlimit);
scoped_ctrl_c ctrlc(eh);
scoped_timer timer(timeout, &eh);
cmd_context::scoped_watch sw(ctx);
@ -302,6 +304,7 @@ public:
assert_exprs_from(ctx, *g);
unsigned timeout = p.get_uint("timeout", UINT_MAX);
unsigned rlimit = p.get_uint("rlimit", 0);
goal_ref_buffer result_goals;
model_converter_ref mc;
@ -312,6 +315,7 @@ public:
bool failed = false;
cancel_eh<reslimit> eh(m.limit());
{
scoped_rlimit _rlimit(m.limit(), rlimit);
scoped_ctrl_c ctrlc(eh);
scoped_timer timer(timeout, &eh);
cmd_context::scoped_watch sw(ctx);