Same as before...

This commit is contained in:
Theo 2013-12-19 17:08:55 +00:00
parent b4506cf793
commit fdd96e96cf

View File

@ -513,8 +513,9 @@
GONext(); GONext();
#ifdef INCOMPLETE_TABLING #ifdef INCOMPLETE_TABLING
} else if (SgFr_state(sg_fr) == incomplete) { } else if (SgFr_state(sg_fr) == incomplete) {
printf("Yoho1\n"); if (IsMode_CoInductive(TabEnt_mode(tab_ent))) {
printf("Currently Unsupported\n");
} else {
/* subgoal incomplete --> start by loading the answers already found */ /* subgoal incomplete --> start by loading the answers already found */
ans_node_ptr ans_node = SgFr_first_answer(sg_fr); ans_node_ptr ans_node = SgFr_first_answer(sg_fr);
CELL *subs_ptr = YENV; CELL *subs_ptr = YENV;
@ -527,50 +528,32 @@ printf("Yoho1\n");
load_answer(ans_node, subs_ptr); load_answer(ans_node, subs_ptr);
YENV = ENV; YENV = ENV;
GONext(); GONext();
}
#endif /* INCOMPLETE_TABLING */ #endif /* INCOMPLETE_TABLING */
} else if (SgFr_state(sg_fr) == evaluating) { } else if (SgFr_state(sg_fr) == evaluating) {
if (IsMode_CoInductive(TabEnt_mode(tab_ent))) { if (IsMode_CoInductive(TabEnt_mode(tab_ent))) {
printf("Hi!\n"); /* Used for coinductive tabling strategy */
} else { CELL *subs_ptr;
printf("Ok\n"); subs_ptr = (CELL *) (GEN_CP(SgFr_gen_cp(sg_fr)) + 1);
} subs_ptr += SgFr_arity(sg_fr); // Points at the Parent goal Variables
int i;
printf("Yoho2\n"); for (i = 0; i < subs_ptr[0]; i++)
/* Used for coinductive tabling strategy */ Yap_unify(subs_ptr[i+1], YENV[i+1]);
CELL *subs_ptr; /* yes answer --> procceed */
subs_ptr = (CELL *) (GEN_CP(SgFr_gen_cp(sg_fr)) + 1); UNLOCK_SG_FR(sg_fr);
subs_ptr += SgFr_arity(sg_fr); // Points at the Parent goal Variables PREG = (yamop *) CPREG;
int i; PREFETCH_OP(PREG);
for (i = 0; i < subs_ptr[0]; i++) YENV = ENV; // Consume the variables
Yap_unify(subs_ptr[i+1], YENV[i+1]); GONext(); // Succeed the goal :-D
/* yes answer --> procceed */ } else {
UNLOCK_SG_FR(sg_fr);
PREG = (yamop *) CPREG;
PREFETCH_OP(PREG);
YENV = ENV; // Consume the variables
GONext(); // Succeed the goal :-D
// printf("I'm here\n Arity: %i Count: %i\n", subs_ptr[0], sg_fr->TempVariables.Count);
// printf("YENV: %i, ENV: %i, YENV+1: %i, ENV+1: %i\n", YENV[0], ENV[0], YENV[1], ENV[1]);
/* for (i = 0; i < sg_fr->TempVariables.Count; i++) {
Yap_unify(sg_fr->TempVariables.OriginalVariables[i], sg_fr->TempVariables.CycleVariables[i]);
printf("Variable: %i is O: %i C: %i H: %i E: %i\n", i, sg_fr->TempVariables.OriginalVariables[i], sg_fr->TempVariables.CycleVariables[i], subs_ptr[i+1], YENV[i+1]);
}
printf("I'm out of here\n");*/
/* subgoal in evaluation */ /* subgoal in evaluation */
/* choiceptr leader_cp; choiceptr leader_cp;
int leader_dep_on_stack; int leader_dep_on_stack;
find_dependency_node(sg_fr, leader_cp, leader_dep_on_stack); find_dependency_node(sg_fr, leader_cp, leader_dep_on_stack);
UNLOCK_SG_FR(sg_fr); UNLOCK_SG_FR(sg_fr);
find_leader_node(leader_cp, leader_dep_on_stack); find_leader_node(leader_cp, leader_dep_on_stack);
store_consumer_node(tab_ent, sg_fr, leader_cp, leader_dep_on_stack); store_consumer_node(tab_ent, sg_fr, leader_cp, leader_dep_on_stack);
*/ }
#ifdef DEBUG_OPTYAP #ifdef DEBUG_OPTYAP
if (GLOBAL_parallel_mode == PARALLEL_MODE_RUNNING) { if (GLOBAL_parallel_mode == PARALLEL_MODE_RUNNING) {
choiceptr aux_cp; choiceptr aux_cp;
@ -690,7 +673,9 @@ printf("Yoho2\n");
GONext(); GONext();
#ifdef INCOMPLETE_TABLING #ifdef INCOMPLETE_TABLING
} else if (SgFr_state(sg_fr) == incomplete) { } else if (SgFr_state(sg_fr) == incomplete) {
printf("Yoho3\n"); if (IsMode_CoInductive(TabEnt_mode(tab_ent))) {
printf("Currently Unsupported\n");
} else {
/* subgoal incomplete --> start by loading the answers already found */ /* subgoal incomplete --> start by loading the answers already found */
ans_node_ptr ans_node = SgFr_first_answer(sg_fr); ans_node_ptr ans_node = SgFr_first_answer(sg_fr);
CELL *subs_ptr = YENV; CELL *subs_ptr = YENV;
@ -703,11 +688,12 @@ printf("Yoho3\n");
load_answer(ans_node, subs_ptr); load_answer(ans_node, subs_ptr);
YENV = ENV; YENV = ENV;
GONext(); GONext();
}
#endif /* INCOMPLETE_TABLING */ #endif /* INCOMPLETE_TABLING */
} else if (SgFr_state(sg_fr) == evaluating) { } else if (SgFr_state(sg_fr) == evaluating) {
printf("Yoho4\n"); if (IsMode_CoInductive(TabEnt_mode(tab_ent))) {
printf("Currently Unsupported\n");
} else {
/* subgoal in evaluation */ /* subgoal in evaluation */
choiceptr leader_cp; choiceptr leader_cp;
int leader_dep_on_stack; int leader_dep_on_stack;
@ -715,6 +701,7 @@ printf("Yoho4\n");
UNLOCK_SG_FR(sg_fr); UNLOCK_SG_FR(sg_fr);
find_leader_node(leader_cp, leader_dep_on_stack); find_leader_node(leader_cp, leader_dep_on_stack);
store_consumer_node(tab_ent, sg_fr, leader_cp, leader_dep_on_stack); store_consumer_node(tab_ent, sg_fr, leader_cp, leader_dep_on_stack);
}
#ifdef DEBUG_OPTYAP #ifdef DEBUG_OPTYAP
if (GLOBAL_parallel_mode == PARALLEL_MODE_RUNNING) { if (GLOBAL_parallel_mode == PARALLEL_MODE_RUNNING) {
choiceptr aux_cp; choiceptr aux_cp;
@ -834,44 +821,47 @@ printf("Yoho4\n");
GONext(); GONext();
#ifdef INCOMPLETE_TABLING #ifdef INCOMPLETE_TABLING
} else if (SgFr_state(sg_fr) == incomplete) { } else if (SgFr_state(sg_fr) == incomplete) {
printf("Yoho5\n"); if (IsMode_CoInductive(TabEnt_mode(tab_ent))) {
/* subgoal incomplete --> start by loading the answers already found */ printf("Currently Unsupported\n");
ans_node_ptr ans_node = SgFr_first_answer(sg_fr); } else {
CELL *subs_ptr = YENV; /* subgoal incomplete --> start by loading the answers already found */
init_subgoal_frame(sg_fr); ans_node_ptr ans_node = SgFr_first_answer(sg_fr);
UNLOCK_SG_FR(sg_fr); CELL *subs_ptr = YENV;
SgFr_try_answer(sg_fr) = ans_node; init_subgoal_frame(sg_fr);
store_generator_node(tab_ent, sg_fr, PREG->u.Otapl.s, TRY_ANSWER); UNLOCK_SG_FR(sg_fr);
PREG = (yamop *) CPREG; SgFr_try_answer(sg_fr) = ans_node;
PREFETCH_OP(PREG); store_generator_node(tab_ent, sg_fr, PREG->u.Otapl.s, TRY_ANSWER);
load_answer(ans_node, subs_ptr); PREG = (yamop *) CPREG;
YENV = ENV; PREFETCH_OP(PREG);
GONext(); load_answer(ans_node, subs_ptr);
YENV = ENV;
GONext();
}
#endif /* INCOMPLETE_TABLING */ #endif /* INCOMPLETE_TABLING */
} else if (SgFr_state(sg_fr) == evaluating) { } else if (SgFr_state(sg_fr) == evaluating) {
printf("Yoho6\n"); if (IsMode_CoInductive(TabEnt_mode(tab_ent))) {
/* Used for coinductive tabling strategy */
/* Used for coinductive tabling strategy */ CELL *subs_ptr;
CELL *subs_ptr; subs_ptr = (CELL *) (GEN_CP(SgFr_gen_cp(sg_fr)) + 1);
subs_ptr = (CELL *) (GEN_CP(SgFr_gen_cp(sg_fr)) + 1); subs_ptr += SgFr_arity(sg_fr); // Points at the Parent goal Variables
subs_ptr += SgFr_arity(sg_fr); // Points at the Parent goal Variables int i;
int i; for (i = 0; i < subs_ptr[0]; i++)
for (i = 0; i < subs_ptr[0]; i++) Yap_unify(subs_ptr[i+1], YENV[i+1]);
Yap_unify(subs_ptr[i+1], YENV[i+1]); /* yes answer --> procceed */
/* yes answer --> procceed */ UNLOCK_SG_FR(sg_fr);
UNLOCK_SG_FR(sg_fr); PREG = (yamop *) CPREG;
PREG = (yamop *) CPREG; PREFETCH_OP(PREG);
PREFETCH_OP(PREG); YENV = ENV; // Consume the variables
YENV = ENV; // Consume the variables GONext(); // Succeed the goal :-D
GONext(); // Succeed the goal :-D } else {
/* subgoal in evaluation */
/* subgoal in evaluation */ choiceptr leader_cp;
/* choiceptr leader_cp; int leader_dep_on_stack;
int leader_dep_on_stack; find_dependency_node(sg_fr, leader_cp, leader_dep_on_stack);
find_dependency_node(sg_fr, leader_cp, leader_dep_on_stack); UNLOCK_SG_FR(sg_fr);
UNLOCK_SG_FR(sg_fr); find_leader_node(leader_cp, leader_dep_on_stack);
find_leader_node(leader_cp, leader_dep_on_stack); store_consumer_node(tab_ent, sg_fr, leader_cp, leader_dep_on_stack);
store_consumer_node(tab_ent, sg_fr, leader_cp, leader_dep_on_stack);*/ }
#ifdef DEBUG_OPTYAP #ifdef DEBUG_OPTYAP
if (GLOBAL_parallel_mode == PARALLEL_MODE_RUNNING) { if (GLOBAL_parallel_mode == PARALLEL_MODE_RUNNING) {
choiceptr aux_cp; choiceptr aux_cp;