SREG and S could be different; also S might be in use if there is an

overflow and the index code is jumping to the middle.
This commit is contained in:
Vitor Santos Costa 2009-04-18 15:22:51 -05:00
parent 0695a8f8b3
commit c92765d962

View File

@ -794,6 +794,9 @@ Yap_absmi(int inp)
{ {
CELL cut_b = LCL0-(CELL *)(SREG[E_CB]); CELL cut_b = LCL0-(CELL *)(SREG[E_CB]);
#ifdef SHADOW_S
S = SREG;
#endif
saveregs(); saveregs();
/* do a garbage collection first to check if we can recover memory */ /* do a garbage collection first to check if we can recover memory */
if (!Yap_growheap(FALSE, 0, NULL)) { if (!Yap_growheap(FALSE, 0, NULL)) {
@ -803,8 +806,12 @@ Yap_absmi(int inp)
} }
setregs(); setregs();
CACHE_A1(); CACHE_A1();
SREG = ASP; #ifdef SHADOW_S
SREG[E_CB] = (CELL)(LCL0-cut_b); SREG = S;
#endif
if (SREG == ASP) {
SREG[E_CB] = (CELL)(LCL0-cut_b);
}
} }
goto reset_absmi; goto reset_absmi;
@ -834,8 +841,12 @@ Yap_absmi(int inp)
FAIL(); FAIL();
} }
setregs(); setregs();
SREG = ASP; #ifdef SHADOW_S
SREG[E_CB] = (CELL)(LCL0-cut_b); SREG = S;
#endif
if (SREG == ASP) {
SREG[E_CB] = (CELL)(LCL0-cut_b);
}
} }
goto reset_absmi; goto reset_absmi;