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