improve the support for deterministic tabling (still experimental,

problems mainly with the garbage collector)
This commit is contained in:
Ricardo Rocha
2009-08-07 17:29:53 +01:00
parent cc2c6dbe71
commit fc31e7066e
7 changed files with 105 additions and 49 deletions

View File

@@ -31,12 +31,12 @@
/* ----------------------- **
** default sizes **
** ----------------------- */
#define MAX_TABLE_VARS 100
#define MAX_TABLE_VARS 1000
/* ------------------------------------------ **
** trail freeze scheme (define one) **
** ------------------------------------------ */
#define BFZ_TRAIL_SCHEME 1
#define BFZ_TRAIL_SCHEME 1
/* #define BBREG_TRAIL_SCHEME 1 */
/* ------------------------------------------------ **

View File

@@ -811,7 +811,7 @@
sg_fr = GEN_CP(gcp)->cp_sg_fr;
subs_ptr = (CELL *)(GEN_CP(gcp) + 1) + PREG->u.s.s;
}
#ifdef TABLING_ERRORS
#if defined(TABLING_ERRORS) && !defined(DETERMINISTIC_TABLING)
{
int i, j, arity_args, arity_subs;
CELL *aux_args;
@@ -831,7 +831,7 @@
TABLING_ERROR_MESSAGE("j == arity_args (table_new_answer)");
}
}
#endif /* TABLING_ERRORS */
#endif /* TABLING_ERRORS && !DETERMINISTIC_TABLING */
#ifdef TABLE_LOCK_AT_ENTRY_LEVEL
LOCK(SgFr_lock(sg_fr));
#endif /* TABLE_LOCK_LEVEL */

View File

@@ -938,7 +938,12 @@ void CUT_validate_tg_answers(tg_sol_fr_ptr valid_solutions) {
while (valid_solutions) {
first_answer = last_answer = NULL;
sg_fr = GEN_CP(TgSolFr_gen_cp(valid_solutions))->cp_sg_fr;
#ifdef DETERMINISTIC_TABLING
if (IS_DET_GEN_CP(TgSolFr_gen_cp(valid_solutions)))
sg_fr = DET_GEN_CP(TgSolFr_gen_cp(valid_solutions))->cp_sg_fr;
else
#endif /* DETERMINISTIC_TABLING */
sg_fr = GEN_CP(TgSolFr_gen_cp(valid_solutions))->cp_sg_fr;
ltt_valid_solutions = valid_solutions;
valid_solutions = TgSolFr_next(valid_solutions);
do {

View File

@@ -46,7 +46,12 @@ void public_completion(void) {
sg_fr_ptr top_sg_fr;
/* complete subgoals */
top_sg_fr = SgFr_next(GEN_CP(LOCAL_top_cp)->cp_sg_fr);
#ifdef DETERMINISTIC_TABLING
if (IS_DET_GEN_CP(LOCAL_top_cp))
top_sg_fr = SgFr_next(DET_GEN_CP(LOCAL_top_cp)->cp_sg_fr);
else
#endif /* DETERMINISTIC_TABLING */
top_sg_fr = SgFr_next(GEN_CP(LOCAL_top_cp)->cp_sg_fr);
do {
mark_as_completed(LOCAL_top_sg_fr);
LOCAL_top_sg_fr = SgFr_next(LOCAL_top_sg_fr);