garbage collection fixes

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1139 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc
2004-09-16 17:29:08 +00:00
parent 921e576877
commit 3d308525e0
7 changed files with 461 additions and 94 deletions

View File

@@ -585,7 +585,11 @@ copy_long_int(CELL *st, CELL *pt)
/* first thing, store a link to the list before we move on */
st[0] = (CELL)FunctorLongInt;
st[1] = pt[1];
#if GC_NO_TAGS
st[2] = 2*sizeof(CELL)+EndSpecials;
#else
st[2] = ((2*sizeof(CELL)+EndSpecials)|MBIT);
#endif
/* now reserve space */
return st+3;
}
@@ -598,9 +602,17 @@ copy_double(CELL *st, CELL *pt)
st[1] = pt[1];
#if SIZEOF_DOUBLE == 2*SIZEOF_LONG_INT
st[2] = pt[2];
st[3] = ((3*sizeof(CELL)+EndSpecials)|MBIT);
#if GC_NO_TAGS
st[3] = 3*sizeof(CELL)+EndSpecials;
#else
st[3] = ((3*sizeof(CELL)+EndSpecials)|MBIT);
#endif /* GC_NO_TAGS */
#else
#if GC_NO_TAGS
st[2] = ((2*sizeof(CELL)+EndSpecials)|MBIT);
#else
st[2] = 2*sizeof(CELL)+EndSpecials;
#endif /* GC_NO_TAGS */
#endif
/* now reserve space */
return st+(2+SIZEOF_DOUBLE/SIZEOF_LONG_INT);
@@ -620,7 +632,11 @@ copy_big_int(CELL *st, CELL *pt)
memcpy((void *)(st+1), (void *)(pt+1), sz);
st = st+1+sz/CellSize;
/* then the tail for gc */
#if GC_NO_TAGS
st[0] = sz+CellSize+EndSpecials;
#else
st[0] = (sz+CellSize+EndSpecials)|MBIT;
#endif
return st+1;
}
#endif /* BIG_INT */
@@ -2483,14 +2499,14 @@ GetDBTerm(DBTerm *DBSP)
return t;
}
pt = CellPtr(DBSP->Contents);
if (H+NOf > ASP-CalculateStackGap()) {
if (H+NOf > ASP-CalculateStackGap()/sizeof(CELL)) {
if (Yap_PrologMode & InErrorMode) {
if (H+NOf > ASP)
fprintf(Yap_stderr, "\n\n [ FATAL ERROR: No Stack for Error Handling ]\n");
Yap_exit( 1);
} else {
Yap_Error_Size = NOf*sizeof(CELL);
return((Term)0);
return (Term)0;
}
}
HeapPtr = cpcells(HOld, pt, NOf);