bug fixes

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@962 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2004-01-26 12:41:06 +00:00
parent d4616d2f06
commit 0a7ec31659
5 changed files with 26 additions and 45 deletions

View File

@ -298,9 +298,6 @@ Yap_absmi(int inp)
FAIL();
}
setregs();
ActiveSignals &= ~YAP_CDOVF_SIGNAL;
if (!ActiveSignals)
CFREG = CalculateStackGap();
goto reset_absmi;
#if !OS_HANDLES_TR_OVERFLOW
@ -2180,6 +2177,9 @@ Yap_absmi(int inp)
/* This is easier: I know there is an environment so I cannot do allocate */
NoStackCommitY:
/* find something to fool S */
if (ActiveSignals & YAP_CDOVF_SIGNAL) {
goto do_commit_b_y;
}
if (ActiveSignals != YAP_CREEP_SIGNAL) {
SREG = (CELL *)RepPredProp(Yap_GetPredPropByFunc(Yap_MkFunctor(AtomRestoreRegs,2),0));
XREGS[0] = YREG[PREG->u.y.y];
@ -2192,6 +2192,9 @@ Yap_absmi(int inp)
/* Problem: have I got an environment or not? */
NoStackCommitX:
/* find something to fool S */
if (ActiveSignals & YAP_CDOVF_SIGNAL) {
goto do_commit_b_x;
}
if (ActiveSignals != YAP_CREEP_SIGNAL) {
SREG = (CELL *)RepPredProp(Yap_GetPredPropByFunc(Yap_MkFunctor(AtomRestoreRegs,2),0));
#if USE_THREADED_CODE

View File

@ -254,41 +254,9 @@ do_execute(Term t, SMALLUNSGN mod)
t = ArgOfTerm(2,t);
goto restart_exec;
}
} else if (f == FunctorComma) {
Term d1 = ArgOfTerm(2,t);
if (IsVarTerm(d1)) {
return CallMetaCall(mod);
}
if (IsAtomTerm(d1)) {
YENV = ASP;
YENV[-EnvSizeInCells-2] = MkIntegerTerm((Int)PredPropByAtom(AtomOfTerm(d1),mod));
} else if (IsApplTerm(d1)) {
Functor f = FunctorOfTerm(d1);
if (IsExtensionFunctor(f) || f == FunctorModule) {
return CallMetaCall(mod);
} else {
YENV = ASP;
YENV[-EnvSizeInCells-2] = MkIntegerTerm((Int)PredPropByFunc(f,mod));
}
} else {
return CallMetaCall(mod);
}
YENV[E_CP] = (CELL)P;
YENV[E_CB] = (CELL)B;
YENV[E_E] = (CELL)ENV;
#ifdef DEPTH_LIMIT
YENV[E_DEPTH] = DEPTH;
#endif /* DEPTH_LIMIT */
YENV[-EnvSizeInCells-1] = d1;
YENV[-EnvSizeInCells-3] = MkIntTerm(mod);
ENV = YENV;
ASP -= EnvSizeInCells+3;
P = NEXTOP(COMMA_CODE,sla);
ARG1 = t = ArgOfTerm(1,t);
goto restart_exec;
} else if (mod != CurrentModule) {
return(CallMetaCall(mod));
}
} else {
return(CallMetaCall(mod));
}
}
/* now let us do what we wanted to do from the beginning !! */
/* I cannot use the standard macro here because

View File

@ -672,7 +672,7 @@ do_growheap(int fix_code, UInt in_size, struct intermediates *cip)
#if defined(YAPOR) || defined(THREADS)
if (NOfThreads != 1) {
Yap_Error(SYSTEM_ERROR,TermNil,"cannot grow Heap: more than a worker/thread running");
return(FALSE);
return FALSE;
}
#endif
if (SizeOfOverflow > sz)
@ -703,7 +703,10 @@ do_growheap(int fix_code, UInt in_size, struct intermediates *cip)
fix_tabling_info();
#endif /* TABLING */
if (sz >= sizeof(CELL) * 16 * 1024L) {
return (TRUE);
ActiveSignals &= ~YAP_CDOVF_SIGNAL;
if (!ActiveSignals)
CreepFlag = CalculateStackGap();
return TRUE;
}
/* failed */
return(FALSE);

View File

@ -3360,6 +3360,8 @@ compile_index(struct intermediates *cint)
}
static int vsc_index;
yamop *
Yap_PredIsIndexable(PredEntry *ap)
{
@ -3367,7 +3369,7 @@ Yap_PredIsIndexable(PredEntry *ap)
int setjres;
struct intermediates cint;
cint.CodeStart = cint.cpc = NIL;
vsc_index++;
cint.CurrentPred = ap;
Yap_Error_Size = 0;
if ((setjres = setjmp(cint.CompilerBotch)) == 3) {
@ -3380,12 +3382,14 @@ Yap_PredIsIndexable(PredEntry *ap)
return FAILCODE;
}
} else if (setjres != 0) {
printf("at %d\n", vsc_index);
if (!Yap_growheap(FALSE, Yap_Error_Size, NULL)) {
Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage);
return FAILCODE;
}
}
restart_index:
cint.CodeStart = cint.BlobsStart = cint.cpc = cint.icpc = NIL;
Yap_ErrorMessage = NULL;
if (compile_index(&cint) == (UInt)FAILCODE) {
return FAILCODE;
@ -4037,7 +4041,7 @@ expand_index(struct intermediates *cint) {
return labp;
}
cint->freep = (char *)(max+1);
cint->CodeStart = cint->cpc = NULL;
cint->CodeStart = cint->BlobsStart = cint->cpc = cint->icpc = NULL;
if (!IsVarTerm(sp[-1].val) && sp > stack) {
if (IsAtomOrIntTerm(sp[-1].val)) {
@ -4102,7 +4106,7 @@ ExpandIndex(PredEntry *ap) {
int cb;
struct intermediates cint;
cint.CodeStart = cint.cpc = NIL;
cint.CodeStart = cint.cpc = cint.BlobsStart = cint.icpc = NIL;
cint.CurrentPred = ap;
Yap_Error_Size = 0;
if ((cb = setjmp(cint.CompilerBotch)) == 3) {

View File

@ -8,8 +8,11 @@
* *
**************************************************************************
* *
* $Id: sys.c,v 1.16 2003-01-27 15:55:40 vsc Exp $ *
* $Id: sys.c,v 1.17 2004-01-26 12:41:06 vsc Exp $ *
* mods: $Log: not supported by cvs2svn $
* mods: Revision 1.16 2003/01/27 15:55:40 vsc
* mods: use CVS Id
* mods:
* mods: Revision 1.15 2003/01/27 15:54:10 vsc
* mods: fix header
* mods: *
@ -124,7 +127,7 @@ datime(void)
#else
oops
#endif /* HAVE_TIME */
tf = YAP_MkApplTerm(YAP_MkFunctor(YAP_LookupAtom("datime"),6), 6, out);
tf = YAP_MkApplTerm(YAP_MkFunctor(YAP_LookupAtom("date"),6), 6, out);
return(YAP_Unify(YAP_ARG1, tf));
}