oops, check stack at deallocate even without COROUTINING
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@888 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
2db3829b82
commit
920d33a1d8
84
C/absmi.c
84
C/absmi.c
@ -2114,6 +2114,49 @@ Yap_absmi(int inp)
|
|||||||
JMPNext();
|
JMPNext();
|
||||||
|
|
||||||
|
|
||||||
|
/* don't forget I cannot creep at deallocate (where to?) */
|
||||||
|
/* also, this is unusual in that I have already done deallocate,
|
||||||
|
so I don't need to redo it.
|
||||||
|
*/
|
||||||
|
NoStackDeallocate:
|
||||||
|
if (CFREG == (CELL)(LCL0+2)) {
|
||||||
|
GONext();
|
||||||
|
}
|
||||||
|
ASP = YREG;
|
||||||
|
/* cut_e */
|
||||||
|
if (SREG <= ASP) {
|
||||||
|
ASP = SREG-EnvSizeInCells;
|
||||||
|
}
|
||||||
|
if (CFREG == (CELL)(LCL0+1)) {
|
||||||
|
goto noheapleft;
|
||||||
|
}
|
||||||
|
#ifdef COROUTINING
|
||||||
|
if (CFREG == Unsigned(LCL0)) {
|
||||||
|
if (Yap_ReadTimedVar(WokenGoals) != TermNil) {
|
||||||
|
if (Yap_op_from_opcode(PREG->opc) == _cut_e) {
|
||||||
|
/* followed by a cut */
|
||||||
|
ARG1 = MkIntegerTerm(LCL0-(CELL *)SREG[E_CB]);
|
||||||
|
SREG = (CELL *)RepPredProp(Yap_GetPredPropByFunc(FunctorCutBy,1));
|
||||||
|
} else {
|
||||||
|
SREG = (CELL *)RepPredProp(Yap_GetPredPropByAtom(AtomTrue,0));
|
||||||
|
}
|
||||||
|
goto creep;
|
||||||
|
} else {
|
||||||
|
CFREG = CalculateStackGap();
|
||||||
|
JMPNext();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (CFREG != CalculateStackGap()) {
|
||||||
|
GONext();
|
||||||
|
}
|
||||||
|
saveregs();
|
||||||
|
if (!Yap_gc(0, ENV, CPREG)) {
|
||||||
|
Yap_Error(OUT_OF_STACK_ERROR,TermNil,Yap_ErrorMessage);
|
||||||
|
}
|
||||||
|
setregs();
|
||||||
|
JMPNext();
|
||||||
|
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
|
|
||||||
/* This is easier: I know there is an environment so I cannot do allocate */
|
/* This is easier: I know there is an environment so I cannot do allocate */
|
||||||
@ -2155,47 +2198,6 @@ Yap_absmi(int inp)
|
|||||||
/* don't do debugging and friends here */
|
/* don't do debugging and friends here */
|
||||||
goto do_comit_b_x;
|
goto do_comit_b_x;
|
||||||
|
|
||||||
/* don't forget I cannot creep at deallocate (where to?) */
|
|
||||||
/* also, this is unusual in that I have already done deallocate,
|
|
||||||
so I don't need to redo it.
|
|
||||||
*/
|
|
||||||
NoStackDeallocate:
|
|
||||||
if (CFREG == (CELL)(LCL0+2)) {
|
|
||||||
GONext();
|
|
||||||
}
|
|
||||||
ASP = YREG;
|
|
||||||
/* cut_e */
|
|
||||||
if (SREG <= ASP) {
|
|
||||||
ASP = SREG-EnvSizeInCells;
|
|
||||||
}
|
|
||||||
if (CFREG == (CELL)(LCL0+1)) {
|
|
||||||
goto noheapleft;
|
|
||||||
}
|
|
||||||
if (CFREG == Unsigned(LCL0)) {
|
|
||||||
if (Yap_ReadTimedVar(WokenGoals) != TermNil) {
|
|
||||||
if (Yap_op_from_opcode(PREG->opc) == _cut_e) {
|
|
||||||
/* followed by a cut */
|
|
||||||
ARG1 = MkIntegerTerm(LCL0-(CELL *)SREG[E_CB]);
|
|
||||||
SREG = (CELL *)RepPredProp(Yap_GetPredPropByFunc(FunctorCutBy,1));
|
|
||||||
} else {
|
|
||||||
SREG = (CELL *)RepPredProp(Yap_GetPredPropByAtom(AtomTrue,0));
|
|
||||||
}
|
|
||||||
goto creep;
|
|
||||||
} else {
|
|
||||||
CFREG = CalculateStackGap();
|
|
||||||
JMPNext();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (CFREG != CalculateStackGap()) {
|
|
||||||
goto either_notest;
|
|
||||||
}
|
|
||||||
saveregs();
|
|
||||||
if (!Yap_gc(0, ENV, CPREG)) {
|
|
||||||
Yap_Error(OUT_OF_STACK_ERROR,TermNil,Yap_ErrorMessage);
|
|
||||||
}
|
|
||||||
setregs();
|
|
||||||
JMPNext();
|
|
||||||
|
|
||||||
/* don't forget I cannot creep at ; */
|
/* don't forget I cannot creep at ; */
|
||||||
NoStackEither:
|
NoStackEither:
|
||||||
/* find something to fool S */
|
/* find something to fool S */
|
||||||
|
Reference in New Issue
Block a user