version 1.7, 2002/10/03 08:13:31 |
version 1.13, 2004/02/13 05:48:36 |
|
|
* provided the above notices are retained, and a notice that the code was |
* provided the above notices are retained, and a notice that the code was |
* modified is included with the above copyright notice. |
* modified is included with the above copyright notice. |
*/ |
*/ |
|
|
|
/* |
|
* This header is private to the gc. It is almost always included from |
|
* gc_priv.h. However it is possible to include it by itself if just the |
|
* configuration macros are needed. In that |
|
* case, a few declarations relying on types declared in gc_priv.h will be |
|
* omitted. |
|
*/ |
|
|
#ifndef GCCONFIG_H |
#ifndef GCCONFIG_H |
|
|
# define GCCONFIG_H |
# define GCCONFIG_H |
|
|
|
/* added by noro */ |
|
#define LARGE_CONFIG |
|
|
|
# ifndef GC_PRIVATE_H |
|
/* Fake ptr_t declaration, just to avoid compilation errors. */ |
|
/* This avoids many instances if "ifndef GC_PRIVATE_H" below. */ |
|
typedef struct GC_undefined_struct * ptr_t; |
|
# endif |
|
|
/* Machine dependent parameters. Some tuning parameters can be found */ |
/* Machine dependent parameters. Some tuning parameters can be found */ |
/* near the top of gc_private.h. */ |
/* near the top of gc_private.h. */ |
|
|
|
|
|
|
/* First a unified test for Linux: */ |
/* First a unified test for Linux: */ |
# if defined(linux) || defined(__linux__) |
# if defined(linux) || defined(__linux__) |
|
# ifndef LINUX |
# define LINUX |
# define LINUX |
|
# endif |
# endif |
# endif |
|
|
/* And one for NetBSD: */ |
/* And one for NetBSD: */ |
|
|
# endif |
# endif |
|
|
/* Determine the machine type: */ |
/* Determine the machine type: */ |
|
/* T.Saito */ |
|
# if defined(FREEBSD) && defined(__amd64__) |
|
# define X86_64 |
|
# define mach_type_known |
|
# endif |
|
|
# if defined(__XSCALE__) |
# if defined(__XSCALE__) |
# define ARM32 |
# define ARM32 |
# if !defined(LINUX) |
# if !defined(LINUX) |
|
|
# define I386 |
# define I386 |
# define mach_type_known |
# define mach_type_known |
# endif |
# endif |
|
# if defined(LINUX) && defined(__x86_64__) |
|
# define X86_64 |
|
# define mach_type_known |
|
# endif |
# if defined(LINUX) && (defined(__ia64__) || defined(__ia64)) |
# if defined(LINUX) && (defined(__ia64__) || defined(__ia64)) |
# define IA64 |
# define IA64 |
# define mach_type_known |
# define mach_type_known |
|
|
# define ARM32 |
# define ARM32 |
# define mach_type_known |
# define mach_type_known |
# endif |
# endif |
# if defined(LINUX) && (defined(powerpc) || defined(__powerpc__)) |
# if defined(LINUX) && (defined(powerpc) || defined(__powerpc__) || defined(powerpc64) || defined(__powerpc64__)) |
# define POWERPC |
# define POWERPC |
# define mach_type_known |
# define mach_type_known |
# endif |
# endif |
|
|
# endif |
# endif |
# if defined(macosx) || \ |
# if defined(macosx) || \ |
defined(__APPLE__) && defined(__MACH__) && defined(__ppc__) |
defined(__APPLE__) && defined(__MACH__) && defined(__ppc__) |
# define MACOSX |
# define DARWIN |
# define POWERPC |
# define POWERPC |
# define mach_type_known |
# define mach_type_known |
# endif |
# endif |
# if defined(__APPLE__) && defined(__MACH__) && defined(__i386__) |
# if defined(__APPLE__) && defined(__MACH__) && defined(__i386__) |
# define MACOSX |
# define DARWIN |
# define I386 |
# define I386 |
--> Not really supported, but at least we recognize it. |
--> Not really supported, but at least we recognize it. |
# endif |
# endif |
|
|
# define mach_type_known |
# define mach_type_known |
# endif |
# endif |
# if defined(__s390__) && defined(LINUX) |
# if defined(__s390__) && defined(LINUX) |
# define S370 |
# define S390 |
# define mach_type_known |
# define mach_type_known |
# endif |
# endif |
# if defined(__GNU__) |
# if defined(__GNU__) |
|
|
/* (CX_UX and DGUX) */ |
/* (CX_UX and DGUX) */ |
/* S370 ==> 370-like machine */ |
/* S370 ==> 370-like machine */ |
/* running Amdahl UTS4 */ |
/* running Amdahl UTS4 */ |
/* or a 390 running LINUX */ |
/* S390 ==> 390-like machine */ |
|
/* running LINUX */ |
/* ARM32 ==> Intel StrongARM */ |
/* ARM32 ==> Intel StrongARM */ |
/* IA64 ==> Intel IPF */ |
/* IA64 ==> Intel IPF */ |
/* (e.g. Itanium) */ |
/* (e.g. Itanium) */ |
/* (LINUX and HPUX) */ |
/* (LINUX and HPUX) */ |
/* IA64_32 ==> IA64 w/32 bit ABI */ |
|
/* (HPUX) */ |
|
/* SH ==> Hitachi SuperH */ |
/* SH ==> Hitachi SuperH */ |
/* (LINUX & MSWINCE) */ |
/* (LINUX & MSWINCE) */ |
|
/* X86_64 ==> AMD x86-64 */ |
|
/* POWERPC ==> IBM/Apple PowerPC */ |
|
/* (MACOS(<=9),DARWIN(incl.MACOSX),*/ |
|
/* LINUX, NETBSD, NOSYS variants) */ |
|
|
|
|
/* |
/* |
|
|
# define DYNAMIC_LOADING |
# define DYNAMIC_LOADING |
# include <features.h> |
# include <features.h> |
# if defined(__GLIBC__)&& __GLIBC__>=2 |
# if defined(__GLIBC__)&& __GLIBC__>=2 |
# define LINUX_DATA_START |
# define SEARCH_FOR_DATA_START |
# else /* !GLIBC2 */ |
# else /* !GLIBC2 */ |
extern char **__environ; |
extern char **__environ; |
# define DATASTART ((ptr_t)(&__environ)) |
# define DATASTART ((ptr_t)(&__environ)) |
|
|
# define DATAEND /* not needed */ |
# define DATAEND /* not needed */ |
# endif |
# endif |
# ifdef LINUX |
# ifdef LINUX |
# define ALIGNMENT 4 /* Guess. Can someone verify? */ |
# if (defined (powerpc64) || defined(__powerpc64__)) |
|
# define ALIGNMENT 8 |
|
# define CPP_WORDSZ 64 |
|
# else |
|
# define ALIGNMENT 4 /* Guess. Can someone verify? */ |
/* This was 2, but that didn't sound right. */ |
/* This was 2, but that didn't sound right. */ |
|
# endif |
# define OS_TYPE "LINUX" |
# define OS_TYPE "LINUX" |
# define HEURISTIC1 |
/* HEURISTIC1 has been reliably reported to fail for a 32-bit */ |
|
/* executable on a 64 bit kernel. */ |
|
# define LINUX_STACKBOTTOM |
# define DYNAMIC_LOADING |
# define DYNAMIC_LOADING |
# undef STACK_GRAN |
# define SEARCH_FOR_DATA_START |
# define STACK_GRAN 0x10000000 |
|
/* Stack usually starts at 0x80000000 */ |
|
# define LINUX_DATA_START |
|
extern int _end[]; |
extern int _end[]; |
# define DATAEND (_end) |
# define DATAEND (_end) |
# endif |
# endif |
# ifdef MACOSX |
# ifdef DARWIN |
/* There are reasons to suspect this may not be reliable. */ |
|
# define ALIGNMENT 4 |
# define ALIGNMENT 4 |
# define OS_TYPE "MACOSX" |
# define OS_TYPE "DARWIN" |
|
# 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 DATASTART ((ptr_t) get_etext()) |
|
# define DATAEND ((ptr_t) get_end()) |
# define STACKBOTTOM ((ptr_t) 0xc0000000) |
# define STACKBOTTOM ((ptr_t) 0xc0000000) |
# define DATAEND /* not needed */ |
# define USE_MMAP |
|
# define USE_MMAP_ANON |
|
# define USE_ASM_PUSH_REGS |
|
/* This is potentially buggy. It needs more testing. See the comments in |
|
os_dep.c */ |
# define MPROTECT_VDB |
# define MPROTECT_VDB |
# include <unistd.h> |
# include <unistd.h> |
# define GETPAGESIZE() getpagesize() |
# define GETPAGESIZE() getpagesize() |
|
# if defined(USE_PPC_PREFETCH) && defined(__GNUC__) |
|
/* The performance impact of prefetches is untested */ |
|
# define PREFETCH(x) \ |
|
__asm__ __volatile__ ("dcbt 0,%0" : : "r" ((const void *) (x))) |
|
# define PREFETCH_FOR_WRITE(x) \ |
|
__asm__ __volatile__ ("dcbtst 0,%0" : : "r" ((const void *) (x))) |
|
# endif |
|
/* There seems to be some issues with trylock hanging on darwin. This |
|
should be looked into some more */ |
|
# define NO_PTHREAD_TRYLOCK |
# endif |
# endif |
# ifdef NETBSD |
# ifdef NETBSD |
# define ALIGNMENT 4 |
# define ALIGNMENT 4 |
|
|
# define OS_TYPE "SUNOS5" |
# define OS_TYPE "SUNOS5" |
extern int _etext[]; |
extern int _etext[]; |
extern int _end[]; |
extern int _end[]; |
extern char * GC_SysVGetDataStart(); |
extern ptr_t GC_SysVGetDataStart(); |
# define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, _etext) |
# define DATASTART GC_SysVGetDataStart(0x10000, _etext) |
# define DATAEND (_end) |
# define DATAEND (_end) |
# if !defined(USE_MMAP) && defined(REDIRECT_MALLOC) |
# if !defined(USE_MMAP) && defined(REDIRECT_MALLOC) |
# define USE_MMAP |
# define USE_MMAP |
|
|
# endif |
# endif |
# ifdef DRSNX |
# ifdef DRSNX |
# define OS_TYPE "DRSNX" |
# define OS_TYPE "DRSNX" |
extern char * GC_SysVGetDataStart(); |
extern ptr_t GC_SysVGetDataStart(); |
extern int etext[]; |
extern int etext[]; |
# define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, etext) |
# define DATASTART GC_SysVGetDataStart(0x10000, etext) |
# define MPROTECT_VDB |
# define MPROTECT_VDB |
# define STACKBOTTOM ((ptr_t) 0xdfff0000) |
# define STACKBOTTOM ((ptr_t) 0xdfff0000) |
# define DYNAMIC_LOADING |
# define DYNAMIC_LOADING |
|
|
extern int _etext[]; |
extern int _etext[]; |
# define DATAEND (_end) |
# define DATAEND (_end) |
# define SVR4 |
# define SVR4 |
|
extern ptr_t GC_SysVGetDataStart(); |
# ifdef __arch64__ |
# ifdef __arch64__ |
# define DATASTART (ptr_t)GC_SysVGetDataStart(0x100000, _etext) |
# define DATASTART GC_SysVGetDataStart(0x100000, _etext) |
/* libc_stack_end is not set reliably for sparc64 */ |
/* libc_stack_end is not set reliably for sparc64 */ |
# define STACKBOTTOM ((ptr_t) 0x80000000000ULL) |
# define STACKBOTTOM ((ptr_t) 0x80000000000ULL) |
# else |
# else |
# define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, _etext) |
# define DATASTART GC_SysVGetDataStart(0x10000, _etext) |
# define LINUX_STACKBOTTOM |
# define LINUX_STACKBOTTOM |
# endif |
# endif |
# endif |
# endif |
|
|
# ifdef SUNOS5 |
# ifdef SUNOS5 |
# define OS_TYPE "SUNOS5" |
# define OS_TYPE "SUNOS5" |
extern int _etext[], _end[]; |
extern int _etext[], _end[]; |
extern char * GC_SysVGetDataStart(); |
extern ptr_t GC_SysVGetDataStart(); |
# define DATASTART GC_SysVGetDataStart(0x1000, _etext) |
# define DATASTART GC_SysVGetDataStart(0x1000, _etext) |
# define DATAEND (_end) |
# define DATAEND (_end) |
/* # define STACKBOTTOM ((ptr_t)(_start)) worked through 2.7, */ |
/* # define STACKBOTTOM ((ptr_t)(_start)) worked through 2.7, */ |
|
|
# define PROC_VDB |
# define PROC_VDB |
# endif |
# endif |
# define DYNAMIC_LOADING |
# define DYNAMIC_LOADING |
|
/* added by noro */ |
|
# define USE_MMAP |
# if !defined(USE_MMAP) && defined(REDIRECT_MALLOC) |
# if !defined(USE_MMAP) && defined(REDIRECT_MALLOC) |
# define USE_MMAP |
# define USE_MMAP |
/* Otherwise we now use calloc. Mmap may result in the */ |
/* Otherwise we now use calloc. Mmap may result in the */ |
|
|
# ifdef DGUX |
# ifdef DGUX |
# define OS_TYPE "DGUX" |
# define OS_TYPE "DGUX" |
extern int _etext, _end; |
extern int _etext, _end; |
extern char * GC_SysVGetDataStart(); |
extern ptr_t GC_SysVGetDataStart(); |
# define DATASTART GC_SysVGetDataStart(0x1000, &_etext) |
# define DATASTART GC_SysVGetDataStart(0x1000, &_etext) |
# define DATAEND (&_end) |
# define DATAEND (&_end) |
# define STACK_GROWS_DOWN |
# define STACK_GROWS_DOWN |
|
|
# endif |
# endif |
# define OS_TYPE "LINUX" |
# define OS_TYPE "LINUX" |
# define LINUX_STACKBOTTOM |
# define LINUX_STACKBOTTOM |
# define USE_MMAP |
/* # define USE_MMAP */ |
# if 0 |
# if 0 |
# define HEURISTIC1 |
# define HEURISTIC1 |
# undef STACK_GRAN |
# undef STACK_GRAN |
|
|
# endif |
# endif |
# include <features.h> |
# include <features.h> |
# if defined(__GLIBC__) && __GLIBC__ >= 2 |
# if defined(__GLIBC__) && __GLIBC__ >= 2 |
# define LINUX_DATA_START |
# define SEARCH_FOR_DATA_START |
# else |
# else |
extern char **__environ; |
extern char **__environ; |
# define DATASTART ((ptr_t)(&__environ)) |
# define DATASTART ((ptr_t)(&__environ)) |
|
|
/* DATAEND = _data_end__ */ |
/* DATAEND = _data_end__ */ |
/* To get it right for both, we take the */ |
/* To get it right for both, we take the */ |
/* minumum/maximum of the two. */ |
/* minumum/maximum of the two. */ |
|
# ifndef MAX |
# define MAX(x,y) ((x) > (y) ? (x) : (y)) |
# define MAX(x,y) ((x) > (y) ? (x) : (y)) |
|
# endif |
|
# ifndef MIN |
# define MIN(x,y) ((x) < (y) ? (x) : (y)) |
# define MIN(x,y) ((x) < (y) ? (x) : (y)) |
|
# endif |
# define DATASTART ((ptr_t) MIN(_data_start__, _bss_start__)) |
# define DATASTART ((ptr_t) MIN(_data_start__, _bss_start__)) |
# define DATAEND ((ptr_t) MAX(_data_end__, _bss_end__)) |
# define DATAEND ((ptr_t) MAX(_data_end__, _bss_end__)) |
# undef STACK_GRAN |
# undef STACK_GRAN |
|
|
# define DYNAMIC_LOADING |
# define DYNAMIC_LOADING |
# endif |
# endif |
extern char etext[]; |
extern char etext[]; |
# define DATASTART ((ptr_t)(etext)) |
extern char * GC_FreeBSDGetDataStart(); |
|
# define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext) |
# endif |
# endif |
# ifdef NETBSD |
# ifdef NETBSD |
# define OS_TYPE "NETBSD" |
# define OS_TYPE "NETBSD" |
|
|
# define DATASTART ((ptr_t)(__data_start)) |
# define DATASTART ((ptr_t)(__data_start)) |
# define ALIGNMENT 4 |
# define ALIGNMENT 4 |
# define USE_GENERIC_PUSH_REGS |
# define USE_GENERIC_PUSH_REGS |
# define LINUX_STACKBOTTOM |
# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 2 || __GLIBC__ > 2 |
|
# define LINUX_STACKBOTTOM |
|
# else |
|
# define STACKBOTTOM 0x80000000 |
|
# endif |
# endif /* Linux */ |
# endif /* Linux */ |
# ifdef EWS4800 |
# ifdef EWS4800 |
# define HEURISTIC2 |
# define HEURISTIC2 |
|
|
/* heap sections so they're not */ |
/* heap sections so they're not */ |
/* considered as roots. */ |
/* considered as roots. */ |
# define OS_TYPE "IRIX5" |
# define OS_TYPE "IRIX5" |
# define MPROTECT_VDB |
/*# define MPROTECT_VDB DOB: this should work, but there is evidence */ |
|
/* of recent breakage. */ |
# ifdef _MIPS_SZPTR |
# ifdef _MIPS_SZPTR |
# define CPP_WORDSZ _MIPS_SZPTR |
# define CPP_WORDSZ _MIPS_SZPTR |
# define ALIGNMENT (_MIPS_SZPTR/8) |
# define ALIGNMENT (_MIPS_SZPTR/8) |
|
|
|
|
# ifdef RS6000 |
# ifdef RS6000 |
# define MACH_TYPE "RS6000" |
# define MACH_TYPE "RS6000" |
|
# ifdef ALIGNMENT |
|
# undef ALIGNMENT |
|
# endif |
|
# ifdef IA64 |
|
# undef IA64 /* DOB: some AIX installs stupidly define IA64 in /usr/include/sys/systemcfg.h */ |
|
# endif |
# ifdef __64BIT__ |
# ifdef __64BIT__ |
# define ALIGNMENT 8 |
# define ALIGNMENT 8 |
# define CPP_WORDSZ 64 |
# define CPP_WORDSZ 64 |
# define STACKBOTTOM 0x1000000000000000 |
# define STACKBOTTOM ((ptr_t)0x1000000000000000) |
# else |
# else |
# define ALIGNMENT 4 |
# define ALIGNMENT 4 |
# define CPP_WORDSZ 32 |
# define CPP_WORDSZ 32 |
# define STACKBOTTOM ((ptr_t)((ulong)&errno)) |
# define STACKBOTTOM ((ptr_t)((ulong)&errno)) |
# endif |
# endif |
|
/* From AIX linker man page: |
|
_text Specifies the first location of the program. |
|
_etext Specifies the first location after the program. |
|
_data Specifies the first location of the data. |
|
_edata Specifies the first location after the initialized data |
|
_end or end Specifies the first location after all data. |
|
*/ |
extern int _data[], _end[]; |
extern int _data[], _end[]; |
# define DATASTART ((ptr_t)((ulong)_data)) |
# define DATASTART ((ptr_t)((ulong)_data)) |
# define DATAEND ((ptr_t)((ulong)_end)) |
# define DATAEND ((ptr_t)((ulong)_end)) |
|
|
# ifdef ALPHA |
# ifdef ALPHA |
# define MACH_TYPE "ALPHA" |
# define MACH_TYPE "ALPHA" |
# define ALIGNMENT 8 |
# define ALIGNMENT 8 |
|
# define CPP_WORDSZ 64 |
# ifndef LINUX |
# ifndef LINUX |
# define USE_GENERIC_PUSH_REGS |
# define USE_GENERIC_PUSH_REGS |
/* Gcc and probably the DEC/Compaq compiler spill pointers to preserved */ |
/* Gcc and probably the DEC/Compaq compiler spill pointers to preserved */ |
|
|
# define ELFCLASS32 32 |
# define ELFCLASS32 32 |
# define ELFCLASS64 64 |
# define ELFCLASS64 64 |
# define ELF_CLASS ELFCLASS64 |
# define ELF_CLASS ELFCLASS64 |
# define CPP_WORDSZ 64 |
|
# define DYNAMIC_LOADING |
# define DYNAMIC_LOADING |
# endif |
# endif |
# ifdef OPENBSD |
# ifdef OPENBSD |
# define OS_TYPE "OPENBSD" |
# define OS_TYPE "OPENBSD" |
# define HEURISTIC2 |
# define HEURISTIC2 |
# define CPP_WORDSZ 64 |
|
# ifdef __ELF__ /* since OpenBSD/Alpha 2.9 */ |
# ifdef __ELF__ /* since OpenBSD/Alpha 2.9 */ |
# define DATASTART GC_data_start |
# define DATASTART GC_data_start |
# define ELFCLASS32 32 |
# define ELFCLASS32 32 |
|
|
# define DATAEND (GC_find_limit (DATASTART, TRUE)) |
# define DATAEND (GC_find_limit (DATASTART, TRUE)) |
# define DATASTART2 ((ptr_t)(&edata)) |
# define DATASTART2 ((ptr_t)(&edata)) |
# define DATAEND2 ((ptr_t)(&end)) |
# define DATAEND2 ((ptr_t)(&end)) |
# define CPP_WORDSZ 64 |
|
# endif |
# endif |
# ifdef OSF1 |
# ifdef OSF1 |
# define OS_TYPE "OSF1" |
# define OS_TYPE "OSF1" |
|
|
/* This is currently unused, since we disabled HEURISTIC2 */ |
/* This is currently unused, since we disabled HEURISTIC2 */ |
extern int __start[]; |
extern int __start[]; |
# define HEURISTIC2_LIMIT ((ptr_t)((word)(__start) & ~(getpagesize()-1))) |
# define HEURISTIC2_LIMIT ((ptr_t)((word)(__start) & ~(getpagesize()-1))) |
# define CPP_WORDSZ 64 |
# ifndef GC_OSF1_THREADS |
# define MPROTECT_VDB |
/* Unresolved signal issues with threads. */ |
|
# define MPROTECT_VDB |
|
# endif |
# define DYNAMIC_LOADING |
# define DYNAMIC_LOADING |
# endif |
# endif |
# ifdef LINUX |
# ifdef LINUX |
# define OS_TYPE "LINUX" |
# define OS_TYPE "LINUX" |
# define CPP_WORDSZ 64 |
|
# define STACKBOTTOM ((ptr_t) 0x120000000) |
# define STACKBOTTOM ((ptr_t) 0x120000000) |
# ifdef __ELF__ |
# ifdef __ELF__ |
# define SEARCH_FOR_DATA_START |
# define SEARCH_FOR_DATA_START |
|
|
# endif |
# endif |
# ifdef DGUX |
# ifdef DGUX |
# define OS_TYPE "DGUX" |
# define OS_TYPE "DGUX" |
extern char * GC_SysVGetDataStart(); |
extern ptr_t GC_SysVGetDataStart(); |
# define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, etext) |
# define DATASTART GC_SysVGetDataStart(0x10000, etext) |
# endif |
# endif |
# define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */ |
# define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */ |
# endif |
# endif |
|
|
# ifdef S370 |
# ifdef S370 |
|
/* If this still works, and if anyone cares, this should probably */ |
|
/* be moved to the S390 category. */ |
# define MACH_TYPE "S370" |
# define MACH_TYPE "S370" |
# define ALIGNMENT 4 /* Required by hardware */ |
# define ALIGNMENT 4 /* Required by hardware */ |
# define USE_GENERIC_PUSH_REGS |
# define USE_GENERIC_PUSH_REGS |
|
|
extern int etext[]; |
extern int etext[]; |
extern int _etext[]; |
extern int _etext[]; |
extern int _end[]; |
extern int _end[]; |
extern char * GC_SysVGetDataStart(); |
extern ptr_t GC_SysVGetDataStart(); |
# define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, _etext) |
# define DATASTART GC_SysVGetDataStart(0x10000, _etext) |
# define DATAEND (_end) |
# define DATAEND (_end) |
# define HEURISTIC2 |
# define HEURISTIC2 |
# endif |
# endif |
|
# endif |
|
|
|
# ifdef S390 |
|
# define MACH_TYPE "S390" |
|
# define USE_GENERIC_PUSH_REGS |
|
# ifndef __s390x__ |
|
# define ALIGNMENT 4 |
|
# define CPP_WORDSZ 32 |
|
# else |
|
# define ALIGNMENT 8 |
|
# define CPP_WORDSZ 64 |
|
# define HBLKSIZE 4096 |
|
# endif |
# ifdef LINUX |
# ifdef LINUX |
# define OS_TYPE "LINUX" |
# define OS_TYPE "LINUX" |
# define HEURISTIC1 |
# define LINUX_STACKBOTTOM |
# define DYNAMIC_LOADING |
# define DYNAMIC_LOADING |
extern int __data_start[]; |
extern int __data_start[]; |
# define DATASTART ((ptr_t)(__data_start)) |
# define DATASTART ((ptr_t)(__data_start)) |
|
extern int _end[]; |
|
# define DATAEND (_end) |
|
# define CACHE_LINE_SIZE 256 |
|
# define GETPAGESIZE() 4096 |
# endif |
# endif |
# endif |
# endif |
|
|
|
|
# define DYNAMIC_LOADING |
# define DYNAMIC_LOADING |
# include <features.h> |
# include <features.h> |
# if defined(__GLIBC__) && __GLIBC__ >= 2 |
# if defined(__GLIBC__) && __GLIBC__ >= 2 |
# define LINUX_DATA_START |
# define SEARCH_FOR_DATA_START |
# else |
# else |
extern char **__environ; |
extern char **__environ; |
# define DATASTART ((ptr_t)(&__environ)) |
# define DATASTART ((ptr_t)(&__environ)) |
|
|
# define STACKBOTTOM ((ptr_t) 0x7c000000) |
# define STACKBOTTOM ((ptr_t) 0x7c000000) |
# define USE_GENERIC_PUSH_REGS |
# define USE_GENERIC_PUSH_REGS |
# define DYNAMIC_LOADING |
# define DYNAMIC_LOADING |
# define LINUX_DATA_START |
# define SEARCH_FOR_DATA_START |
extern int _end[]; |
extern int _end[]; |
# define DATAEND (_end) |
# define DATAEND (_end) |
# endif |
# endif |
|
|
# define DATAEND /* not needed */ |
# define DATAEND /* not needed */ |
# endif |
# endif |
|
|
#ifdef LINUX_DATA_START |
# ifdef X86_64 |
/* Some Linux distributions arrange to define __data_start. Some */ |
# define MACH_TYPE "X86_64" |
/* define data_start as a weak symbol. The latter is technically */ |
# define ALIGNMENT 8 |
/* broken, since the user program may define data_start, in which */ |
# define CPP_WORDSZ 64 |
/* case we lose. Nonetheless, we try both, prefering __data_start. */ |
# ifndef HBLKSIZE |
/* We assume gcc. */ |
# define HBLKSIZE 4096 |
# pragma weak __data_start |
# endif |
extern int __data_start[]; |
# define CACHE_LINE_SIZE 64 |
# pragma weak data_start |
# define USE_GENERIC_PUSH_REGS |
extern int data_start[]; |
# ifdef LINUX |
# define DATASTART ((ptr_t)(__data_start != 0? __data_start : data_start)) |
# define OS_TYPE "LINUX" |
#endif |
# 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 |
|
# define PREFETCH(x) \ |
|
__asm__ __volatile__ (" prefetch %0": : "m"(*(char *)(x))) |
|
# define PREFETCH_FOR_WRITE(x) \ |
|
__asm__ __volatile__ (" prefetchw %0": : "m"(*(char *)(x))) |
|
# endif |
|
# ifdef FREEBSD /* T.Saito */ |
|
# 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 |
|
extern int _etext[]; |
|
extern char etext[]; |
|
extern char edata[]; |
|
extern char end[]; |
|
extern char * GC_FreeBSDGetDataStart(); |
|
# define DATASTART ((ptr_t)((((word) (_etext)) + 0xfff) & ~0xfff)) |
|
# define NEED_FIND_LIMIT |
|
# define DATAEND (GC_find_limit (DATASTART, TRUE)) |
|
# define DATASTART2 ((ptr_t)(&edata)) |
|
# define DATAEND2 ((ptr_t)(&end)) |
|
# endif /* end T.Saito */ |
|
# endif |
|
|
#if defined(LINUX) && defined(REDIRECT_MALLOC) |
#if defined(LINUX) && defined(REDIRECT_MALLOC) |
/* Rld appears to allocate some memory with its own allocator, and */ |
/* Rld appears to allocate some memory with its own allocator, and */ |
|
|
# endif |
# endif |
|
|
# if defined(SVR4) || defined(LINUX) || defined(IRIX) || defined(HPUX) \ |
# if defined(SVR4) || defined(LINUX) || defined(IRIX) || defined(HPUX) \ |
|| defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) || defined(DGUX) \ |
|| defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \ |
|| defined(BSD) || defined(AIX) || defined(MACOSX) || defined(OSF1) |
|| defined(DGUX) || defined(BSD) \ |
|
|| defined(_AIX) || defined(DARWIN) || defined(OSF1) |
# define UNIX_LIKE /* Basic Unix-like system calls work. */ |
# define UNIX_LIKE /* Basic Unix-like system calls work. */ |
# endif |
# endif |
|
|
|
|
# define CACHE_LINE_SIZE 32 /* Wild guess */ |
# define CACHE_LINE_SIZE 32 /* Wild guess */ |
# endif |
# endif |
|
|
|
# ifdef LINUX |
|
# define REGISTER_LIBRARIES_EARLY |
|
/* We sometimes use dl_iterate_phdr, which may acquire an internal */ |
|
/* lock. This isn't safe after the world has stopped. So we must */ |
|
/* call GC_register_dynamic_libraries before stopping the world. */ |
|
/* For performance reasons, this may be beneficial on other */ |
|
/* platforms as well, though it should be avoided in win32. */ |
|
# endif /* LINUX */ |
|
|
# if defined(SEARCH_FOR_DATA_START) |
# if defined(SEARCH_FOR_DATA_START) |
extern ptr_t GC_data_start; |
extern ptr_t GC_data_start; |
# define DATASTART GC_data_start |
# define DATASTART GC_data_start |
|
|
# if defined(GC_HPUX_THREADS) && !defined(HPUX) |
# if defined(GC_HPUX_THREADS) && !defined(HPUX) |
--> inconsistent configuration |
--> inconsistent configuration |
# endif |
# endif |
# if defined(GC_WIN32_THREADS) && !defined(MSWIN32) |
# if defined(GC_AIX_THREADS) && !defined(_AIX) |
/* Ideally CYGWIN32 should work, in addition to MSWIN32. I suspect */ |
|
/* the necessary code is mostly there, but nobody has actually made */ |
|
/* sure the right combination of pieces is compiled in, etc. */ |
|
--> inconsistent configuration |
--> inconsistent configuration |
# endif |
# endif |
|
# if defined(GC_WIN32_THREADS) && !defined(MSWIN32) && !defined(CYGWIN32) |
|
--> inconsistent configuration |
|
# endif |
|
|
# if defined(PCR) || defined(SRC_M3) || \ |
# if defined(PCR) || defined(SRC_M3) || \ |
defined(GC_SOLARIS_THREADS) || defined(GC_WIN32_THREADS) || \ |
defined(GC_SOLARIS_THREADS) || defined(GC_WIN32_THREADS) || \ |
|
|
# define THREADS |
# define THREADS |
# endif |
# endif |
|
|
# if defined(HP_PA) || defined(M88K) || defined(POWERPC) && !defined(MACOSX) \ |
# if defined(HP_PA) || defined(M88K) || defined(POWERPC) && !defined(DARWIN) \ |
|| defined(LINT) || defined(MSWINCE) || defined(ARM32) \ |
|| defined(LINT) || defined(MSWINCE) || defined(ARM32) \ |
|| (defined(I386) && defined(__LCC__)) |
|| (defined(I386) && defined(__LCC__)) |
/* Use setjmp based hack to mark from callee-save registers. */ |
/* Use setjmp based hack to mark from callee-save registers. */ |
/* The define should move to the individual platform */ |
/* The define should move to the individual platform */ |
/* descriptions. */ |
/* descriptions. */ |
# define USE_GENERIC_PUSH_REGS |
# define USE_GENERIC_PUSH_REGS |
# endif |
# endif |
|
|
# if defined(SPARC) |
# if defined(SPARC) |
# define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */ |
# define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */ |
/* include assembly code to do it well. */ |
/* include assembly code to do it well. */ |
# endif |
# endif |
|
|
/* Can we save call chain in objects for debugging? */ |
/* Can we save call chain in objects for debugging? */ |
/* SET NFRAMES (# of saved frames) and NARGS (#of args for each frame) */ |
/* SET NFRAMES (# of saved frames) and NARGS (#of args for each */ |
/* to reasonable values for the platform. */ |
/* frame) to reasonable values for the platform. */ |
/* Set SAVE_CALL_CHAIN if we can. SAVE_CALL_COUNT can be specified at */ |
/* Set SAVE_CALL_CHAIN if we can. SAVE_CALL_COUNT can be specified */ |
/* build time, though we feel free to adjust it slightly. */ |
/* at build time, though we feel free to adjust it slightly. */ |
/* Define NEED_CALLINFO if we either save the call stack or */ |
/* Define NEED_CALLINFO if we either save the call stack or */ |
/* GC_ADD_CALLER is defined. */ |
/* GC_ADD_CALLER is defined. */ |
#ifdef LINUX |
/* GC_CAN_SAVE_CALL_STACKS is set in gc.h. */ |
# include <features.h> |
|
# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2 |
|
# define HAVE_BUILTIN_BACKTRACE |
|
# endif |
|
#endif |
|
|
|
#if defined(SPARC) |
#if defined(SPARC) |
# define CAN_SAVE_CALL_STACKS |
|
# define CAN_SAVE_CALL_ARGS |
# define CAN_SAVE_CALL_ARGS |
#endif |
#endif |
#if defined(I386) && defined(LINUX) |
#if (defined(I386) || defined(X86_64)) && defined(LINUX) |
/* SAVE_CALL_CHAIN is supported if the code is compiled to save */ |
/* SAVE_CALL_CHAIN is supported if the code is compiled to save */ |
/* frame pointers by default, i.e. no -fomit-frame-pointer flag. */ |
/* frame pointers by default, i.e. no -fomit-frame-pointer flag. */ |
# define CAN_SAVE_CALL_STACKS |
|
# define CAN_SAVE_CALL_ARGS |
# define CAN_SAVE_CALL_ARGS |
#endif |
#endif |
#if defined(HAVE_BUILTIN_BACKTRACE) && !defined(CAN_SAVE_CALL_STACKS) |
|
# define CAN_SAVE_CALL_STACKS |
|
#endif |
|
|
|
# if defined(SAVE_CALL_COUNT) && !defined(GC_ADD_CALLER) \ |
# if defined(SAVE_CALL_COUNT) && !defined(GC_ADD_CALLER) \ |
&& defined(CAN_SAVE_CALL_STACKS) |
&& defined(GC_CAN_SAVE_CALL_STACKS) |
# define SAVE_CALL_CHAIN |
# define SAVE_CALL_CHAIN |
# endif |
# endif |
# ifdef SAVE_CALL_CHAIN |
# ifdef SAVE_CALL_CHAIN |
|
|
# define DBG_HDRS_ALL |
# define DBG_HDRS_ALL |
# endif |
# endif |
|
|
|
# if defined(POINTER_MASK) && !defined(POINTER_SHIFT) |
|
# define POINTER_SHIFT 0 |
|
# endif |
|
|
|
# if defined(POINTER_SHIFT) && !defined(POINTER_MASK) |
|
# define POINTER_MASK ((GC_word)(-1)) |
|
# endif |
|
|
|
# if !defined(FIXUP_POINTER) && defined(POINTER_MASK) |
|
# define FIXUP_POINTER(p) (p) = ((p) & (POINTER_MASK) << POINTER_SHIFT) |
|
# endif |
|
|
|
# if defined(FIXUP_POINTER) |
|
# define NEED_FIXUP_POINTER 1 |
|
# else |
|
# define NEED_FIXUP_POINTER 0 |
|
# define FIXUP_POINTER(p) |
|
# endif |
|
|
#ifdef GC_PRIVATE_H |
#ifdef GC_PRIVATE_H |
/* This relies on some type definitions from gc_priv.h, from */ |
/* This relies on some type definitions from gc_priv.h, from */ |
/* where it's normally included. */ |
/* where it's normally included. */ |
|
|
+ GC_page_size) \ |
+ GC_page_size) \ |
+ GC_page_size-1) |
+ GC_page_size-1) |
# else |
# else |
# if defined(NEXT) || defined(MACOSX) || defined(DOS4GW) || \ |
# if defined(NEXT) || defined(DOS4GW) || \ |
(defined(AMIGA) && !defined(GC_AMIGA_FASTALLOC)) || \ |
(defined(AMIGA) && !defined(GC_AMIGA_FASTALLOC)) || \ |
(defined(SUNOS5) && !defined(USE_MMAP)) |
(defined(SUNOS5) && !defined(USE_MMAP)) |
# define GET_MEM(bytes) HBLKPTR((size_t) \ |
# define GET_MEM(bytes) HBLKPTR((size_t) \ |
|
|
+ GC_page_size-1) |
+ GC_page_size-1) |
# else |
# else |
# ifdef MSWIN32 |
# ifdef MSWIN32 |
extern ptr_t GC_win32_get_mem(); |
extern ptr_t GC_win32_get_mem(); |
# define GET_MEM(bytes) (struct hblk *)GC_win32_get_mem(bytes) |
# define GET_MEM(bytes) (struct hblk *)GC_win32_get_mem(bytes) |
# else |
# else |
# ifdef MACOS |
# ifdef MACOS |
|
|
# endif |
# endif |
# else |
# else |
# ifdef MSWINCE |
# ifdef MSWINCE |
extern ptr_t GC_wince_get_mem(); |
extern ptr_t GC_wince_get_mem(); |
# define GET_MEM(bytes) (struct hblk *)GC_wince_get_mem(bytes) |
# define GET_MEM(bytes) (struct hblk *)GC_wince_get_mem(bytes) |
# else |
# else |
# if defined(AMIGA) && defined(GC_AMIGA_FASTALLOC) |
# if defined(AMIGA) && defined(GC_AMIGA_FASTALLOC) |
|
|
GC_amiga_get_mem((size_t)bytes + GC_page_size) \ |
GC_amiga_get_mem((size_t)bytes + GC_page_size) \ |
+ GC_page_size-1) |
+ GC_page_size-1) |
# else |
# else |
extern ptr_t GC_unix_get_mem(); |
extern ptr_t GC_unix_get_mem(); |
# define GET_MEM(bytes) (struct hblk *)GC_unix_get_mem(bytes) |
# define GET_MEM(bytes) (struct hblk *)GC_unix_get_mem(bytes) |
# endif |
# endif |
# endif |
# endif |