fix case where we call YAP with very large arities (obs from Ulrich Neumerkel).

This commit is contained in:
Vitor Santos Costa 2009-04-26 10:47:41 -05:00
parent 3fff188701
commit 2b79d5aada

View File

@ -194,10 +194,12 @@ do_execute(Term t, Term mod)
f = FunctorOfTerm(t); f = FunctorOfTerm(t);
if (IsExtensionFunctor(f)) { if (IsExtensionFunctor(f)) {
return CallError(TYPE_ERROR_CALLABLE, mod); return CallError(TYPE_ERROR_CALLABLE, t);
} }
arity = ArityOfFunctor(f); arity = ArityOfFunctor(f);
if (arity > MaxTemps) {
return CallError(TYPE_ERROR_CALLABLE, t);
}
pen = RepPredProp(PredPropByFunc(f, mod)); pen = RepPredProp(PredPropByFunc(f, mod));
/* You thought we would be over by now */ /* You thought we would be over by now */
/* but no meta calls require special preprocessing */ /* but no meta calls require special preprocessing */
@ -328,7 +330,6 @@ do_execute_n(Term t, Term mod, unsigned int n)
if (IsExtensionFunctor(f)) { if (IsExtensionFunctor(f)) {
return CallError(TYPE_ERROR_CALLABLE, mod); return CallError(TYPE_ERROR_CALLABLE, mod);
} }
if (PRED_GOAL_EXPANSION_ALL) { if (PRED_GOAL_EXPANSION_ALL) {
LOCK(SignalLock); LOCK(SignalLock);
/* disable creeping when we do goal expansion */ /* disable creeping when we do goal expansion */
@ -342,6 +343,9 @@ do_execute_n(Term t, Term mod, unsigned int n)
} else if (ActiveSignals) { } else if (ActiveSignals) {
return EnterCreepMode(copy_execn_to_heap(f, pt, n, arity, CurrentModule), mod); return EnterCreepMode(copy_execn_to_heap(f, pt, n, arity, CurrentModule), mod);
} }
if (arity > MaxTemps) {
return CallError(TYPE_ERROR_CALLABLE, t);
}
pen = RepPredProp(PredPropByFunc(f, mod)); pen = RepPredProp(PredPropByFunc(f, mod));
/* You thought we would be over by now */ /* You thought we would be over by now */
/* but no meta calls require special preprocessing */ /* but no meta calls require special preprocessing */
@ -598,6 +602,9 @@ p_execute_clause(void)
} }
pe = PredPropByFunc(f, mod); pe = PredPropByFunc(f, mod);
arity = ArityOfFunctor(f); arity = ArityOfFunctor(f);
if (arity > MaxTemps) {
return CallError(TYPE_ERROR_CALLABLE, t);
}
/* I cannot use the standard macro here because /* I cannot use the standard macro here because
otherwise I would dereference the argument and otherwise I would dereference the argument and
might skip a svar */ might skip a svar */
@ -660,7 +667,7 @@ p_execute0(void)
register CELL *pt; register CELL *pt;
if (IsExtensionFunctor(f)) if (IsExtensionFunctor(f))
return(FALSE); return FALSE;
if (f == FunctorModule) { if (f == FunctorModule) {
Term tmod = ArgOfTerm(1,t); Term tmod = ArgOfTerm(1,t);
if (!IsVarTerm(tmod) && IsAtomTerm(tmod)) { if (!IsVarTerm(tmod) && IsAtomTerm(tmod)) {
@ -672,6 +679,9 @@ p_execute0(void)
pe = PredPropByFunc(f, mod); pe = PredPropByFunc(f, mod);
// Yap_DebugPlWrite(mod);fprintf(stderr,"\n"); // Yap_DebugPlWrite(mod);fprintf(stderr,"\n");
arity = ArityOfFunctor(f); arity = ArityOfFunctor(f);
if (arity > MaxTemps) {
return CallError(TYPE_ERROR_CALLABLE, t);
}
/* I cannot use the standard macro here because /* I cannot use the standard macro here because
otherwise I would dereference the argument and otherwise I would dereference the argument and
might skip a svar */ might skip a svar */
@ -728,6 +738,9 @@ p_execute_nonstop(void)
} }
pe = PredPropByFunc(f, mod); pe = PredPropByFunc(f, mod);
arity = ArityOfFunctor(f); arity = ArityOfFunctor(f);
if (arity > MaxTemps) {
return CallError(TYPE_ERROR_CALLABLE, t);
}
/* I cannot use the standard macro here because /* I cannot use the standard macro here because
otherwise I would dereference the argument and otherwise I would dereference the argument and
might skip a svar */ might skip a svar */