make sure we have enough room before we enter a clause.
This commit is contained in:
15
C/absmi.c
15
C/absmi.c
@@ -1675,18 +1675,21 @@ Yap_absmi(int inp)
|
||||
*****************************************************************/
|
||||
|
||||
/* ensure_space */
|
||||
BOp(ensure_space, ip);
|
||||
BOp(ensure_space, Osbpi);
|
||||
{
|
||||
Int sz = PREG->u.ip.i;
|
||||
fprintf(stderr,"ensuring %ld\n", sz);
|
||||
PREG = NEXTOP(PREG,ip);
|
||||
Int sz = PREG->u.Osbpi.i;
|
||||
PREG = NEXTOP(PREG,Osbpi);
|
||||
if (Unsigned(H) + sz > Unsigned(YREG)-CreepFlag) {
|
||||
YENV[E_CP] = (CELL) CPREG;
|
||||
YENV[E_E] = (CELL) ENV;
|
||||
#ifdef DEPTH_LIMIT
|
||||
YENV[E_DEPTH] = DEPTH;
|
||||
#endif /* DEPTH_LIMIT */
|
||||
ASP = YREG+E_CB;
|
||||
if (ASP > (CELL *)PROTECT_FROZEN_B(B))
|
||||
ASP = (CELL *)PROTECT_FROZEN_B(B);
|
||||
saveregs();
|
||||
if (!Yap_gcl(sz, 0, ENV, NEXTOP(PREG,ip))) {
|
||||
PREG = NEXTOP(PREG,ip);
|
||||
if (!Yap_gcl(sz, 0, YENV, PREG)) {
|
||||
Yap_Error(OUT_OF_STACK_ERROR,TermNil,Yap_ErrorMessage);
|
||||
setregs();
|
||||
FAIL();
|
||||
|
||||
10
C/amasm.c
10
C/amasm.c
@@ -1098,13 +1098,15 @@ a_blob(CELL rnd1, op_numbers opcode, int *clause_has_blobsp, yamop *code_p, int
|
||||
static yamop *
|
||||
a_ensure_space(op_numbers opcode, yamop *code_p, int pass_no, struct intermediates *cip, clause_info *clinfo)
|
||||
{
|
||||
if (cip->cpc->rnd1 > 4096 && FALSE) {
|
||||
if (cip->cpc->rnd1 > 4096) {
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(opcode);
|
||||
code_p->u.ip.i = sizeof(CELL) * cip->cpc->rnd1;
|
||||
code_p->u.ip.p = clinfo->CurrentPred;
|
||||
code_p->u.Osbpi.i = sizeof(CELL) * cip->cpc->rnd1;
|
||||
code_p->u.Osbpi.p = clinfo->CurrentPred;
|
||||
code_p->u.Osbpi.bmap = NULL;
|
||||
code_p->u.Osbpi.s = emit_count(-Signed(RealEnvSize));
|
||||
}
|
||||
GONEXT(ip);
|
||||
GONEXT(Osbpi);
|
||||
}
|
||||
return code_p;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user