include cp_h field in deterministic choice points, otherwise we get in trouble

This commit is contained in:
Ricardo Rocha 2009-08-09 03:38:07 +01:00
parent 4f6676e5af
commit 23d44f959d
4 changed files with 15 additions and 30 deletions

View File

@ -1914,10 +1914,7 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose)
current_B = gc_B;
prev_HB = HB;
#endif
#ifdef DETERMINISTIC_TABLING
if (!IS_DET_GEN_CP(gc_B))
#endif /* DETERMINISTIC_TABLING */
HB = gc_B->cp_h;
HB = gc_B->cp_h;
#ifdef INSTRUMENT_GC
num_bs++;
#endif
@ -1960,9 +1957,6 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose)
}
#endif
}
#ifdef DETERMINISTIC_TABLING
if (!IS_DET_GEN_CP(gc_B))
#endif /* DETERMINISTIC_TABLING */
{
/* find out how many cells are still alive in the trail */
mark_trail(saved_TR, gc_B->cp_tr, gc_B->cp_h, gc_B);
@ -3181,15 +3175,6 @@ update_B_H( choiceptr gc_B, CELL *current, CELL *dest, CELL *odest
dep_fr_ptr depfr = *depfrp;
#endif /* TABLING */
#ifdef DETERMINISTIC_TABLING
while (IS_DET_GEN_CP(gc_B))
gc_B = gc_B->cp_b;
/* make sure we include consumers */
if (depfr && gc_B >= DepFr_cons_cp(depfr)) {
gc_B = DepFr_cons_cp(depfr);
*depfrp = depfr = DepFr_next(depfr);
}
#endif /* DETERMINISTIC_TABLING */
while (gc_B && current <= gc_B->cp_h) {
if (gc_B->cp_h == current) {
gc_B->cp_h = dest;
@ -3198,10 +3183,6 @@ update_B_H( choiceptr gc_B, CELL *current, CELL *dest, CELL *odest
}
gc_B = gc_B->cp_b;
#ifdef TABLING
#ifdef DETERMINISTIC_TABLING
while (IS_DET_GEN_CP(gc_B))
gc_B = gc_B->cp_b;
#endif /* DETERMINISTIC_TABLING */
/* make sure we include consumers */
if (depfr && gc_B >= DepFr_cons_cp(depfr)) {
gc_B = DepFr_cons_cp(depfr);

View File

@ -816,6 +816,7 @@ struct deterministic_choicept {
int cp_lub; /* local untried branches */
struct or_frame *cp_or_fr; /* or-frame pointer */
#endif /* YAPOR */
CELL *cp_h; /* necessary, otherwise we get in trouble */
};
typedef struct choicept {

View File

@ -39,15 +39,20 @@
#define BFZ_TRAIL_SCHEME 1
/* #define BBREG_TRAIL_SCHEME 1 */
/* ----------------------------------------------- **
** support early completion ? (optional) **
** ----------------------------------------------- */
#define TABLING_EARLY_COMPLETION 1
/* ------------------------------------------------ **
** support trie compact pairs? (optional) **
** ------------------------------------------------ */
/* #define TRIE_COMPACT_PAIRS 1 */
/* ----------------------------------------------- **
** support early completion ? (optional) **
** ----------------------------------------------- */
#define TABLING_EARLY_COMPLETION 1
/* --------------------------------------------------- **
** support deterministic tabling? (optional) **
** --------------------------------------------------- */
/* #define DETERMINISTIC_TABLING 1 */
/* ------------------------------------------------ **
** limit the table space size? (optional) **
@ -59,11 +64,6 @@
** ------------------------------------------------ */
/* #define INCOMPLETE_TABLING 1 */
/* --------------------------------------------------- **
** support deterministic tabling? (optional) **
** --------------------------------------------------- */
/* #define DETERMINISTIC_TABLING 1 */
/* ---------------------------------------- -- **
** enable error checking? (optional) **
** ------------------------------------------- */

View File

@ -95,9 +95,10 @@
/* store deterministic generator choice point */ \
HBREG = H; \
store_yaam_reg_cpdepth(gcp); \
gcp->cp_tr = TR; \
gcp->cp_ap = COMPLETION; \
gcp->cp_b = B; \
gcp->cp_tr = TR; \
gcp->cp_h = H; \
DET_GEN_CP(gcp)->cp_sg_fr = SG_FR; \
store_low_level_trace_info(DET_GEN_CP(gcp), TAB_ENT); \
set_cut((CELL *)gcp, B); \
@ -748,6 +749,7 @@
choiceptr gcp = NORM_CP(DET_GEN_CP(subs_ptr) - 1);
sg_fr_ptr sg_fr = GEN_CP(B)->cp_sg_fr;
DET_GEN_CP(gcp)->cp_sg_fr = sg_fr;
gcp->cp_h = B->cp_h;
#ifdef DEPTH_LIMIT
gcp->cp_depth = B->cp_depth;
#endif /* DEPTH_LIMIT */
@ -775,6 +777,7 @@
choiceptr gcp = NORM_CP(DET_GEN_CP(subs_ptr) - 1);
sg_fr_ptr sg_fr = GEN_CP(B)->cp_sg_fr;
DET_GEN_CP(gcp)->cp_sg_fr = sg_fr;
gcp->cp_h = B->cp_h;
#ifdef DEPTH_LIMIT
gcp->cp_depth = B->cp_depth;
#endif /* DEPTH_LIMIT */