fix bad initial memory allocation in WIN32.
This commit is contained in:
parent
0d8aed7971
commit
9e89308fd4
12
C/alloc.c
12
C/alloc.c
@ -809,7 +809,7 @@ Yap_AllocCodeSpace(unsigned long int size)
|
|||||||
|
|
||||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||||
|
|
||||||
#undef DEBUG_WIN32_ALLOC
|
#define DEBUG_WIN32_ALLOC 1
|
||||||
|
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
|
|
||||||
@ -821,8 +821,6 @@ ExtendWorkSpace(Int s, int fixed_allocation)
|
|||||||
LPVOID b = brk;
|
LPVOID b = brk;
|
||||||
prolog_exec_mode OldPrologMode = Yap_PrologMode;
|
prolog_exec_mode OldPrologMode = Yap_PrologMode;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Yap_PrologMode = ExtendStackMode;
|
Yap_PrologMode = ExtendStackMode;
|
||||||
|
|
||||||
#if DEBUG_WIN32_ALLOC
|
#if DEBUG_WIN32_ALLOC
|
||||||
@ -864,7 +862,7 @@ ExtendWorkSpace(Int s, int fixed_allocation)
|
|||||||
}
|
}
|
||||||
brk = (LPVOID) ((Int) b + s);
|
brk = (LPVOID) ((Int) b + s);
|
||||||
#if DEBUG_WIN32_ALLOC
|
#if DEBUG_WIN32_ALLOC
|
||||||
fprintf(stderr,"OK: %p--%p\n",b,brk);
|
fprintf(stderr,"OK: %p--%p %lx\n",b, brk, s);
|
||||||
#endif
|
#endif
|
||||||
Yap_PrologMode = OldPrologMode;
|
Yap_PrologMode = OldPrologMode;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -878,7 +876,6 @@ InitWorkSpace(Int s)
|
|||||||
|
|
||||||
GetSystemInfo(&si);
|
GetSystemInfo(&si);
|
||||||
psz = Yap_page_size = si.dwPageSize;
|
psz = Yap_page_size = si.dwPageSize;
|
||||||
s = ((s+ (YAP_ALLOC_SIZE-1))/YAP_ALLOC_SIZE)*YAP_ALLOC_SIZE;
|
|
||||||
brk = (LPVOID)psz;
|
brk = (LPVOID)psz;
|
||||||
if (!ExtendWorkSpace(s,0))
|
if (!ExtendWorkSpace(s,0))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1497,6 +1494,11 @@ Yap_InitMemory(UInt Trail, UInt Heap, UInt Stack)
|
|||||||
UInt pm, sa, ta;
|
UInt pm, sa, ta;
|
||||||
void *addr;
|
void *addr;
|
||||||
|
|
||||||
|
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||||
|
Stack = ((Stack+ (YAP_ALLOC_SIZE-1))/YAP_ALLOC_SIZE)*YAP_ALLOC_SIZE;
|
||||||
|
Heap = ((Heap+ (YAP_ALLOC_SIZE-1))/YAP_ALLOC_SIZE)*YAP_ALLOC_SIZE;
|
||||||
|
Trail = ((Trail+ (YAP_ALLOC_SIZE-1))/YAP_ALLOC_SIZE)*YAP_ALLOC_SIZE;
|
||||||
|
#endif
|
||||||
pm = (Trail + Heap + Stack); /* memory to be
|
pm = (Trail + Heap + Stack); /* memory to be
|
||||||
* requested */
|
* requested */
|
||||||
sa = Stack; /* stack area size */
|
sa = Stack; /* stack area size */
|
||||||
|
Reference in New Issue
Block a user