don't get confused when expanding over a hole

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1176 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2004-11-17 05:24:20 +00:00
parent 5f5589e8de
commit 481d9d38fb
3 changed files with 6 additions and 2 deletions

View File

@ -12,7 +12,7 @@
* Last rev: *
* mods: *
* comments: allocating space *
* version:$Id: alloc.c,v 1.64 2004-11-04 18:22:30 vsc Exp $ *
* version:$Id: alloc.c,v 1.65 2004-11-17 05:24:20 vsc Exp $ *
*************************************************************************/
#ifdef SCCS
static char SccsId[] = "%W% %G%";
@ -1396,6 +1396,7 @@ Yap_ExtendWorkSpaceThroughHole(UInt s)
Yap_hole_start = (ADDR)WorkSpaceTop0;
Yap_hole_end = (ADDR)WorkSpaceTop-s;
#endif
Yap_ErrorMessage = NULL;
return WorkSpaceTop-WorkSpaceTop0;
}
#if defined(_WIN32)
@ -1409,6 +1410,7 @@ Yap_ExtendWorkSpaceThroughHole(UInt s)
WorkSpaceTop = WorkSpaceTop0;
#endif
if (ExtendWorkSpace(s, 0)) {
Yap_ErrorMessage = NULL;
return WorkSpaceTop-WorkSpaceTop0;
}
#endif

View File

@ -177,7 +177,6 @@ yapsbrk(long size)
oldHeapTop = Yap_hole_end;
newHeapTop = oldHeapTop+size;;
Yap_hole_start = Yap_hole_end = NULL;
printf("sbrk past hole %p--%p\n", newHeapTop,H0);
}
if (newHeapTop > HeapLim - MinHeapGap) {
if (HeapTop + size < HeapLim) {

View File

@ -548,6 +548,7 @@ static_growheap(long size, int fix_code, struct intermediates *cip)
if (!Yap_ExtendWorkSpace(size)) {
Int min_size = AdjustPageSize(((CELL)Yap_TrailTop-(CELL)Yap_GlobalBase)+MinHeapGap);
Yap_ErrorMessage = NULL;
if (size < min_size) size = min_size;
minimal_request = size;
size = Yap_ExtendWorkSpaceThroughHole(size);
@ -981,6 +982,7 @@ execute_growstack(long size0, int from_trail)
if (!Yap_ExtendWorkSpace(size)) {
/* make sure stacks and trail are contiguous */
Yap_ErrorMessage = NULL;
minimal_request = AdjustPageSize(((CELL)Yap_TrailTop-(CELL)Yap_GlobalBase)+4*MinHeapGap+size0);
size = Yap_ExtendWorkSpaceThroughHole(minimal_request);
@ -1240,6 +1242,7 @@ static int do_growtrail(long size)
execute_growstack(size, TRUE);
#else
if (!Yap_ExtendWorkSpace(size)) {
Yap_ErrorMessage = NULL;
execute_growstack(size, TRUE);
}
YAPEnterCriticalSection();