diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2001-12-20 00:37:29 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2001-12-20 00:37:29 +0000 |
commit | 548b9dd8dbfa0dbe5247d9b4af7e388855beb506 (patch) | |
tree | 81b92ab0e12a687937e7948736fcb280dbc8d6c6 /gc/include | |
parent | [w3m-dev 02655] print version and compile options (diff) | |
download | w3m-548b9dd8dbfa0dbe5247d9b4af7e388855beb506.tar.gz w3m-548b9dd8dbfa0dbe5247d9b4af7e388855beb506.zip |
sync with w3m-0.2.2-inu-1.1/gc
Diffstat (limited to '')
-rw-r--r-- | gc/include/gc.h | 28 | ||||
-rw-r--r-- | gc/include/gc_gcj.h | 2 | ||||
-rw-r--r-- | gc/include/gc_pthread_redirects.h | 4 | ||||
-rw-r--r-- | gc/include/leak_detector.h | 4 | ||||
-rw-r--r-- | gc/include/new_gc_alloc.h | 15 | ||||
-rw-r--r-- | gc/include/private/dbg_mlc.h | 53 | ||||
-rw-r--r-- | gc/include/private/gc_locks.h | 14 | ||||
-rw-r--r-- | gc/include/private/gc_pmark.h | 3 | ||||
-rw-r--r-- | gc/include/private/gc_priv.h | 31 | ||||
-rw-r--r-- | gc/include/private/gcconfig.h | 231 | ||||
-rw-r--r-- | gc/include/private/solaris_threads.h | 4 |
11 files changed, 254 insertions, 135 deletions
diff --git a/gc/include/gc.h b/gc/include/gc.h index aaf29ee..8ac709b 100644 --- a/gc/include/gc.h +++ b/gc/include/gc.h @@ -30,13 +30,9 @@ # define _GC_H -#if defined(_SOLARIS_PTHREADS) && !defined(SOLARIS_THREADS) -# define SOLARIS_THREADS -#endif - /* * Some tests for old macros. These violate our namespace rules and will - * disappear shortly. + * disappear shortly. Use the GC_ names. */ #if defined(SOLARIS_THREADS) || defined(_SOLARIS_THREADS) # define GC_SOLARIS_THREADS @@ -72,6 +68,16 @@ /* depend on this were previously included. */ #endif +#if defined(GC_SOLARIS_PTHREADS) && !defined(GC_SOLARIS_THREADS) +# define GC_SOLARIS_THREADS +#endif + +# if defined(GC_SOLARIS_PTHREADS) || defined(GC_FREEBSD_THREADS) || \ + defined(GC_IRIX_THREADS) || defined(GC_LINUX_THREADS) || \ + defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS) +# define GC_PTHREADS +# endif + # define __GC # include <stddef.h> # ifdef _WIN32_WCE @@ -80,7 +86,7 @@ typedef long ptrdiff_t; /* ptrdiff_t is not defined */ # endif -#if defined(__MINGW32__) && defined(WIN32_THREADS) +#if defined(__MINGW32__) && defined(GC_WIN32_THREADS) # ifdef GC_BUILD # define GC_API __declspec(dllexport) # else @@ -815,16 +821,12 @@ GC_API void (*GC_is_visible_print_proc) /* thread library calls. We do that here by macro defining them. */ #if !defined(GC_USE_LD_WRAP) && \ - (defined(GC_LINUX_THREADS) || defined(GC_HPUX_THREADS) || \ - defined(GC_IRIX_THREADS) || defined(GC_SOLARIS_PTHREADS) || \ - defined(GC_SOLARIS_THREADS) || defined(GC_OSF1_THREADS)) + (defined(GC_PTHREADS) || defined(GC_SOLARIS_THREADS)) # include "gc_pthread_redirects.h" #endif # if defined(PCR) || defined(GC_SOLARIS_THREADS) || \ - defined(GC_SOLARIS_PTHREADS) || defined(GC_WIN32_THREADS) || \ - defined(GC_IRIX_THREADS) || defined(GC_LINUX_THREADS) || \ - defined(GC_HPUX_THREADS) + defined(GC_PTHREADS) || defined(GC_WIN32_THREADS) /* Any flavor of threads except SRC_M3. */ /* This returns a list of objects, linked through their first */ /* word. Its use can greatly reduce lock contention problems, since */ @@ -839,7 +841,7 @@ extern void GC_thr_init(); /* Needed for Solaris/X86 */ #endif /* THREADS && !SRC_M3 */ -#if defined(WIN32_THREADS) && defined(_WIN32_WCE) +#if defined(GC_WIN32_THREADS) && defined(_WIN32_WCE) # include <windows.h> /* diff --git a/gc/include/gc_gcj.h b/gc/include/gc_gcj.h index 9123a28..5e932af 100644 --- a/gc/include/gc_gcj.h +++ b/gc/include/gc_gcj.h @@ -47,8 +47,6 @@ /* The following allocators signal an out of memory condition with */ /* return GC_oom_fn(bytes); */ -extern void * (*GC_oom_action)(void); - /* The following function must be called before the gcj allocators */ /* can be invoked. */ /* mp_index and mp are the index and mark_proc (see gc_mark.h) */ diff --git a/gc/include/gc_pthread_redirects.h b/gc/include/gc_pthread_redirects.h index ac254a8..47284fb 100644 --- a/gc/include/gc_pthread_redirects.h +++ b/gc/include/gc_pthread_redirects.h @@ -44,9 +44,7 @@ #endif /* SOLARIS_THREADS || SOLARIS_PTHREADS */ -#if !defined(GC_USE_LD_WRAP) && \ - (defined(GC_IRIX_THREADS) || defined(GC_LINUX_THREADS) \ - || defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS)) +#if !defined(GC_USE_LD_WRAP) && defined(GC_PTHREADS) && !defined(GC_SOLARIS_PTHREADS) /* We treat these similarly. */ # include <pthread.h> # include <signal.h> diff --git a/gc/include/leak_detector.h b/gc/include/leak_detector.h index 6786825..0674ab4 100644 --- a/gc/include/leak_detector.h +++ b/gc/include/leak_detector.h @@ -1,7 +1,7 @@ #define GC_DEBUG #include "gc.h" #define malloc(n) GC_MALLOC(n) -#define calloc(m,n) GC_MALLOC(m*n) +#define calloc(m,n) GC_MALLOC((m)*(n)) #define free(p) GC_FREE(p) -#define realloc(p,n) GC_REALLOC(n) +#define realloc(p,n) GC_REALLOC((p),(n)) #define CHECK_LEAKS() GC_gcollect() diff --git a/gc/include/new_gc_alloc.h b/gc/include/new_gc_alloc.h index 1187f0b..aad9446 100644 --- a/gc/include/new_gc_alloc.h +++ b/gc/include/new_gc_alloc.h @@ -50,7 +50,20 @@ #ifndef GC_ALLOC_H #include "gc.h" -#include <stack> // A more portable way to get stl_alloc.h . + +#if (__GNUC__ < 3) +# include <stack> // A more portable way to get stl_alloc.h . +#else +# include <bits/stl_alloc.h> +# ifndef __STL_BEGIN_NAMESPACE +# define __STL_BEGIN_NAMESPACE namespace std { +# define __STL_END_NAMESPACE }; +# endif +#ifndef __STL_USE_STD_ALLOCATORS +#define __STL_USE_STD_ALLOCATORS +#endif +#endif + #define GC_ALLOC_H diff --git a/gc/include/private/dbg_mlc.h b/gc/include/private/dbg_mlc.h index 6f5b3c8..5378835 100644 --- a/gc/include/private/dbg_mlc.h +++ b/gc/include/private/dbg_mlc.h @@ -46,7 +46,8 @@ /* Stored both one past the end of user object, and one before */ /* the end of the object as seen by the allocator. */ -# if defined(KEEP_BACK_PTRS) || defined(PRINT_BLACK_LIST) +# if defined(KEEP_BACK_PTRS) || defined(PRINT_BLACK_LIST) \ + || defined(MAKE_BACK_GRAPH) /* Pointer "source"s that aren't real locations. */ /* Used in oh_back_ptr fields and as "source" */ /* argument to some marking functions. */ @@ -60,28 +61,42 @@ /* Object header */ typedef struct { -# ifdef KEEP_BACK_PTRS - GC_hidden_pointer oh_back_ptr; - /* We make sure that we only store even valued */ - /* pointers here, so that the hidden version has */ - /* the least significant bit set. We never */ - /* overwrite a value with the least significant */ - /* bit clear, thus ensuring that we never overwrite */ - /* a free list link field. */ - /* Note that blocks dropped by black-listing will */ - /* also have the lsb clear once debugging has */ - /* started. */ - /* The following are special back pointer values. */ - /* Note that the "hidden" (i.e. bitwise */ - /* complemented version) of these is actually */ - /* stored. */ +# if defined(KEEP_BACK_PTRS) || defined(MAKE_BACK_GRAPH) + /* We potentially keep two different kinds of back */ + /* pointers. KEEP_BACK_PTRS stores a single back */ + /* pointer in each reachable object to allow reporting */ + /* of why an object was retained. MAKE_BACK_GRAPH */ + /* builds a graph containing the inverse of all */ + /* "points-to" edges including those involving */ + /* objects that have just become unreachable. This */ + /* allows detection of growing chains of unreachable */ + /* objects. It may be possible to eventually combine */ + /* both, but for now we keep them separate. Both */ + /* kinds of back pointers are hidden using the */ + /* following macros. In both cases, the plain version */ + /* is constrained to have an least significant bit of 1,*/ + /* to allow it to be distinguished from a free list */ + /* link. This means the plain version must have an */ + /* lsb of 0. */ + /* Note that blocks dropped by black-listing will */ + /* also have the lsb clear once debugging has */ + /* started. */ + /* We're careful never to overwrite a value with lsb 0. */ # if ALIGNMENT == 1 /* Fudge back pointer to be even. */ # define HIDE_BACK_PTR(p) HIDE_POINTER(~1 & (GC_word)(p)) # else # define HIDE_BACK_PTR(p) HIDE_POINTER(p) # endif -# ifdef ALIGN_DOUBLE + +# ifdef KEEP_BACK_PTRS + GC_hidden_pointer oh_back_ptr; +# endif +# ifdef MAKE_BACK_GRAPH + GC_hidden_pointer oh_bg_ptr; +# endif +# if defined(ALIGN_DOUBLE) && \ + (defined(KEEP_BACK_PTRS) != defined(MAKE_BACK_GRAPH)) word oh_dummy; # endif # endif @@ -139,9 +154,9 @@ typedef struct { GC_bool GC_has_other_debug_info(/* p */); #endif -#ifdef KEEP_BACK_PTRS +#if defined(KEEP_BACK_PTRS) || defined(MAKE_BACK_GRAPH) # define GC_HAS_DEBUG_INFO(p) \ - ((((oh *)p)->oh_back_ptr & 1) && GC_has_other_debug_info(p)) + ((*((word *)p) & 1) && GC_has_other_debug_info(p)) #else # define GC_HAS_DEBUG_INFO(p) GC_has_other_debug_info(p) #endif diff --git a/gc/include/private/gc_locks.h b/gc/include/private/gc_locks.h index eed9f10..5ea1e54 100644 --- a/gc/include/private/gc_locks.h +++ b/gc/include/private/gc_locks.h @@ -76,7 +76,7 @@ # define LOCK() RT0u__inCritical++ # define UNLOCK() RT0u__inCritical-- # endif -# ifdef SOLARIS_THREADS +# ifdef GC_SOLARIS_THREADS # include <thread.h> # include <signal.h> extern mutex_t GC_allocate_ml; @@ -261,8 +261,8 @@ # define USE_PTHREAD_LOCKS # endif -# if defined(LINUX_THREADS) || defined(OSF1_THREADS) \ - || defined(HPUX_THREADS) +# if defined(GC_PTHREADS) && !defined(GC_SOLARIS_THREADS) \ + && !defined(GC_IRIX_THREADS) # define NO_THREAD (pthread_t)(-1) # include <pthread.h> # if defined(PARALLEL_MARK) @@ -412,8 +412,8 @@ # ifdef GC_ASSERTIONS extern pthread_t GC_mark_lock_holder; # endif -# endif /* LINUX_THREADS || OSF1_THREADS || HPUX_THREADS */ -# if defined(IRIX_THREADS) +# endif /* GC_PTHREADS with linux_threads.c implementation */ +# if defined(GC_IRIX_THREADS) # include <pthread.h> /* This probably should never be included, but I can't test */ /* on Irix anymore. */ @@ -439,8 +439,8 @@ GC_collecting = 1; \ } # define EXIT_GC() GC_collecting = 0; -# endif /* IRIX_THREADS */ -# ifdef WIN32_THREADS +# endif /* GC_IRIX_THREADS */ +# ifdef GC_WIN32_THREADS # include <windows.h> GC_API CRITICAL_SECTION GC_allocate_ml; # define LOCK() EnterCriticalSection(&GC_allocate_ml); diff --git a/gc/include/private/gc_pmark.h b/gc/include/private/gc_pmark.h index cf70706..5936f2e 100644 --- a/gc/include/private/gc_pmark.h +++ b/gc/include/private/gc_pmark.h @@ -136,7 +136,8 @@ extern mse * GC_mark_stack; /* Set *new_hdr_p to corr. hdr. */ #ifdef __STDC__ # ifdef PRINT_BLACK_LIST - ptr_t GC_find_start(ptr_t current, hdr *hhdr, hdr **new_hdr_p, word source); + ptr_t GC_find_start(ptr_t current, hdr *hhdr, hdr **new_hdr_p, + ptr_t source); # else ptr_t GC_find_start(ptr_t current, hdr *hhdr, hdr **new_hdr_p); # endif diff --git a/gc/include/private/gc_priv.h b/gc/include/private/gc_priv.h index 5135e3e..5ca02a6 100644 --- a/gc/include/private/gc_priv.h +++ b/gc/include/private/gc_priv.h @@ -396,7 +396,8 @@ struct hblk; /* See below. */ + GC_page_size-1) # else # if defined(NEXT) || defined(MACOSX) || defined(DOS4GW) || \ - (defined(AMIGA) && !defined(GC_AMIGA_FASTALLOC)) + (defined(AMIGA) && !defined(GC_AMIGA_FASTALLOC)) || \ + (defined(SUNOS5) && !defined(USE_MMAP)) # define GET_MEM(bytes) HBLKPTR((size_t) \ calloc(1, (size_t)bytes + GC_page_size) \ + GC_page_size-1) @@ -443,18 +444,21 @@ struct hblk; /* See below. */ /* clear on that point). Standard malloc implementations are usually */ /* neither interruptable nor thread-safe, and thus correspond to */ /* empty definitions. */ +/* It probably doesn't make any sense to declare these to be nonempty */ +/* if the code is being optimized, since signal safety relies on some */ +/* ordering constraints that are typically not obeyed by optimizing */ +/* compilers. */ # ifdef PCR # define DISABLE_SIGNALS() \ PCR_Th_SetSigMask(PCR_allSigsBlocked,&GC_old_sig_mask) # define ENABLE_SIGNALS() \ PCR_Th_SetSigMask(&GC_old_sig_mask, NIL) # else -# if defined(SRC_M3) || defined(AMIGA) || defined(SOLARIS_THREADS) \ +# if defined(THREADS) || defined(AMIGA) \ || defined(MSWIN32) || defined(MSWINCE) || defined(MACOS) \ - || defined(DJGPP) || defined(NO_SIGNALS) || defined(IRIX_THREADS) \ - || defined(LINUX_THREADS) + || defined(DJGPP) || defined(NO_SIGNALS) /* Also useful for debugging. */ - /* Should probably use thr_sigsetmask for SOLARIS_THREADS. */ + /* Should probably use thr_sigsetmask for GC_SOLARIS_THREADS. */ # define DISABLE_SIGNALS() # define ENABLE_SIGNALS() # else @@ -479,9 +483,8 @@ struct hblk; /* See below. */ PCR_allSigsBlocked, \ PCR_waitForever); # else -# if defined(SOLARIS_THREADS) || defined(WIN32_THREADS) \ - || defined(IRIX_THREADS) || defined(LINUX_THREADS) \ - || defined(HPUX_THREADS) +# if defined(GC_SOLARIS_THREADS) || defined(GC_WIN32_THREADS) \ + || defined(GC_PTHREADS) void GC_stop_world(); void GC_start_world(); # define STOP_WORLD() GC_stop_world() @@ -566,7 +569,8 @@ extern GC_warn_proc GC_current_warn_proc; # ifdef SMALL_CONFIG # define CPP_LOG_HBLKSIZE 10 # else -# if CPP_WORDSZ == 32 +# if (CPP_WORDSZ == 32) || (defined(HPUX) && defined(HP_PA)) + /* HPUX/PA seems to use 4K pages with the 64 bit ABI */ # define CPP_LOG_HBLKSIZE 12 # else # define CPP_LOG_HBLKSIZE 13 @@ -1903,8 +1907,7 @@ void GC_err_puts GC_PROTO((GC_CONST char *s)); /* some other reason. */ # endif /* PARALLEL_MARK */ -# if defined(LINUX_THREADS) || defined(IRIX_THREADS) \ - || defined(HPUX_THREADS) || defined(OSF1_THREADS) +# if defined(GC_PTHREADS) && !defined(GC_SOLARIS_THREADS) /* We define the thread suspension signal here, so that we can refer */ /* to it in the dirty bit implementation, if necessary. Ideally we */ /* would allocate a (real-time ?) signal using the standard mechanism.*/ @@ -1912,16 +1915,16 @@ void GC_err_puts GC_PROTO((GC_CONST char *s)); /* in Linux glibc, but it's not exported.) Thus we continue to use */ /* the same hard-coded signals we've always used. */ # if !defined(SIG_SUSPEND) -# if defined(LINUX_THREADS) +# if defined(GC_LINUX_THREADS) # if defined(SPARC) && !defined(SIGPWR) /* SPARC/Linux doesn't properly define SIGPWR in <signal.h>. * It is aliased to SIGLOST in asm/signal.h, though. */ # define SIG_SUSPEND SIGLOST # else - /* Linuxthreads uses SIGUSR1 and SIGUSR2. */ + /* Linuxthreads itself uses SIGUSR1 and SIGUSR2. */ # define SIG_SUSPEND SIGPWR # endif -# else /* !LINUX_THREADS */ +# else /* !GC_LINUX_THREADS */ # define SIG_SUSPEND _SIGRTMIN + 6 # endif # endif /* !SIG_SUSPEND */ diff --git a/gc/include/private/gcconfig.h b/gc/include/private/gcconfig.h index a0d12c8..86020fc 100644 --- a/gc/include/private/gcconfig.h +++ b/gc/include/private/gcconfig.h @@ -33,6 +33,11 @@ # define NETBSD # endif +/* And one for OpenBSD: */ +# if defined(__OpenBSD__) +# define OPENBSD +# endif + /* Determine the machine type: */ # if defined(sun) && defined(mc68000) # define M68K @@ -44,25 +49,23 @@ # define HP # define mach_type_known # endif -# if defined(__OpenBSD__) && defined(m68k) +# if defined(OPENBSD) && defined(m68k) # define M68K -# define OPENBSD # define mach_type_known # endif -# if defined(__OpenBSD__) && defined(__sparc__) +# if defined(OPENBSD) && defined(__sparc__) # define SPARC -# define OPENBSD # define mach_type_known # endif -# if defined(__NetBSD__) && defined(m68k) +# if defined(NETBSD) && defined(m68k) # define M68K # define mach_type_known # endif -# if defined(__NetBSD__) && defined(__powerpc__) +# if defined(NETBSD) && defined(__powerpc__) # define POWERPC # define mach_type_known # endif -# if defined(__NetBSD__) && defined(__arm32__) +# if defined(NETBSD) && defined(__arm32__) # define ARM32 # define mach_type_known # endif @@ -75,9 +78,12 @@ # endif # define mach_type_known # endif -# if defined(mips) || defined(__mips) +# if defined(mips) || defined(__mips) || defined(_mips) # define MIPS -# if !defined(LINUX) +# if defined(nec_ews) || defined(_nec_ews) +# define EWS4800 +# endif +# if !defined(LINUX) && !defined(EWS4800) # if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__) # define ULTRIX # else @@ -161,6 +167,11 @@ # endif # define mach_type_known # endif +# if defined(__ia64) && defined(_HPUX_SOURCE) +# define IA64 +# define HPUX +# define mach_type_known +# endif # if defined(__BEOS__) && defined(_X86_) # define I386 # define BEOS @@ -196,7 +207,7 @@ # endif # if defined(__alpha) || defined(__alpha__) # define ALPHA -# if !defined(LINUX) && !defined(NETBSD) +# if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD) # define OSF1 /* a.k.a Digital Unix */ # endif # define mach_type_known @@ -386,7 +397,7 @@ /* RS6000 ==> IBM RS/6000 AIX3.X */ /* RT ==> IBM PC/RT */ /* HP_PA ==> HP9000/700 & /800 */ - /* HP/UX, LINUX */ + /* HP/UX, LINUX */ /* SPARC ==> SPARC v7/v8/v9 */ /* (SUNOS4, SUNOS5, LINUX, */ /* DRSNX variants) */ @@ -398,8 +409,11 @@ /* running Amdahl UTS4 */ /* or a 390 running LINUX */ /* ARM32 ==> Intel StrongARM */ - /* IA64 ==> Intel IA64 */ + /* IA64 ==> Intel IPF */ /* (e.g. Itanium) */ + /* (LINUX and HPUX) */ + /* IA64_32 ==> IA64 w/32 bit ABI */ + /* (HPUX) */ /* SH ==> Hitachi SuperH */ /* (LINUX & MSWINCE) */ @@ -533,7 +547,7 @@ # ifdef LINUX # define OS_TYPE "LINUX" # define STACKBOTTOM ((ptr_t)0xf0000000) -# define MPROTECT_VDB +/* # define MPROTECT_VDB - Reported to not work 9/17/01 */ # ifdef __ELF__ # define DYNAMIC_LOADING # include <features.h> @@ -715,8 +729,12 @@ extern char * GC_SysVGetDataStart(); # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext) # define DATAEND (&_end) -# ifndef USE_MMAP +# 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 @@ -838,21 +856,29 @@ # endif # ifdef SUNOS5 # define OS_TYPE "SUNOS5" - extern int etext, _start; + extern int _etext, _end; extern char * GC_SysVGetDataStart(); -# define DATASTART GC_SysVGetDataStart(0x1000, &etext) +# define DATASTART GC_SysVGetDataStart(0x1000, &_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. */ -# include <sys/vmparam.h> +# include <sys/vm.h> # define STACKBOTTOM USRSTACK -/** At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */ -/*# define PROC_VDB*/ +/* 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 -# ifndef USE_MMAP +# 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 @@ -888,7 +914,7 @@ /* with 2GB physical memory will usually move the user */ /* address space limit, and hence initial SP to 0x80000000. */ # endif -# if !defined(LINUX_THREADS) || !defined(REDIRECT_MALLOC) +# if !defined(GC_LINUX_THREADS) || !defined(REDIRECT_MALLOC) # define MPROTECT_VDB # else /* We seem to get random errors in incremental mode, */ @@ -1003,8 +1029,17 @@ # endif # ifdef FREEBSD # define OS_TYPE "FREEBSD" -# define MPROTECT_VDB +# 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 char etext; +# define DATASTART ((ptr_t)(&etext)) # endif # ifdef NETBSD # define OS_TYPE "NETBSD" @@ -1015,7 +1050,7 @@ # ifdef BSDI # define OS_TYPE "BSDI" # endif -# if defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \ +# if defined(OPENBSD) || defined(NETBSD) \ || defined(THREE86BSD) || defined(BSDI) # define HEURISTIC2 extern char etext; @@ -1083,6 +1118,29 @@ /* instead. But some kernel versions seem to give the wrong */ /* value from /proc. */ # 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 @@ -1161,7 +1219,6 @@ # ifdef HP_PA # define MACH_TYPE "HP_PA" -# define OS_TYPE "HPUX" # ifdef __LP64__ # define CPP_WORDSZ 64 # define ALIGNMENT 8 @@ -1170,8 +1227,7 @@ # define ALIGNMENT 4 # define ALIGN_DOUBLE # endif -# if !defined(GC_HPUX_THREADS) && !defined(HPUX_THREADS) \ - && !defined(GC_LINUX_THREADS) && !defined(LINUX_THREADS) +# if !defined(GC_HPUX_THREADS) && !defined(GC_LINUX_THREADS) # ifndef LINUX /* For now. */ # define MPROTECT_VDB # endif @@ -1186,6 +1242,7 @@ # endif # define STACK_GROWS_UP # ifdef HPUX +# define OS_TYPE "HPUX" extern int __data_start; # define DATASTART ((ptr_t)(&__data_start)) # if 0 @@ -1242,6 +1299,19 @@ # 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 OSF1 # define OS_TYPE "OSF1" # define DATASTART ((ptr_t) 0x140000000) @@ -1284,9 +1354,6 @@ # ifdef IA64 # define MACH_TYPE "IA64" -# define ALIGN_DOUBLE - /* Requires 16 byte alignment for malloc */ -# define ALIGNMENT 8 # define USE_GENERIC_PUSH_REGS /* We need to get preserved registers in addition to register */ /* windows. That's easiest to do with setjmp. */ @@ -1296,11 +1363,47 @@ /* setting mark bits. */ # endif # ifdef HPUX - --> needs work +# 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. */ + /* Note that the backing store base seems to be at a nice */ + /* address minus one page. */ +# define BACKING_STORE_DISPLACEMENT 0x1000000 +# define BACKING_STORE_ALIGNMENT 0x1000 +# define BACKING_STORE_BASE \ + (ptr_t)(((word)GC_stackbottom - BACKING_STORE_DISPLACEMENT - 1) \ + & ~(BACKING_STORE_ALIGNMENT - 1)) # endif # ifdef LINUX +# define CPP_WORDSZ 64 +# define ALIGN_DOUBLE + /* Requires 16 byte alignment for malloc */ +# define ALIGNMENT 8 # define OS_TYPE "LINUX" -# define CPP_WORDSZ 64 /* The following works on NUE and older kernels: */ /* # define STACKBOTTOM ((ptr_t) 0xa000000000000000l) */ /* This does not work on NUE: */ @@ -1315,7 +1418,13 @@ # define BACKING_STORE_BASE ((ptr_t)GC_register_stackbottom) # define SEARCH_FOR_DATA_START # define DATASTART GC_data_start -# define DYNAMIC_LOADING +# 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; @@ -1581,57 +1690,33 @@ ((word*)x)[1] = 0; # endif /* CLEAR_DOUBLE */ -/* Internally to the collector we test only the XXX_THREADS macros */ -/* not the GC_XXX_THREADS versions. Here we make sure the latter */ -/* are treated as equivalent. */ -#if defined(GC_SOLARIS_THREADS) && !defined(_SOLARIS_THREADS) -# define _SOLARIS_THREADS -#endif -#if defined(GC_SOLARIS_THREADS) && !defined(_SOLARIS_PTHREADS) -# define _SOLARIS_PTHREADS -#endif -#if defined(GC_IRIX_THREADS) && !defined(IRIX_THREADS) -# define IRIX_THREADS -#endif -#if defined(GC_LINUX_THREADS) && !defined(LINUX_THREADS) -# define LINUX_THREADS -#endif -#if defined(GC_WIN32_THREADS) && !defined(WIN32_THREADS) -# define WIN32_THREADS -#endif -#if defined(GC_HPUX_THREADS) && !defined(HPUX_THREADS) -# define HPUX_THREADS -#endif -#if defined(GC_OSF1_THREADS) && !defined(OSF1_THREADS) -# define OSF1_THREADS -#endif - -/* Internally we use SOLARIS_THREADS to test for either old or pthreads. */ -# if defined(_SOLARIS_PTHREADS) && !defined(SOLARIS_THREADS) -# define SOLARIS_THREADS +/* Internally we use GC_SOLARIS_THREADS to test for either old or pthreads. */ +# if defined(GC_SOLARIS_PTHREADS) && !defined(GC_SOLARIS_THREADS) +# define GC_SOLARIS_THREADS # endif -# if defined(IRIX_THREADS) && !defined(IRIX5) + +# if defined(GC_IRIX_THREADS) && !defined(IRIX5) --> inconsistent configuration # endif -# if defined(LINUX_THREADS) && !defined(LINUX) +# if defined(GC_LINUX_THREADS) && !defined(LINUX) --> inconsistent configuration # endif -# if defined(SOLARIS_THREADS) && !defined(SUNOS5) +# if defined(GC_SOLARIS_THREADS) && !defined(SUNOS5) --> inconsistent configuration # endif -# if defined(HPUX_THREADS) && !defined(HPUX) +# if defined(GC_HPUX_THREADS) && !defined(HPUX) --> inconsistent configuration # endif -# if defined(WIN32_THREADS) && !defined(MSWIN32) - /* 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. */ +# if defined(GC_WIN32_THREADS) && !defined(MSWIN32) + /* 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 # endif + # if defined(PCR) || defined(SRC_M3) || \ - defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || \ - defined(IRIX_THREADS) || defined(LINUX_THREADS) || \ - defined(HPUX_THREADS) || defined(OSF1_THREADS) + defined(GC_SOLARIS_THREADS) || defined(GC_WIN32_THREADS) || \ + defined(GC_PTHREADS) # define THREADS # endif @@ -1656,4 +1741,8 @@ /* include assembly code to do it well. */ # endif +# if defined(MAKE_BACK_GRAPH) && !defined(DBG_HDRS_ALL) +# define DBG_HDRS_ALL +# endif + # endif /* GCCONFIG_H */ diff --git a/gc/include/private/solaris_threads.h b/gc/include/private/solaris_threads.h index b2cdb36..1464bc1 100644 --- a/gc/include/private/solaris_threads.h +++ b/gc/include/private/solaris_threads.h @@ -1,4 +1,4 @@ -#ifdef SOLARIS_THREADS +#ifdef GC_SOLARIS_THREADS /* The set of all known threads. We intercept thread creation and */ /* joins. We never actually create detached threads. We allocate all */ @@ -30,5 +30,5 @@ extern size_t GC_page_sz; extern void GC_thr_init(void); -# endif /* SOLARIS_THREADS */ +# endif /* GC_SOLARIS_THREADS */ |