diff --git a/C/compiler.c b/C/compiler.c index 1aeeb3ada..5671b2a8c 100644 --- a/C/compiler.c +++ b/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;