fixes for YapRunGoal

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@541 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2002-06-18 02:27:53 +00:00
parent b48f1264b9
commit 944d2e8aed
4 changed files with 29 additions and 24 deletions

View File

@ -5701,6 +5701,7 @@ absmi(int inp)
save_machine_regs();
SREG = (CELL *) YapExecute(p, (CPredicate)(p->TrueCodeOfPred));
EX = 0L;
}
restore_machine_regs();
@ -5829,6 +5830,7 @@ absmi(int inp)
saveregs();
save_machine_regs();
SREG = (CELL *) YapExecute(PREG->u.lds.p, (CPredicate)(PREG->u.lds.d));
EX = 0L;
restore_machine_regs();
setregs();
if (!SREG) {

View File

@ -689,17 +689,21 @@ static void myputc (int ch)
putc(ch,stderr);
}
static Term told;
X_API int
YapRunGoal(Term t)
{
int out;
yamop *old_CP = CP;
BACKUP_MACHINE_REGS();
do_putcf = myputc;
out = RunTopGoal(t);
told = t;
if (out) {
P = (yamop *)ENV[E_CP];
ENV = (CELL *)ENV[E_E];
CP = old_CP;
} else {
B = B->cp_b;
}
RECOVER_MACHINE_REGS();
return(out);
@ -743,6 +747,7 @@ YapPruneGoal(void)
while (B->cp_ap != NOCODE) {
B = B->cp_b;
}
B = B->cp_b;
RECOVER_B();
}

View File

@ -924,22 +924,14 @@ do_goal(CODEADDR CodeAdr, int arity, CELL *pt, int args_to_save, int top)
#ifdef DEPTH_LIMIT
B->cp_depth = DEPTH;
#endif /* DEPTH_LIMIT */
if (top) {
#if COROUTINING
RESET_VARIABLE((CELL *)GlobalBase);
DelayedVars = NewTimedVar((CELL)GlobalBase);
WokenGoals = NewTimedVar(TermNil);
MutableList = NewTimedVar(TermNil);
AttsMutableList = NewTimedVar(TermNil);
#endif
}
YENV = ASP = (CELL *)B;
HB = H;
YENV[E_CB] = Unsigned (B);
P = (yamop *) CodeAdr;
CP = YESCODE;
S = CellPtr (RepPredProp (PredPropByFunc (MkFunctor(AtomCall, 1),0))); /* A1 mishaps */
return(exec_absmi(top));
return(exec_absmi(top));
}
@ -1073,6 +1065,7 @@ RunTopGoal(Term t)
CELL *pt;
UInt arity;
SMALLUNSGN mod = CurrentModule;
int goal_out = 0;
restart_runtopgoal:
if (IsAtomTerm(t)) {
@ -1109,23 +1102,21 @@ RunTopGoal(Term t)
if (pe != NIL) {
READ_LOCK(ppe->PRWLock);
}
if (pe == NIL ||
ppe->OpcodeOfPred == UNDEF_OPCODE ||
ppe->PredFlags & (UserCPredFlag|CPredFlag|AsmPredFlag) )
{
if (pe != NIL) {
READ_UNLOCK(ppe->PRWLock);
}
/* we must always start the emulator with Prolog code */
return(FALSE);
if (pe == NIL) {
if (pe != NIL) {
READ_UNLOCK(ppe->PRWLock);
}
/* we must always start the emulator with Prolog code */
return(FALSE);
}
CodeAdr = ppe->CodeOfPred;
if (TrailTop - HeapTop < 2048) {
PrologMode = BootMode;
Error(SYSTEM_ERROR,TermNil,
"unable to boot because of too little heap space");
}
return(do_goal(CodeAdr, arity, pt, 0, TRUE));
goal_out = do_goal(CodeAdr, arity, pt, 0, TRUE);
return(goal_out);
}
static void

View File

@ -1123,6 +1123,13 @@ InitYaamRegs(void)
EX = 0L;
/* for slots to work */
*--ASP = MkIntTerm(0);
#if COROUTINING
RESET_VARIABLE((CELL *)GlobalBase);
DelayedVars = NewTimedVar((CELL)GlobalBase);
WokenGoals = NewTimedVar(TermNil);
MutableList = NewTimedVar(TermNil);
AttsMutableList = NewTimedVar(TermNil);
#endif
}