This commit is contained in:
Vitor Santos Costa 2019-02-19 15:56:22 +00:00
parent c792db26be
commit cb0f5ec4db

View File

@ -1065,7 +1065,7 @@ static Int _user_expand_goal(USES_REGS1) {
ARG1 = g; ARG1 = g;
if ((pe = RepPredProp(Yap_GetPredPropByFunc(FunctorGoalExpansion2, cmod))) && if ((pe = RepPredProp(Yap_GetPredPropByFunc(FunctorGoalExpansion2, cmod))) &&
pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE && pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE &&
Yap_execute_pred(pe, NULL, false PASS_REGS)) { Yap_execute_pred(pe, NULL, true PASS_REGS)) {
return complete_ge(true, omod, sl, creeping); return complete_ge(true, omod, sl, creeping);
} }
/* system:goal_expansion(A,B) */ /* system:goal_expansion(A,B) */
@ -1076,7 +1076,7 @@ static Int _user_expand_goal(USES_REGS1) {
if ((pe = RepPredProp( if ((pe = RepPredProp(
Yap_GetPredPropByFunc(FunctorGoalExpansion2, SYSTEM_MODULE))) && Yap_GetPredPropByFunc(FunctorGoalExpansion2, SYSTEM_MODULE))) &&
pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE && pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE &&
Yap_execute_pred(pe, NULL, false PASS_REGS)) { Yap_execute_pred(pe, NULL, true PASS_REGS)) {
return complete_ge(true, omod, sl, creeping); return complete_ge(true, omod, sl, creeping);
} }
ARG1 = Yap_GetFromSlot(h1); ARG1 = Yap_GetFromSlot(h1);
@ -1086,7 +1086,7 @@ static Int _user_expand_goal(USES_REGS1) {
if ((pe = RepPredProp( if ((pe = RepPredProp(
Yap_GetPredPropByFunc(FunctorGoalExpansion, USER_MODULE))) && Yap_GetPredPropByFunc(FunctorGoalExpansion, USER_MODULE))) &&
pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE && pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE &&
Yap_execute_pred(pe, NULL PASS_REGS, false)) { Yap_execute_pred(pe, NULL, true PASS_REGS)) {
return complete_ge(true, omod, sl, creeping); return complete_ge(true, omod, sl, creeping);
} }
mg_args[0] = cmod; mg_args[0] = cmod;
@ -1098,7 +1098,7 @@ static Int _user_expand_goal(USES_REGS1) {
(pe = RepPredProp( (pe = RepPredProp(
Yap_GetPredPropByFunc(FunctorGoalExpansion2, USER_MODULE))) && Yap_GetPredPropByFunc(FunctorGoalExpansion2, USER_MODULE))) &&
pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE && pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE &&
Yap_execute_pred(pe, NULL PASS_REGS, false)) { Yap_execute_pred(pe, NULL, true PASS_REGS)) {
return complete_ge(true, omod, sl, creeping); return complete_ge(true, omod, sl, creeping);
} }
return complete_ge(false, omod, sl, creeping); return complete_ge(false, omod, sl, creeping);
@ -1719,13 +1719,6 @@ bool Yap_execute_pred(PredEntry *ppe, CELL *pt, bool pass_ex USES_REGS) {
/* restore the old environment */ /* restore the old environment */
/* get to previous environment */ /* get to previous environment */
cut_B = (choiceptr)ENV[E_CB]; cut_B = (choiceptr)ENV[E_CB];
{
/* Note that
cut_B == (choiceptr)ENV[E_CB] */
while (POP_CHOICE_POINT(ENV[E_CB])) {
POP_EXECUTE();
}
}
#ifdef YAPOR #ifdef YAPOR
CUT_prune_to(cut_B); CUT_prune_to(cut_B);
#endif /* YAPOR */ #endif /* YAPOR */
@ -1750,21 +1743,20 @@ bool Yap_execute_pred(PredEntry *ppe, CELL *pt, bool pass_ex USES_REGS) {
/* we have failed, and usually we would backtrack to this B, /* we have failed, and usually we would backtrack to this B,
trouble is, we may also have a delayed cut to do */ trouble is, we may also have a delayed cut to do */
if (B != NULL) if (B != NULL)
HB = B->cp_h; HB = B->cp_h;
YENV = ENV; YENV = ENV;
// should we catch the exception or pass it through? // should we catch the exception or pass it through?
// We'll pass it through // We'll pass it through
if (pass_ex && Yap_HasException()) { if ( Yap_HasException()) {
if ((LOCAL_PrologMode & BootMode) || !CurrentModule ) { if (pass_ex &&
Yap_ResetException(LOCAL_ActiveError); ((LOCAL_PrologMode & BootMode) || !CurrentModule )) {
Yap_ResetException(LOCAL_ActiveError);
} else {
Yap_RaiseException();
}
return false; return false;
} }
return true;
Yap_RaiseException();
return false;
}
return true;
} else if (out == 0) { } else if (out == 0) {
P = saved_p; P = saved_p;
CP = saved_cp; CP = saved_cp;
@ -1782,12 +1774,13 @@ bool Yap_execute_pred(PredEntry *ppe, CELL *pt, bool pass_ex USES_REGS) {
HB = PROTECT_FROZEN_H(B); HB = PROTECT_FROZEN_H(B);
// should we catch the exception or pass it through? // should we catch the exception or pass it through?
// We'll pass it through // We'll pass it through
if (pass_ex) { if ( Yap_HasException()) {
if ((LOCAL_PrologMode & BootMode) || !CurrentModule ) { if (pass_ex &&
Yap_ResetException(LOCAL_ActiveError); ((LOCAL_PrologMode & BootMode) || !CurrentModule )) {
return false; Yap_ResetException(LOCAL_ActiveError);
} } else {
Yap_RaiseException(); Yap_RaiseException();
}
} }
return false; return false;
} else { } else {