824 |
|
|
825 |
} |
} |
826 |
|
|
827 |
|
/* FIXME this is a work-around for the special MacOSX memory |
828 |
|
initialization sequence, which sets heap_end, traditionally |
829 |
|
initialized in gcl_init_alloc. Mac and windows have non-std |
830 |
|
sbrk-emulating memory subsystems, and their internals need to be |
831 |
|
homogenized and integrated into the traditional unix sequence for |
832 |
|
simplicity. set_maxpage is overloaded, and the positioning of its |
833 |
|
call is too fragile. 20050115 CM*/ |
834 |
|
static int gcl_alloc_initialized; |
835 |
|
|
836 |
void |
void |
837 |
set_maxpage(void) { |
set_maxpage(void) { |
838 |
|
|
841 |
#ifdef SGC |
#ifdef SGC |
842 |
page_multiple=getpagesize()/PAGESIZE; |
page_multiple=getpagesize()/PAGESIZE; |
843 |
if (page_multiple==0) error("PAGESIZE must be factor of getpagesize()"); |
if (page_multiple==0) error("PAGESIZE must be factor of getpagesize()"); |
844 |
if (heap_end) { |
if (gcl_alloc_initialized) { |
845 |
extern long maxpage; |
extern long maxpage; |
846 |
maxpage=page(heap_end); |
maxpage=page(heap_end); |
847 |
memory_protect(sgc_enabled ? 1 : 0); |
memory_protect(sgc_enabled ? 1 : 0); |
863 |
gcl_init_alloc(void) { |
gcl_init_alloc(void) { |
864 |
|
|
865 |
long i; |
long i; |
|
static int initialized; |
|
866 |
#ifdef GCL_GPROF |
#ifdef GCL_GPROF |
867 |
extern void *GCL_GPROF_START; |
extern void *GCL_GPROF_START; |
868 |
unsigned textpage=2*((void *)&etext-(void *)&GCL_GPROF_START)/PAGESIZE; |
unsigned textpage=2*((void *)&etext-(void *)&GCL_GPROF_START)/PAGESIZE; |
869 |
#endif |
#endif |
870 |
|
|
871 |
if (initialized) return; |
if (gcl_alloc_initialized) return; |
|
initialized=1; |
|
872 |
|
|
873 |
|
|
874 |
#ifdef BSD |
#ifdef BSD |
992 |
if (maxcbpage<textpage) |
if (maxcbpage<textpage) |
993 |
maxcbpage=textpage; |
maxcbpage=textpage; |
994 |
#endif |
#endif |
995 |
|
gcl_alloc_initialized=1; |
996 |
|
|
997 |
} |
} |
998 |
|
|