ifixes to support 64 bits:

- protect registers before calling prune()
- use Int, not int.
This commit is contained in:
Vítor Santos Costa 2011-02-15 18:14:18 +00:00
parent cd028bbd3f
commit a40987b70d
5 changed files with 18 additions and 6 deletions

View File

@ -2204,7 +2204,9 @@ Yap_absmi(int inp)
SET_ASP(YREG, PREG->u.s.s); SET_ASP(YREG, PREG->u.s.s);
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, s),Osbpp),l); PREG = NEXTOP(NEXTOP(NEXTOP(PREG, s),Osbpp),l);
/* assume cut is always in stack */ /* assume cut is always in stack */
saveregs();
prune((choiceptr)YREG[E_CB]); prune((choiceptr)YREG[E_CB]);
setregs();
GONext(); GONext();
ENDOp(); ENDOp();
@ -2221,7 +2223,9 @@ Yap_absmi(int inp)
#endif #endif
SET_ASP(YREG, PREG->u.s.s); SET_ASP(YREG, PREG->u.s.s);
/* assume cut is always in stack */ /* assume cut is always in stack */
saveregs();
prune((choiceptr)YREG[E_CB]); prune((choiceptr)YREG[E_CB]);
setregs();
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, s),Osbpp),l); PREG = NEXTOP(NEXTOP(NEXTOP(PREG, s),Osbpp),l);
#ifdef FROZEN_STACKS #ifdef FROZEN_STACKS
{ {
@ -2255,7 +2259,9 @@ Yap_absmi(int inp)
#endif #endif
SET_ASP(YREG, PREG->u.s.s); SET_ASP(YREG, PREG->u.s.s);
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, s),Osbpp),l); PREG = NEXTOP(NEXTOP(NEXTOP(PREG, s),Osbpp),l);
saveregs();
prune((choiceptr)SREG[E_CB]); prune((choiceptr)SREG[E_CB]);
setregs();
GONext(); GONext();
ENDOp(); ENDOp();
@ -2306,7 +2312,9 @@ Yap_absmi(int inp)
#else #else
pt0 = (choiceptr)(LCL0-IntegerOfTerm(d0)); pt0 = (choiceptr)(LCL0-IntegerOfTerm(d0));
#endif /* SBA && FROZEN_STACKS */ #endif /* SBA && FROZEN_STACKS */
saveregs();
prune(pt0); prune(pt0);
setregs();
} }
GONext(); GONext();
@ -2340,7 +2348,9 @@ Yap_absmi(int inp)
#else #else
pt0 = (choiceptr)(LCL0-IntegerOfTerm(d0)); pt0 = (choiceptr)(LCL0-IntegerOfTerm(d0));
#endif #endif
saveregs();
prune(pt0); prune(pt0);
setregs();
} }
GONext(); GONext();
@ -14059,7 +14069,9 @@ Yap_absmi(int inp)
if (at == AtomCut) { if (at == AtomCut) {
choiceptr cut_pt = (choiceptr)pt0[E_CB]; choiceptr cut_pt = (choiceptr)pt0[E_CB];
SET_ASP(YREG, E_CB*sizeof(CELL)); SET_ASP(YREG, E_CB*sizeof(CELL));
saveregs();
prune(cut_pt); prune(cut_pt);
setregs();
} }
pen = RepPredProp(PredPropByAtom(at, mod)); pen = RepPredProp(PredPropByAtom(at, mod));
goto execute_comma; goto execute_comma;
@ -14137,7 +14149,9 @@ Yap_absmi(int inp)
} else if ((Atom)(pen->FunctorOfPred) == AtomCut) { } else if ((Atom)(pen->FunctorOfPred) == AtomCut) {
choiceptr cut_pt = (choiceptr)pt0[E_CB]; choiceptr cut_pt = (choiceptr)pt0[E_CB];
SET_ASP(YREG, E_CB*sizeof(CELL)); SET_ASP(YREG, E_CB*sizeof(CELL));
saveregs();
prune(cut_pt); prune(cut_pt);
setregs();
} }
execute_after_comma: execute_after_comma:

View File

@ -848,7 +848,7 @@ p_read (void)
return do_read(NULL, 6); return do_read(NULL, 6);
} }
extern int getInputStream(int, IOSTREAM **); extern int getInputStream(Int, IOSTREAM **);
static Int static Int
p_read2 (void) p_read2 (void)

View File

@ -1569,7 +1569,7 @@ prune(choiceptr cp)
#ifdef YAPOR #ifdef YAPOR
CUT_prune_to(cp); CUT_prune_to(cp);
#endif /* YAPOR */ #endif /* YAPOR */
/* cut ! */ /* cut ! */
#ifdef TABLING #ifdef TABLING
abolish_incomplete_subgoals(B); abolish_incomplete_subgoals(B);
#endif /* TABLING */ #endif /* TABLING */

View File

@ -47,12 +47,10 @@
if (erase) { if (erase) {
/* at this point, we are the only ones accessing the clause, /* at this point, we are the only ones accessing the clause,
hence we don't need to have a lock it */ hence we don't need to have a lock it */
saveregs();
if (cl->ClFlags & ErasedMask) if (cl->ClFlags & ErasedMask)
Yap_ErLogUpdIndex(cl); Yap_ErLogUpdIndex(cl);
else else
Yap_CleanUpIndex(cl); Yap_CleanUpIndex(cl);
setregs();
} }
UNLOCK(ap->PELock); UNLOCK(ap->PELock);
} else { } else {

View File

@ -2799,7 +2799,7 @@ Yap_CloseStreams(int loud)
closeFiles(FALSE); closeFiles(FALSE);
} }
int Yap_StreamToFileNo(Term t) { Int Yap_StreamToFileNo(Term t) {
IOSTREAM *s; IOSTREAM *s;
int rc; int rc;
@ -2818,7 +2818,7 @@ FILE *Yap_FileDescriptorFromStream(Term t)
fprintf(stderr,"Unimplemented\n"); fprintf(stderr,"Unimplemented\n");
// return Sfileno(s); // return Sfileno(s);
} }
return -1; return NULL;
} }
#ifdef _WIN32 #ifdef _WIN32