mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 01:25:31 +00:00
merged with unstable
This commit is contained in:
commit
3a0947b3ba
413 changed files with 31618 additions and 17204 deletions
|
@ -31,6 +31,8 @@ Revision History:
|
|||
#include"dl_mk_filter_rules.h"
|
||||
#include"dl_finite_product_relation.h"
|
||||
#include"dl_context.h"
|
||||
#include"rel_context.h"
|
||||
#include"dl_register_engine.h"
|
||||
#include"datalog_parser.h"
|
||||
#include"datalog_frontend.h"
|
||||
#include"timeout.h"
|
||||
|
@ -43,17 +45,7 @@ static datalog::context * g_ctx = 0;
|
|||
static datalog::rule_set * g_orig_rules;
|
||||
static datalog::instruction_block * g_code;
|
||||
static datalog::execution_context * g_ectx;
|
||||
static smt_params * g_params;
|
||||
|
||||
datalog_params::datalog_params():
|
||||
m_default_table("sparse"),
|
||||
m_default_table_checked(false)
|
||||
{}
|
||||
|
||||
// void datalog_params::register_params(ini_params& p) {
|
||||
// p.register_symbol_param("DEFAULT_TABLE", m_default_table, "Datalog engine: default table (sparse)");
|
||||
// p.register_bool_param("DEFAULT_TABLE_CHECKED", m_default_table_checked, "Wrap default table with a sanity checker");
|
||||
// }
|
||||
|
||||
static void display_statistics(
|
||||
std::ostream& out,
|
||||
|
@ -61,7 +53,6 @@ static void display_statistics(
|
|||
datalog::rule_set& orig_rules,
|
||||
datalog::instruction_block& code,
|
||||
datalog::execution_context& ex_ctx,
|
||||
smt_params& params,
|
||||
bool verbose
|
||||
)
|
||||
{
|
||||
|
@ -86,7 +77,7 @@ static void display_statistics(
|
|||
|
||||
out << "--------------\n";
|
||||
out << "instructions \n";
|
||||
code.display(ctx.get_rel_context(), out);
|
||||
code.display(*ctx.get_rel_context(), out);
|
||||
|
||||
out << "--------------\n";
|
||||
out << "big relations \n";
|
||||
|
@ -94,7 +85,7 @@ static void display_statistics(
|
|||
}
|
||||
out << "--------------\n";
|
||||
out << "relation sizes\n";
|
||||
ctx.get_rel_context().get_rmanager().display_relation_sizes(out);
|
||||
ctx.get_rel_context()->get_rmanager().display_relation_sizes(out);
|
||||
|
||||
if (verbose) {
|
||||
out << "--------------\n";
|
||||
|
@ -109,7 +100,7 @@ static void display_statistics(
|
|||
|
||||
static void display_statistics() {
|
||||
if (g_ctx) {
|
||||
display_statistics(std::cout, *g_ctx, *g_orig_rules, *g_code, *g_ectx, *g_params, true);
|
||||
display_statistics(std::cout, *g_ctx, *g_orig_rules, *g_code, *g_ectx, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,19 +118,17 @@ static void on_ctrl_c(int) {
|
|||
|
||||
unsigned read_datalog(char const * file) {
|
||||
IF_VERBOSE(1, verbose_stream() << "Z3 Datalog Engine\n";);
|
||||
datalog_params dl_params;
|
||||
smt_params s_params;
|
||||
ast_manager m;
|
||||
datalog::register_engine re;
|
||||
g_overall_time.start();
|
||||
register_on_timeout_proc(on_timeout);
|
||||
signal(SIGINT, on_ctrl_c);
|
||||
params_ref params;
|
||||
params.set_sym("engine", symbol("datalog"));
|
||||
params.set_sym("default_table", dl_params.m_default_table);
|
||||
params.set_bool("default_table_checked", dl_params.m_default_table_checked);
|
||||
|
||||
datalog::context ctx(m, s_params, params);
|
||||
datalog::relation_manager & rmgr = ctx.get_rel_context().get_rmanager();
|
||||
datalog::context ctx(m, re, s_params, params);
|
||||
datalog::relation_manager & rmgr = ctx.get_rel_context()->get_rmanager();
|
||||
datalog::relation_plugin & inner_plg = *rmgr.get_relation_plugin(symbol("tr_hashtable"));
|
||||
SASSERT(&inner_plg);
|
||||
rmgr.register_plugin(alloc(datalog::finite_product_relation_plugin, inner_plg, rmgr));
|
||||
|
@ -175,8 +164,6 @@ unsigned read_datalog(char const * file) {
|
|||
TRACE("dl_compiler", ctx.display(tout););
|
||||
|
||||
datalog::rule_set original_rules(ctx.get_rules());
|
||||
datalog::decl_set original_predicates;
|
||||
ctx.collect_predicates(original_predicates);
|
||||
|
||||
datalog::instruction_block rules_code;
|
||||
datalog::instruction_block termination_code;
|
||||
|
@ -188,7 +175,6 @@ unsigned read_datalog(char const * file) {
|
|||
g_orig_rules = &original_rules;
|
||||
g_code = &rules_code;
|
||||
g_ectx = &ex_ctx;
|
||||
g_params = &s_params;
|
||||
|
||||
try {
|
||||
g_piece_timer.reset();
|
||||
|
@ -196,22 +182,19 @@ unsigned read_datalog(char const * file) {
|
|||
|
||||
bool early_termination;
|
||||
unsigned timeout = ctx.initial_restart_timeout();
|
||||
if(timeout == 0) {
|
||||
if (timeout == 0) {
|
||||
timeout = UINT_MAX;
|
||||
}
|
||||
do {
|
||||
model_converter_ref mc; // ignored
|
||||
proof_converter_ref pc; // ignored
|
||||
ctx.transform_rules(mc, pc);
|
||||
ctx.get_rel_context()->transform_rules();
|
||||
|
||||
datalog::compiler::compile(ctx, ctx.get_rules(), rules_code, termination_code);
|
||||
|
||||
TRACE("dl_compiler", rules_code.display(ctx.get_rel_context(), tout););
|
||||
TRACE("dl_compiler", rules_code.display(*ctx.get_rel_context(), tout););
|
||||
|
||||
rules_code.make_annotations(ex_ctx);
|
||||
|
||||
ex_ctx.set_timelimit(timeout);
|
||||
SASSERT(!ex_ctx.should_terminate());
|
||||
|
||||
early_termination = !rules_code.perform(ex_ctx);
|
||||
if(early_termination) {
|
||||
|
@ -240,7 +223,6 @@ unsigned read_datalog(char const * file) {
|
|||
termination_code.reset();
|
||||
ex_ctx.reset();
|
||||
ctx.reopen();
|
||||
ctx.restrict_predicates(original_predicates);
|
||||
ctx.replace_rules(original_rules);
|
||||
ctx.close();
|
||||
}
|
||||
|
@ -248,19 +230,17 @@ unsigned read_datalog(char const * file) {
|
|||
|
||||
|
||||
TRACE("dl_compiler", ctx.display(tout);
|
||||
rules_code.display(ctx.get_rel_context(), tout););
|
||||
rules_code.display(*ctx.get_rel_context(), tout););
|
||||
|
||||
if (ctx.get_params().output_tuples()) {
|
||||
ctx.get_rel_context().display_output_facts(std::cout);
|
||||
if (ctx.output_tuples()) {
|
||||
ctx.get_rel_context()->display_output_facts(ctx.get_rules(), std::cout);
|
||||
}
|
||||
|
||||
display_statistics(
|
||||
std::cout,
|
||||
ctx,
|
||||
original_rules,
|
||||
rules_code,
|
||||
ex_ctx,
|
||||
s_params,
|
||||
false);
|
||||
|
||||
}
|
||||
|
@ -272,7 +252,6 @@ unsigned read_datalog(char const * file) {
|
|||
original_rules,
|
||||
rules_code,
|
||||
ex_ctx,
|
||||
s_params,
|
||||
true);
|
||||
return ERR_MEMOUT;
|
||||
}
|
||||
|
|
|
@ -19,11 +19,6 @@ Revision History:
|
|||
#ifndef _DATALOG_FRONTEND_H_
|
||||
#define _DATALOG_FRONTEND_H_
|
||||
|
||||
struct datalog_params {
|
||||
symbol m_default_table;
|
||||
bool m_default_table_checked;
|
||||
datalog_params();
|
||||
};
|
||||
|
||||
unsigned read_datalog(char const * file);
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ Revision History:
|
|||
#include"z3_log_frontend.h"
|
||||
#include"warning.h"
|
||||
#include"version.h"
|
||||
#include"datalog_frontend.h"
|
||||
#include"dimacs_frontend.h"
|
||||
#include"datalog_frontend.h"
|
||||
#include"timeout.h"
|
||||
#include"z3_exception.h"
|
||||
#include"error_codes.h"
|
||||
|
|
|
@ -55,13 +55,19 @@ static void display_statistics() {
|
|||
}
|
||||
|
||||
static void on_timeout() {
|
||||
display_statistics();
|
||||
exit(0);
|
||||
#pragma omp critical (g_display_stats)
|
||||
{
|
||||
display_statistics();
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
static void on_ctrl_c(int) {
|
||||
signal (SIGINT, SIG_DFL);
|
||||
display_statistics();
|
||||
#pragma omp critical (g_display_stats)
|
||||
{
|
||||
display_statistics();
|
||||
}
|
||||
raise(SIGINT);
|
||||
}
|
||||
|
||||
|
@ -84,9 +90,12 @@ unsigned read_smtlib_file(char const * benchmark_file) {
|
|||
}
|
||||
}
|
||||
|
||||
display_statistics();
|
||||
register_on_timeout_proc(0);
|
||||
g_solver = 0;
|
||||
#pragma omp critical (g_display_stats)
|
||||
{
|
||||
display_statistics();
|
||||
register_on_timeout_proc(0);
|
||||
g_solver = 0;
|
||||
}
|
||||
return solver.get_error_code();
|
||||
}
|
||||
|
||||
|
@ -105,7 +114,6 @@ unsigned read_smtlib2_commands(char const * file_name) {
|
|||
install_subpaving_cmds(ctx);
|
||||
|
||||
g_cmd_context = &ctx;
|
||||
register_on_timeout_proc(on_timeout);
|
||||
signal(SIGINT, on_ctrl_c);
|
||||
|
||||
bool result = true;
|
||||
|
@ -121,8 +129,12 @@ unsigned read_smtlib2_commands(char const * file_name) {
|
|||
result = parse_smt2_commands(ctx, std::cin, true);
|
||||
}
|
||||
|
||||
display_statistics();
|
||||
g_cmd_context = 0;
|
||||
|
||||
#pragma omp critical (g_display_stats)
|
||||
{
|
||||
display_statistics();
|
||||
g_cmd_context = 0;
|
||||
}
|
||||
return result ? 0 : 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue