📄 gcconfig.h
字号:
/* We could use _etext instead, but that */ /* would include .rodata, which may */ /* contain large read-only data tables */ /* that we'd rather not scan. */# endif extern int _end[];# define DATAEND (_end)# else extern int etext[];# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))# endif# ifdef USE_I686_PREFETCH# define PREFETCH(x) \ __asm__ __volatile__ (" prefetchnta %0": : "m"(*(char *)(x))) /* Empirically prefetcht0 is much more effective at reducing */ /* cache miss stalls for the targetted load instructions. But it */ /* seems to interfere enough with other cache traffic that the net */ /* result is worse than prefetchnta. */# if 0 /* Using prefetches for write seems to have a slight negative */ /* impact on performance, at least for a PIII/500. */# define PREFETCH_FOR_WRITE(x) \ __asm__ __volatile__ (" prefetcht0 %0": : "m"(*(char *)(x)))# endif# endif# ifdef USE_3DNOW_PREFETCH# define PREFETCH(x) \ __asm__ __volatile__ (" prefetch %0": : "m"(*(char *)(x)))# define PREFETCH_FOR_WRITE(x) \ __asm__ __volatile__ (" prefetchw %0": : "m"(*(char *)(x)))# endif# endif# ifdef CYGWIN32# define OS_TYPE "CYGWIN32" extern int _data_start__[]; extern int _data_end__[]; extern int _bss_start__[]; extern int _bss_end__[]; /* For binutils 2.9.1, we have */ /* DATASTART = _data_start__ */ /* DATAEND = _bss_end__ */ /* whereas for some earlier versions it was */ /* DATASTART = _bss_start__ */ /* DATAEND = _data_end__ */ /* To get it right for both, we take the */ /* minumum/maximum of the two. */# define MAX(x,y) ((x) > (y) ? (x) : (y))# define MIN(x,y) ((x) < (y) ? (x) : (y))# define DATASTART ((ptr_t) MIN(_data_start__, _bss_start__))# define DATAEND ((ptr_t) MAX(_data_end__, _bss_end__))# undef STACK_GRAN# define STACK_GRAN 0x10000# define HEURISTIC1# endif# ifdef OS2# define OS_TYPE "OS2" /* STACKBOTTOM and DATASTART are handled specially in */ /* os_dep.c. OS2 actually has the right */ /* system call! */# define DATAEND /* not needed */# define USE_GENERIC_PUSH_REGS# endif# ifdef MSWIN32# define OS_TYPE "MSWIN32" /* STACKBOTTOM and DATASTART are handled specially in */ /* os_dep.c. */# ifndef __WATCOMC__# define MPROTECT_VDB# endif# define DATAEND /* not needed */# endif# ifdef MSWINCE# define OS_TYPE "MSWINCE"# define DATAEND /* not needed */# endif# ifdef DJGPP# define OS_TYPE "DJGPP"# include "stubinfo.h" extern int etext[]; extern int _stklen; extern int __djgpp_stack_limit;# define DATASTART ((ptr_t)((((word) (etext)) + 0x1ff) & ~0x1ff))/* # define STACKBOTTOM ((ptr_t)((word) _stubinfo + _stubinfo->size \ + _stklen)) */# define STACKBOTTOM ((ptr_t)((word) __djgpp_stack_limit + _stklen)) /* This may not be right. */# endif# ifdef OPENBSD# define OS_TYPE "OPENBSD"# endif# ifdef FREEBSD# define OS_TYPE "FREEBSD"# ifndef GC_FREEBSD_THREADS# define MPROTECT_VDB# endif# define SIG_SUSPEND SIGUSR1# define SIG_THR_RESTART SIGUSR2# define FREEBSD_STACKBOTTOM# ifdef __ELF__# define DYNAMIC_LOADING# endif/* Handle unmapped hole i386*-*-freebsd[45]* may put between etext and edata. */ extern char etext[]; extern char edata[]; extern char end[];# define NEED_FIND_LIMIT# define DATASTART ((ptr_t)(etext))# define MIN(x,y) ((x) < (y) ? (x) : (y))# define DATAEND (MIN (GC_find_limit (DATASTART, TRUE), DATASTART2))# define DATASTART2 ((ptr_t)(edata))# define DATAEND2 ((ptr_t)(end))# endif# ifdef NETBSD# define OS_TYPE "NETBSD"# ifdef __ELF__# define DYNAMIC_LOADING# endif# endif# ifdef THREE86BSD# define OS_TYPE "THREE86BSD"# endif# ifdef BSDI# define OS_TYPE "BSDI"# endif# if defined(OPENBSD) || defined(NETBSD) \ || defined(THREE86BSD) || defined(BSDI)# define HEURISTIC2 extern char etext[];# define DATASTART ((ptr_t)(etext))# endif# ifdef NEXT# define OS_TYPE "NEXT"# define DATASTART ((ptr_t) get_etext())# define STACKBOTTOM ((ptr_t)0xc0000000)# define DATAEND /* not needed */# endif# ifdef DOS4GW# define OS_TYPE "DOS4GW" extern long __nullarea; extern char _end; extern char *_STACKTOP; /* Depending on calling conventions Watcom C either precedes or does not precedes with undescore names of C-variables. Make sure startup code variables always have the same names. */ #pragma aux __nullarea "*"; #pragma aux _end "*";# define STACKBOTTOM ((ptr_t) _STACKTOP) /* confused? me too. */# define DATASTART ((ptr_t) &__nullarea)# define DATAEND ((ptr_t) &_end)# endif# ifdef HURD# define OS_TYPE "HURD"# define STACK_GROWS_DOWN# define HEURISTIC2 extern int __data_start[];# define DATASTART ( (ptr_t) (__data_start)) extern int _end[];# define DATAEND ( (ptr_t) (_end))/* # define MPROTECT_VDB Not quite working yet? */# define DYNAMIC_LOADING# endif# endif# ifdef NS32K# define MACH_TYPE "NS32K"# define ALIGNMENT 4 extern char **environ;# define DATASTART ((ptr_t)(&environ)) /* hideous kludge: environ is the first */ /* word in crt0.o, and delimits the start */ /* of the data segment, no matter which */ /* ld options were passed through. */# define STACKBOTTOM ((ptr_t) 0xfffff000) /* for Encore */# endif# ifdef MIPS# define MACH_TYPE "MIPS"# ifdef LINUX /* This was developed for a linuxce style platform. Probably */ /* needs to be tweaked for workstation class machines. */# define OS_TYPE "LINUX"# define DYNAMIC_LOADING extern int _end[];# define DATAEND (_end) extern int __data_start[];# define DATASTART ((ptr_t)(__data_start))# define ALIGNMENT 4# define USE_GENERIC_PUSH_REGS# define LINUX_STACKBOTTOM# endif /* Linux */# ifdef EWS4800# define HEURISTIC2# if defined(_MIPS_SZPTR) && (_MIPS_SZPTR == 64) extern int _fdata[], _end[];# define DATASTART ((ptr_t)_fdata)# define DATAEND ((ptr_t)_end)# define CPP_WORDSZ _MIPS_SZPTR# define ALIGNMENT (_MIPS_SZPTR/8)# else extern int etext[], edata[], end[]; extern int _DYNAMIC_LINKING[], _gp[];# define DATASTART ((ptr_t)((((word)etext + 0x3ffff) & ~0x3ffff) \ + ((word)etext & 0xffff)))# define DATAEND (edata)# define DATASTART2 (_DYNAMIC_LINKING \ ? (ptr_t)(((word)_gp + 0x8000 + 0x3ffff) & ~0x3ffff) \ : (ptr_t)edata)# define DATAEND2 (end)# define ALIGNMENT 4# endif# define OS_TYPE "EWS4800"# define USE_GENERIC_PUSH_REGS 1# endif# ifdef ULTRIX# define HEURISTIC2# define DATASTART (ptr_t)0x10000000 /* Could probably be slightly higher since */ /* startup code allocates lots of stuff. */# define OS_TYPE "ULTRIX"# define ALIGNMENT 4# endif# ifdef RISCOS# define HEURISTIC2# define DATASTART (ptr_t)0x10000000# define OS_TYPE "RISCOS"# define ALIGNMENT 4 /* Required by hardware */# endif# ifdef IRIX5# define HEURISTIC2 extern int _fdata[];# define DATASTART ((ptr_t)(_fdata))# ifdef USE_MMAP# define HEAP_START (ptr_t)0x30000000# else# define HEAP_START DATASTART# endif /* Lowest plausible heap address. */ /* In the MMAP case, we map there. */ /* In either case it is used to identify */ /* heap sections so they're not */ /* considered as roots. */# define OS_TYPE "IRIX5"# define MPROTECT_VDB# ifdef _MIPS_SZPTR# define CPP_WORDSZ _MIPS_SZPTR# define ALIGNMENT (_MIPS_SZPTR/8)# if CPP_WORDSZ != 64# define ALIGN_DOUBLE# endif# else# define ALIGNMENT 4# define ALIGN_DOUBLE# endif# define DYNAMIC_LOADING# endif# ifdef MSWINCE# define OS_TYPE "MSWINCE"# define ALIGNMENT 4# define DATAEND /* not needed */# endif# if defined(NETBSD)# define OS_TYPE "NETBSD"# define ALIGNMENT 4# define HEURISTIC2# define USE_GENERIC_PUSH_REGS extern int _fdata[];# define DATASTART ((ptr_t)(_fdata)) extern int _end[];# define DATAEND ((ptr_t)(_end))# define DYNAMIC_LOADING# endif# endif# ifdef RS6000# define MACH_TYPE "RS6000"# ifdef __64BIT__# define ALIGNMENT 8# define CPP_WORDSZ 64# else# define ALIGNMENT 4# define CPP_WORDSZ 32# endif extern int _data[], _end[];# define DATASTART ((ptr_t)((ulong)_data))# define DATAEND ((ptr_t)((ulong)_end)) extern int errno;# define STACKBOTTOM ((ptr_t)((ulong)&errno))# define USE_GENERIC_PUSH_REGS# define DYNAMIC_LOADING /* For really old versions of AIX, this may have to be removed. */# endif# ifdef HP_PA# define MACH_TYPE "HP_PA"# ifdef __LP64__# define CPP_WORDSZ 64# define ALIGNMENT 8# else# define CPP_WORDSZ 32# define ALIGNMENT 4# define ALIGN_DOUBLE# endif# if !defined(GC_HPUX_THREADS) && !defined(GC_LINUX_THREADS)# ifndef LINUX /* For now. */# define MPROTECT_VDB# endif# else# define GENERIC_COMPARE_AND_SWAP /* No compare-and-swap instruction. Use pthread mutexes */ /* when we absolutely have to. */# ifdef PARALLEL_MARK# define USE_MARK_BYTES /* Minimize compare-and-swap usage. */# endif# endif# define STACK_GROWS_UP# ifdef HPUX# define OS_TYPE "HPUX" extern int __data_start[];# define DATASTART ((ptr_t)(__data_start))# if 0 /* The following appears to work for 7xx systems running HP/UX */ /* 9.xx Furthermore, it might result in much faster */ /* collections than HEURISTIC2, which may involve scanning */ /* segments that directly precede the stack. It is not the */ /* default, since it may not work on older machine/OS */ /* combinations. (Thanks to Raymond X.T. Nijssen for uncovering */ /* this.) */# define STACKBOTTOM ((ptr_t) 0x7b033000) /* from /etc/conf/h/param.h */# else /* Gustavo Rodriguez-Rivera suggested changing HEURISTIC2 */ /* to this. Note that the GC must be initialized before the */ /* first putenv call. */ extern char ** environ;# define STACKBOTTOM ((ptr_t)environ)# endif# define DYNAMIC_LOADING# include <unistd.h># define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)# ifndef __GNUC__# define PREFETCH(x) { \ register long addr = (long)(x); \ (void) _asm ("LDW", 0, 0, addr, 0); \ }# endif# endif /* HPUX */# ifdef LINUX# define OS_TYPE "LINUX"# define LINUX_STACKBOTTOM# define DYNAMIC_LOADING# define LINUX_DATA_START extern int _end[];# define DATAEND (_end)# endif /* LINUX */# endif /* HP_PA */# ifdef ALPHA# define MACH_TYPE "ALPHA"# define ALIGNMENT 8# ifdef NETBSD# define OS_TYPE "NETBSD"# define HEURISTIC2# define DATASTART GC_data_start# define ELFCLASS32 32# define ELFCLASS64 64# define ELF_CLASS ELFCLASS64# define CPP_WORDSZ 64# define DYNAMIC_LOADING# endif# ifdef OPENBSD# define OS_TYPE "OPENBSD"# define HEURISTIC2# define CPP_WORDSZ 64# ifdef __ELF__ /* since OpenBSD/Alpha 2.9 */# define DATASTART GC_data_start# define ELFCLASS32 32# define ELFCLASS64 64# define ELF_CLASS ELFCLASS64# else /* ECOFF, until OpenBSD/Alpha 2.7 */# define DATASTART ((ptr_t) 0x140000000)# endif# endif# ifdef FREEBSD# define OS_TYPE "FREEBSD"/* MPROTECT_VDB is not yet supported at all on FreeBSD/alpha. */# define SIG_SUSPEND SIGUSR1# define SIG_THR_RESTART SIGUSR2# define FREEBSD_STACKBOTTOM# ifdef __ELF__# define DYNAMIC_LOADING# endif/* Handle unmapped hole alpha*-*-freebsd[45]* puts between etext and edata. */ extern char etext[]; extern char edata[]; extern char end[];# define NEED_FIND_LIMIT# define DATASTART ((ptr_t)(etext))# define DATAEND (GC_find_limit (DATASTART, TRUE))# define DATASTART2 ((ptr_t)(edata))# define DATAEND2 ((ptr_t)(end))# define CPP_WORDSZ 64# endif# ifdef OSF1# define OS_TYPE "OSF1"# define DATASTART ((ptr_t) 0x140000000) extern int _end[];# define DATAEND ((ptr_t) _end) extern char ** environ; /* round up from the value of environ to the nearest page boundary */ /* Probably breaks if putenv is called before collector */ /* initialization. */# define STACKBOTTOM ((ptr_t)(((word)(environ) | (getpagesize()-1))+1))/* # define HEURISTIC2 */ /* Normally HEURISTIC2 is too conervative, since */ /* the text segment immediately follows the stack. */ /* Hence we give an upper pound. */ /* This is currently unused, since we disabled HEURISTIC2 */ extern int __start[];# define HEURISTIC2_LIMIT ((ptr_t)((word)(__start) & ~(getpagesize()-1)))# define CPP_WORDSZ 64# define MPROTECT_VDB# define DYNAMIC_LOADING# endif# ifdef LINUX# define OS_TYPE "LINUX"# define CPP_WORDSZ 64# define STACKBOTTOM ((ptr_t) 0x120000000)# ifdef __ELF__# define SEARCH_FOR_DATA_START# define DATASTART GC_data_start# define DYNAMIC_LOADING# else# define DATASTART ((ptr_t) 0x140000000)# endif extern int _end[];# define DATAEND (_end)# define MPROTECT_VDB /* Has only been superficially tested. May not */ /* work on all versions. */# endif# endif# ifdef IA64# define MACH_TYPE "IA64"# define USE_GENERIC_PUSH_REGS /* We need to get preserved registers in addition to register */ /* windows. That's easiest to do with setjmp. */# ifdef PARALLEL_MARK# define USE_MARK_BYTES /* Compare-and-exchange is too expensive to use for */ /* setting mark bits. */# endif# ifdef HPUX# ifdef _ILP32# define CPP_WORDSZ 32# define ALIGN_DOUBLE /* Requires 8 byte alignment for malloc */# define ALIGNMENT 4# else# ifndef _LP64 ---> unknown ABI# endif# define CPP_WORDSZ 64# define ALIGN_DOUBLE /* Requires 16 byte alignment for malloc */# define ALIGNMENT 8# endif# define OS_TYPE "HPUX" extern int __data_start[];# define DATASTART ((ptr_t)(__data_start)) /* Gustavo Rodriguez-Rivera suggested changing HEURISTIC2 */ /* to this. Note that the GC must be initialized before the */ /* first putenv call. */ extern char ** environ;# define STACKBOTTOM ((ptr_t)environ)# define DYNAMIC_LOADING# include <unistd.h># define GETPAGESIZE() sysconf(_SC_PAGE_SIZE) /* The following was empirically determined, and is probably */ /* not very robust. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -