Two fixes:
GMP should not do error handling itself, as its execution env is not reliable. allocate should check for space. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@875 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
8df97ef09d
commit
1f2fb8284a
59
C/absmi.c
59
C/absmi.c
@ -2155,6 +2155,37 @@ Yap_absmi(int inp)
|
||||
/* don't do debugging and friends here */
|
||||
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)) {
|
||||
JMPNext();
|
||||
}
|
||||
ASP = YREG;
|
||||
if (CFREG == (CELL)(LCL0+1)) {
|
||||
goto noheapleft;
|
||||
}
|
||||
if (CFREG == Unsigned(LCL0)) {
|
||||
if (Yap_ReadTimedVar(WokenGoals) != TermNil) {
|
||||
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 ; */
|
||||
NoStackEither:
|
||||
/* find something to fool S */
|
||||
@ -2548,31 +2579,41 @@ Yap_absmi(int inp)
|
||||
ENDOp();
|
||||
|
||||
Op(deallocate, e);
|
||||
CACHE_Y_AS_ENV(YREG);
|
||||
PREG = NEXTOP(PREG, e);
|
||||
/* other instructions do depend on S being set by deallocate
|
||||
:-( */
|
||||
SREG = YREG;
|
||||
CPREG = (yamop *) YREG[E_CP];
|
||||
ENV = YREG = (CELL *) YREG[E_E];
|
||||
CPREG = (yamop *) E_YREG[E_CP];
|
||||
ENV = E_YREG = (CELL *) E_YREG[E_E];
|
||||
#ifdef DEPTH_LIMIT
|
||||
DEPTH = YREG[E_DEPTH];
|
||||
DEPTH = E_YREG[E_DEPTH];
|
||||
#endif /* DEPTH_LIMIT */
|
||||
#ifdef FROZEN_STACKS
|
||||
{
|
||||
choiceptr top_b = PROTECT_FROZEN_B(B);
|
||||
#ifdef SBA
|
||||
if (YREG > (CELL *) top_b || YREG < H) YREG = (CELL *) top_b;
|
||||
if (E_YREG > (CELL *) top_b || E_YREG < H) E_YREG = (CELL *) top_b;
|
||||
#else
|
||||
if (YREG > (CELL *) top_b) YREG = (CELL *) top_b;
|
||||
if (E_YREG > (CELL *) top_b) E_YREG = (CELL *) top_b;
|
||||
#endif
|
||||
else YREG = (CELL *)((CELL) YREG + ENV_Size(CPREG));
|
||||
else E_YREG = (CELL *)((CELL) E_YREG + ENV_Size(CPREG));
|
||||
}
|
||||
#else
|
||||
if (YREG > (CELL *) B)
|
||||
YREG = (CELL *) B;
|
||||
if (E_YREG > (CELL *) B)
|
||||
E_YREG = (CELL *) B;
|
||||
else
|
||||
YREG = (CELL *) ((CELL) YREG + ENV_Size(CPREG));
|
||||
E_YREG = (CELL *) ((CELL) E_YREG + ENV_Size(CPREG));
|
||||
#endif /* FROZEN_STACKS */
|
||||
#ifndef NO_CHECKING
|
||||
if (Yap_do_low_level_trace) {
|
||||
fprintf(stderr, "H is %p, YENV is %p\n", H, YENV);
|
||||
}
|
||||
/* check stacks */
|
||||
check_stack(NoStackDeallocate, H);
|
||||
#endif
|
||||
WRITEBACK_Y_AS_ENV();
|
||||
ENDCACHE_Y_AS_ENV();
|
||||
GONext();
|
||||
ENDOp();
|
||||
|
||||
|
@ -98,8 +98,6 @@ AllocBigNumSpace(size_t size)
|
||||
size = AdjustSize(size)/CellSize;
|
||||
alloc_ptr[0] = size;
|
||||
alloc_ptr += size+1;
|
||||
if (alloc_ptr > ASP-1024)
|
||||
Yap_Error(SYSTEM_ERROR,TermNil,"no space for bignum");
|
||||
return(ret);
|
||||
}
|
||||
|
||||
@ -116,8 +114,6 @@ ReAllocBigNumSpace(void *optr, size_t osize, size_t size)
|
||||
if (((CELL *)optr)+osize == alloc_ptr) {
|
||||
alloc_ptr += (size-osize);
|
||||
((CELL *)optr)[-1] = size;
|
||||
if (alloc_ptr > ASP-1024)
|
||||
Yap_Error(SYSTEM_ERROR,TermNil,"no space for bignum");
|
||||
return(optr);
|
||||
}
|
||||
out = AllocBigNumSpace(size);
|
||||
|
@ -552,7 +552,8 @@ static char *opformat[] =
|
||||
"try_me_else\t\t%l\t%x",
|
||||
"jump\t\t%l",
|
||||
"jump\t\t%l",
|
||||
"procceed",
|
||||
"proceed",
|
||||
"safe_proceed",
|
||||
"call\t\t%p,%d,%z",
|
||||
"execute\t\t%p",
|
||||
"sys\t\t%p",
|
||||
|
@ -3227,7 +3227,8 @@ c_recorded(int flags)
|
||||
|
||||
static Int
|
||||
lu_recorded(PredEntry *pe) {
|
||||
if (Yap_op_from_opcode(P->opc) == _procceed) {
|
||||
op_numbers opc = Yap_op_from_opcode(P->opc);
|
||||
if (opc == _procceed) {
|
||||
P = pe->CodeOfPred;
|
||||
} else {
|
||||
CP = P;
|
||||
|
@ -113,10 +113,6 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
||||
/* extern int gc_calls; */
|
||||
|
||||
vsc_count++;
|
||||
if (vsc_count < 1077000) {
|
||||
return;
|
||||
}
|
||||
if (vsc_count == 1077205LL) vsc_xstop = 1;
|
||||
#ifdef COMMENTED
|
||||
if (vsc_count < 123536430LL) {
|
||||
if (vsc_count == 123536441LL) vsc_xstop = 1;
|
||||
|
Reference in New Issue
Block a user