handle heap overflows when constructing new predicates.
This commit is contained in:
parent
9a9767d73c
commit
a0750ff5b7
17
C/compiler.c
17
C/compiler.c
@ -1086,7 +1086,10 @@ c_bifun(Int Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler_struct
|
||||
/* compile as default */
|
||||
Functor f = FunctorOfTerm(Goal);
|
||||
Prop p0 = PredPropByFunc(f, mod);
|
||||
|
||||
if (EndOfPAEntr(p0)) {
|
||||
save_machine_regs();
|
||||
longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||
}
|
||||
if (profiling)
|
||||
Yap_emit(enter_profiling_op, (CELL)RepPredProp(p0), Zero, &cglobs->cint);
|
||||
else if (call_counting)
|
||||
@ -1322,6 +1325,10 @@ c_functor(Term Goal, Term mod, compiler_struct *cglobs)
|
||||
Functor f = FunctorOfTerm(Goal);
|
||||
Prop p0 = PredPropByFunc(f, mod);
|
||||
|
||||
if (EndOfPAEntr(p0)) {
|
||||
save_machine_regs();
|
||||
longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||
}
|
||||
if (profiling)
|
||||
Yap_emit(enter_profiling_op, (CELL)RepPredProp(p0), Zero, &cglobs->cint);
|
||||
else if (call_counting)
|
||||
@ -1537,6 +1544,10 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
|
||||
}
|
||||
#endif /* YAPOR */
|
||||
p = RepPredProp(p0 = Yap_PredPropByAtomNonThreadLocal(atom, mod));
|
||||
if (EndOfPAEntr(p0)) {
|
||||
save_machine_regs();
|
||||
longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||
}
|
||||
/* if we are profiling, make sure we register we entered this predicate */
|
||||
if (profiling)
|
||||
Yap_emit(enter_profiling_op, (CELL)p, Zero, &cglobs->cint);
|
||||
@ -1546,6 +1557,10 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
|
||||
else {
|
||||
f = FunctorOfTerm(Goal);
|
||||
p = RepPredProp(p0 = Yap_PredPropByFunctorNonThreadLocal(f, mod));
|
||||
if (EndOfPAEntr(p0)) {
|
||||
save_machine_regs();
|
||||
longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||
}
|
||||
if (f == FunctorOr || f == FunctorVBar) {
|
||||
Term arg;
|
||||
CELL l = ++cglobs->labelno;
|
||||
|
Reference in New Issue
Block a user