fix growglobal to handle the USE_MALLOC case correctly.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1634 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2006-05-18 13:07:48 +00:00
parent 64a70572de
commit ef80f1df70
1 changed files with 16 additions and 1 deletions

View File

@ -262,11 +262,19 @@ MoveGlobalOnly(void)
* cpcellsd(To,From,NOfCells) - copy the cells downwards - in
* absmi.asm
*/
#if USE_SYSTEM_MALLOC
#if HAVE_MEMMOVE
cpcellsd(H0, (CELL *)((char *)OldH0+DelayDiff), OldH - OldH0);
#else
cpcellsd(H, (CELL *)((char *)OldH+DelayDiff), OldH - OldH0);
#endif
#else
#if HAVE_MEMMOVE
cpcellsd(H0, OldH0, OldH - OldH0);
#else
cpcellsd(H, OldH, OldH - OldH0);
#endif
#endif
}
static void
@ -673,6 +681,12 @@ static_growglobal(long size, CELL **ptr)
}
ASP -= 256;
YAPEnterCriticalSection();
#if USE_SYSTEM_MALLOC
/* we always run the risk of shifting memory */
size0 = Yap_GlobalBase-old_GlobalBase;
DelayDiff = size0;
TrDiff = LDiff = GDiff = size+size0;
#else
if (minimal_request) {
DelayDiff = size-size0;
TrDiff = LDiff = GDiff = size;
@ -680,14 +694,15 @@ static_growglobal(long size, CELL **ptr)
TrDiff = LDiff = GDiff = size;
DelayDiff = 0;
}
#endif
XDiff = HDiff = 0;
Yap_GlobalBase = old_GlobalBase;
SetHeapRegs();
MoveLocalAndTrail();
MoveGlobalOnly();
if (minimal_request) {
MoveDelays();
}
MoveGlobalOnly();
AdjustStacksAndTrail();
AdjustRegs(MaxTemps);
if (ptr)