📄 gcconfig.h
字号:
# define OS_TYPE "LINUX"
/* The following works on NUE and older kernels: */
/* # define STACKBOTTOM ((ptr_t) 0xa000000000000000l) */
/* This does not work on NUE: */
# define LINUX_STACKBOTTOM
/* We also need the base address of the register stack */
/* backing store. This is computed in */
/* GC_linux_register_stack_base based on the following */
/* constants: */
# define BACKING_STORE_ALIGNMENT 0x100000
# define BACKING_STORE_DISPLACEMENT 0x80000000
extern ptr_t GC_register_stackbottom;
# define BACKING_STORE_BASE GC_register_stackbottom
# define SEARCH_FOR_DATA_START
# ifdef __GNUC__
# define DYNAMIC_LOADING
# else
/* In the Intel compiler environment, we seem to end up with */
/* statically linked executables and an undefined reference */
/* to _DYNAMIC */
# endif
# define MPROTECT_VDB
/* Requires Linux 2.3.47 or later. */
extern int _end[];
# define DATAEND (_end)
# ifdef __GNUC__
# ifndef __INTEL_COMPILER
# define PREFETCH(x) \
__asm__ (" lfetch [%0]": : "r"(x))
# define PREFETCH_FOR_WRITE(x) \
__asm__ (" lfetch.excl [%0]": : "r"(x))
# define CLEAR_DOUBLE(x) \
__asm__ (" stf.spill [%0]=f0": : "r"((void *)(x)))
# else
# include <ia64intrin.h>
# define PREFETCH(x) \
__lfetch(__lfhint_none, (x))
# define PREFETCH_FOR_WRITE(x) \
__lfetch(__lfhint_nta, (x))
# define CLEAR_DOUBLE(x) \
__stf_spill((void *)(x), 0)
# endif // __INTEL_COMPILER
# endif
# endif
# ifdef MSWIN32
/* FIXME: This is a very partial guess. There is no port, yet. */
# define OS_TYPE "MSWIN32"
/* STACKBOTTOM and DATASTART are handled specially in */
/* os_dep.c. */
# define DATAEND /* not needed */
# if defined(_WIN64)
# define CPP_WORDSZ 64
# else
# define CPP_WORDSZ 32 /* Is this possible? */
# endif
# define ALIGNMENT 8
# define STRTOULL _strtoui64
# endif
# endif
# ifdef M88K
# define MACH_TYPE "M88K"
# define ALIGNMENT 4
extern int etext[];
# ifdef CX_UX
# define OS_TYPE "CX_UX"
# define DATASTART ((((word)etext + 0x3fffff) & ~0x3fffff) + 0x10000)
# endif
# ifdef DGUX
# define OS_TYPE "DGUX"
extern ptr_t GC_SysVGetDataStart(size_t, ptr_t);
# define DATASTART GC_SysVGetDataStart(0x10000, (ptr_t)etext)
# endif
# define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */
# endif
# ifdef S370
/* If this still works, and if anyone cares, this should probably */
/* be moved to the S390 category. */
# define MACH_TYPE "S370"
# define ALIGNMENT 4 /* Required by hardware */
# ifdef UTS4
# define OS_TYPE "UTS4"
extern int etext[];
extern int _etext[];
extern int _end[];
extern ptr_t GC_SysVGetDataStart(size_t, ptr_t);
# define DATASTART GC_SysVGetDataStart(0x10000, (ptr_t)_etext)
# define DATAEND (_end)
# define HEURISTIC2
# endif
# endif
# ifdef S390
# define MACH_TYPE "S390"
# ifndef __s390x__
# define ALIGNMENT 4
# define CPP_WORDSZ 32
# else
# define ALIGNMENT 8
# define CPP_WORDSZ 64
# ifndef HBLKSIZE
# define HBLKSIZE 4096
# endif
# endif
# ifdef LINUX
# define OS_TYPE "LINUX"
# define LINUX_STACKBOTTOM
# define DYNAMIC_LOADING
extern int __data_start[];
# define DATASTART ((ptr_t)(__data_start))
extern int _end[];
# define DATAEND (_end)
# define CACHE_LINE_SIZE 256
# define GETPAGESIZE() 4096
# endif
# endif
# ifdef ARM32
# define CPP_WORDSZ 32
# define MACH_TYPE "ARM32"
# define ALIGNMENT 4
# ifdef NETBSD
# define OS_TYPE "NETBSD"
# define HEURISTIC2
# ifdef __ELF__
# define DATASTART GC_data_start
# define DYNAMIC_LOADING
# else
extern char etext[];
# define DATASTART ((ptr_t)(etext))
# endif
# endif
# ifdef LINUX
# define OS_TYPE "LINUX"
# define LINUX_STACKBOTTOM
# undef STACK_GRAN
# define STACK_GRAN 0x10000000
# ifdef __ELF__
# define DYNAMIC_LOADING
# include <features.h>
# if defined(__GLIBC__) && __GLIBC__ >= 2
# define SEARCH_FOR_DATA_START
# else
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. */
/* 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
# endif
# ifdef MSWINCE
# define OS_TYPE "MSWINCE"
# define DATAEND /* not needed */
# endif
# ifdef NOSYS
/* __data_start is usually defined in the target linker script. */
extern int __data_start[];
# define DATASTART (ptr_t)(__data_start)
/* __stack_base__ is set in newlib/libc/sys/arm/crt0.S */
extern void *__stack_base__;
# define STACKBOTTOM ((ptr_t) (__stack_base__))
# endif
#endif
# ifdef CRIS
# define MACH_TYPE "CRIS"
# define CPP_WORDSZ 32
# define ALIGNMENT 1
# define OS_TYPE "LINUX"
# define DYNAMIC_LOADING
# define LINUX_STACKBOTTOM
# define SEARCH_FOR_DATA_START
extern int _end[];
# define DATAEND (_end)
# endif
# ifdef SH
# define MACH_TYPE "SH"
# define ALIGNMENT 4
# ifdef MSWINCE
# define OS_TYPE "MSWINCE"
# define DATAEND /* not needed */
# endif
# ifdef LINUX
# define OS_TYPE "LINUX"
# define LINUX_STACKBOTTOM
# define DYNAMIC_LOADING
# define SEARCH_FOR_DATA_START
extern int _end[];
# define DATAEND (_end)
# endif
# ifdef NETBSD
# define OS_TYPE "NETBSD"
# define HEURISTIC2
# define DATASTART GC_data_start
# define DYNAMIC_LOADING
# endif
# endif
# ifdef SH4
# define MACH_TYPE "SH4"
# define OS_TYPE "MSWINCE"
# define ALIGNMENT 4
# define DATAEND /* not needed */
# endif
# ifdef M32R
# define CPP_WORDSZ 32
# define MACH_TYPE "M32R"
# define ALIGNMENT 4
# ifdef LINUX
# define OS_TYPE "LINUX"
# define LINUX_STACKBOTTOM
# undef STACK_GRAN
# define STACK_GRAN 0x10000000
# define DYNAMIC_LOADING
# define SEARCH_FOR_DATA_START
extern int _end[];
# define DATAEND (_end)
# endif
# endif
# ifdef X86_64
# define MACH_TYPE "X86_64"
# define ALIGNMENT 8
# define CPP_WORDSZ 64
# ifndef HBLKSIZE
# define HBLKSIZE 4096
# endif
# define CACHE_LINE_SIZE 64
# ifdef LINUX
# define OS_TYPE "LINUX"
# define LINUX_STACKBOTTOM
# if !defined(GC_LINUX_THREADS) || !defined(REDIRECT_MALLOC)
# define MPROTECT_VDB
# else
/* We seem to get random errors in incremental mode, */
/* possibly because Linux threads is itself a malloc client */
/* and can't deal with the signals. */
# endif
# ifdef __ELF__
# define DYNAMIC_LOADING
# ifdef UNDEFINED /* includes ro data */
extern int _etext[];
# define DATASTART ((ptr_t)((((word) (_etext)) + 0xfff) & ~0xfff))
# endif
# include <features.h>
# define SEARCH_FOR_DATA_START
extern int _end[];
# define DATAEND (_end)
# else
extern int etext[];
# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
# endif
# if defined(__GNUC__) && __GNUC__ >= 3
# define PREFETCH(x) __builtin_prefetch((x), 0, 0)
# define PREFETCH_FOR_WRITE(x) __builtin_prefetch((x), 1)
# endif
# endif
# ifdef DARWIN
# define OS_TYPE "DARWIN"
# define DARWIN_DONT_PARSE_STACK
# define DYNAMIC_LOADING
/* XXX: see get_end(3), get_etext() and get_end() should not be used.
These aren't used when dyld support is enabled (it is by default) */
# define DATASTART ((ptr_t) get_etext())
# define DATAEND ((ptr_t) get_end())
# define STACKBOTTOM ((ptr_t) 0x7fff5fc00000)
# define USE_MMAP
# define USE_MMAP_ANON
# ifdef GC_DARWIN_THREADS
# define MPROTECT_VDB
# endif
# include <unistd.h>
# define GETPAGESIZE() getpagesize()
/* There seems to be some issues with trylock hanging on darwin. This
should be looked into some more */
# define NO_PTHREAD_TRYLOCK
# endif
# ifdef FREEBSD
# define OS_TYPE "FREEBSD"
# ifndef GC_FREEBSD_THREADS
# define MPROTECT_VDB
# endif
# ifdef __GLIBC__
# define SIG_SUSPEND (32+6)
# define SIG_THR_RESTART (32+5)
extern int _end[];
# define DATAEND (_end)
# else
# define SIG_SUSPEND SIGUSR1
# define SIG_THR_RESTART SIGUSR2
# endif
# define FREEBSD_STACKBOTTOM
# ifdef __ELF__
# define DYNAMIC_LOADING
# endif
extern char etext[];
extern char * GC_FreeBSDGetDataStart();
# define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext)
# endif
# ifdef NETBSD
# define OS_TYPE "NETBSD"
# ifdef __ELF__
# define DYNAMIC_LOADING
# endif
# define HEURISTIC2
extern char etext[];
# define SEARCH_FOR_DATA_START
# endif
# ifdef SOLARIS
# define OS_TYPE "SOLARIS"
# define ELF_CLASS ELFCLASS64
extern int _etext[], _end[];
extern ptr_t GC_SysVGetDataStart(size_t, ptr_t);
# define DATASTART GC_SysVGetDataStart(0x1000, (ptr_t)_etext)
# define DATAEND (_end)
/* # define STACKBOTTOM ((ptr_t)(_start)) worked through 2.7, */
/* but reportedly breaks under 2.8. It appears that the stack */
/* base is a property of the executable, so this should not break */
/* old executables. */
/* HEURISTIC2 probably works, but this appears to be preferable. */
/* Apparently USRSTACK is defined to be USERLIMIT, but in some */
/* installations that's undefined. We work around this with a */
/* gross hack: */
# include <sys/vmparam.h>
# ifdef USERLIMIT
/* This should work everywhere, but doesn't. */
# define STACKBOTTOM USRSTACK
# else
# define HEURISTIC2
# endif
/* At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */
/* It appears to be fixed in 2.8 and 2.9. */
# ifdef SOLARIS25_PROC_VDB_BUG_FIXED
# define PROC_VDB
# endif
# define DYNAMIC_LOADING
# if !defined(USE_MMAP) && defined(REDIRECT_MALLOC)
# define USE_MMAP
/* Otherwise we now use calloc. Mmap may result in the */
/* heap interleaved with thread stacks, which can result in */
/* excessive blacklisting. Sbrk is unusable since it */
/* doesn't interact correctly with the system malloc. */
# endif
# ifdef USE_MMAP
# define HEAP_START (ptr_t)0x40000000
# else
# define HEAP_START DATAEND
# endif
# endif
# ifdef MSWIN32
# define OS_TYPE "MSWIN32"
/* STACKBOTTOM and DATASTART are handled specially in */
/* os_dep.c. */
# if !defined(__WATCOMC__)
# define MPROTECT_VDB
/* We also avoided doing this in the past with GC_WIN32_THREADS */
/* Hopefully that's fixed. */
# endif
# if _MSC_VER >= 1300 /* .NET, i.e. > VisualStudio 6 */
# define GWW_VDB
# endif
# define DATAEND /* not needed */
# endif
# endif
#if defined(LINUX) && defined(USE_MMAP)
/* The kernel may do a somewhat better job merging mappings etc. */
/* with anonymous mappings. */
# define USE_MMAP_ANON
#endif
#if defined(GC_LINUX_THREADS) && defined(REDIRECT_MALLOC)
/* Nptl allocates thread stacks with mmap, which is fine. But it */
/* keeps a cache of thread stacks. Thread stacks contain the */
/* thread control blocks. These in turn contain a pointer to */
/* (sizeof (void *) from the beginning of) the dtv for thread-local */
/* storage, which is calloc allocated. If we don't scan the cached */
/* thread stacks, we appear to lose the dtv. This tends to */
/* result in something that looks like a bogus dtv count, which */
/* tends to result in a memset call on a block that is way too */
/* large. Sometimes we're lucky and the process just dies ... */
/* There seems to be a similar issue with some other memory */
/* allocated by the dynamic loader. */
/* This can be avoided by either: */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -