fix Yap_shift_visit for malloc: a few miscalculations...
This commit is contained in:
parent
55036ad9bb
commit
a52317b9c2
8
C/grow.c
8
C/grow.c
@ -1596,8 +1596,8 @@ Yap_shift_visit(CELL **to_visit, CELL ***to_visit_maxp)
|
||||
{
|
||||
#if USE_SYSTEM_MALLOC
|
||||
CELL **to_visit_max = *to_visit_maxp;
|
||||
Int sz1 = (CELL)to_visit_max-(CELL)to_visit;
|
||||
Int sz0 = AuxTop - (ADDR)to_visit_maxp, sz, dsz;
|
||||
Int sz1 = (CELL)to_visit-(CELL)to_visit_max;
|
||||
Int sz0 = AuxTop - (ADDR)to_visit_max, sz, dsz;
|
||||
char *newb = Yap_ExpandPreAllocCodeSpace(0, NULL);
|
||||
|
||||
if (newb == NULL) {
|
||||
@ -1608,6 +1608,10 @@ Yap_shift_visit(CELL **to_visit, CELL ***to_visit_maxp)
|
||||
sz = AuxTop-newb;
|
||||
/* how much we grew */
|
||||
dsz = sz-sz0;
|
||||
if (dsz == 0) {
|
||||
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"cannot allocate temporary space for unification (%p)", to_visit);
|
||||
return to_visit;
|
||||
}
|
||||
/* copy whole block to end */
|
||||
cpcellsd((CELL *)newb, (CELL *)(newb+dsz), sz0/sizeof(CELL));
|
||||
/* base pointer is block start */
|
||||
|
Reference in New Issue
Block a user