YapTab: support for early completion
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2239 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
511181b472
commit
9a841991ea
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
Copyright: R. Rocha and NCC - University of Porto, Portugal
|
Copyright: R. Rocha and NCC - University of Porto, Portugal
|
||||||
File: tab.insts.i
|
File: tab.insts.i
|
||||||
version: $Id: tab.insts.i,v 1.24 2007-04-26 14:11:08 ricroc Exp $
|
version: $Id: tab.insts.i,v 1.25 2008-05-20 18:25:37 ricroc Exp $
|
||||||
|
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
@ -36,8 +36,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#define store_generator_node(TAB_ENT, SG_FR, ARITY, AP) \
|
#define store_generator_node(TAB_ENT, SG_FR, ARITY, AP) \
|
||||||
{ register int subs_arity = *YENV; \
|
{ register CELL *pt_args; \
|
||||||
register CELL *pt_args; \
|
|
||||||
register choiceptr gcp; \
|
register choiceptr gcp; \
|
||||||
/* store args */ \
|
/* store args */ \
|
||||||
pt_args = XREGS + (ARITY); \
|
pt_args = XREGS + (ARITY); \
|
||||||
@ -54,13 +53,13 @@
|
|||||||
/* store generator choice point */ \
|
/* store generator choice point */ \
|
||||||
HBREG = H; \
|
HBREG = H; \
|
||||||
store_yaam_reg_cpdepth(gcp); \
|
store_yaam_reg_cpdepth(gcp); \
|
||||||
gcp->cp_tr = TR; \
|
gcp->cp_tr = TR; \
|
||||||
gcp->cp_ap = (yamop *)(AP); \
|
gcp->cp_ap = (yamop *)(AP); \
|
||||||
gcp->cp_h = H; \
|
gcp->cp_h = H; \
|
||||||
gcp->cp_b = B; \
|
gcp->cp_b = B; \
|
||||||
gcp->cp_env = ENV; \
|
gcp->cp_env = ENV; \
|
||||||
gcp->cp_cp = CPREG; \
|
gcp->cp_cp = CPREG; \
|
||||||
if (subs_arity && IsMode_Local(TabEnt_mode(TAB_ENT))) { \
|
if (IsMode_Local(TabEnt_mode(TAB_ENT))) { \
|
||||||
/* go local */ \
|
/* go local */ \
|
||||||
register dep_fr_ptr new_dep_fr; \
|
register dep_fr_ptr new_dep_fr; \
|
||||||
/* adjust freeze registers */ \
|
/* adjust freeze registers */ \
|
||||||
@ -935,6 +934,12 @@
|
|||||||
#endif /* TABLING_ERRORS */
|
#endif /* TABLING_ERRORS */
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK(SgFr_lock(sg_fr));
|
||||||
if (IS_BATCHED_GEN_CP(gcp)) {
|
if (IS_BATCHED_GEN_CP(gcp)) {
|
||||||
|
/* if the number of substitution variables is zero,
|
||||||
|
an answer is sufficient to perform an early completion */
|
||||||
|
if (*subs_ptr == 0 && gcp->cp_ap != NULL) {
|
||||||
|
gcp->cp_ap = COMPLETION;
|
||||||
|
mark_as_completed(sg_fr);
|
||||||
|
}
|
||||||
/* deallocate and procceed */
|
/* deallocate and procceed */
|
||||||
PREG = (yamop *) YENV[E_CP];
|
PREG = (yamop *) YENV[E_CP];
|
||||||
PREFETCH_OP(PREG);
|
PREFETCH_OP(PREG);
|
||||||
@ -946,6 +951,12 @@
|
|||||||
#endif /* DEPTH_LIMIT */
|
#endif /* DEPTH_LIMIT */
|
||||||
GONext();
|
GONext();
|
||||||
} else {
|
} else {
|
||||||
|
/* if the number of substitution variables is zero,
|
||||||
|
an answer is sufficient to perform an early completion */
|
||||||
|
if (*subs_ptr == 0 && gcp->cp_ap != ANSWER_RESOLUTION) {
|
||||||
|
gcp->cp_ap = COMPLETION;
|
||||||
|
mark_as_completed(sg_fr);
|
||||||
|
}
|
||||||
/* fail */
|
/* fail */
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
Copyright: R. Rocha and NCC - University of Porto, Portugal
|
Copyright: R. Rocha and NCC - University of Porto, Portugal
|
||||||
File: tab.tries.C
|
File: tab.tries.C
|
||||||
version: $Id: tab.tries.c,v 1.23 2008-05-05 17:09:37 ricroc Exp $
|
version: $Id: tab.tries.c,v 1.24 2008-05-20 18:25:37 ricroc Exp $
|
||||||
|
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
@ -883,12 +883,12 @@ void load_answer_trie(ans_node_ptr ans_node, CELL *subs_ptr) {
|
|||||||
int var_index = VarIndexOfTableTerm(t);
|
int var_index = VarIndexOfTableTerm(t);
|
||||||
if(var_index > n_vars) {
|
if(var_index > n_vars) {
|
||||||
for (i = var_index; i > n_vars; i--)
|
for (i = var_index; i > n_vars; i--)
|
||||||
stack_vars_base[i] = NULL;
|
stack_vars_base[i] = 0;
|
||||||
n_vars = var_index;
|
n_vars = var_index;
|
||||||
stack_vars = stack_terms_base + n_vars;
|
stack_vars = stack_terms_base + n_vars;
|
||||||
STACK_CHECK_EXPAND(stack_terms, stack_vars, stack_terms_base);
|
STACK_CHECK_EXPAND(stack_terms, stack_vars, stack_terms_base);
|
||||||
}
|
}
|
||||||
if (stack_vars_base[var_index] == NULL)
|
if (stack_vars_base[var_index] == 0)
|
||||||
stack_vars_base[var_index] = MkVarTerm();
|
stack_vars_base[var_index] = MkVarTerm();
|
||||||
STACK_PUSH_UP(stack_vars_base[var_index], stack_terms);
|
STACK_PUSH_UP(stack_vars_base[var_index], stack_terms);
|
||||||
STACK_CHECK_EXPAND(stack_terms, stack_vars, stack_terms_base);
|
STACK_CHECK_EXPAND(stack_terms, stack_vars, stack_terms_base);
|
||||||
|
Reference in New Issue
Block a user