diff options
author | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-02-12 04:37:57 +0000 |
---|---|---|
committer | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-02-12 04:37:57 +0000 |
commit | 0cc01484c3f8c9ec4fec760501aec318bc199adf (patch) | |
tree | cef3197531d988920cbff060bdc10742baf06d01 /boehm-gc/include | |
parent | b6c37935d39c0aadd3d6eefb9e09c455c6cbd0a5 (diff) | |
download | gcc-0cc01484c3f8c9ec4fec760501aec318bc199adf.tar.gz |
Imported GC 6.1 Alpha 3. Finally.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49698 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'boehm-gc/include')
-rw-r--r-- | boehm-gc/include/Makefile.in | 5 | ||||
-rw-r--r-- | boehm-gc/include/gc.h | 24 | ||||
-rw-r--r-- | boehm-gc/include/leak_detector.h | 4 | ||||
-rw-r--r-- | boehm-gc/include/private/dbg_mlc.h | 53 | ||||
-rw-r--r-- | boehm-gc/include/private/gc_pmark.h | 3 | ||||
-rw-r--r-- | boehm-gc/include/private/gc_priv.h | 38 | ||||
-rw-r--r-- | boehm-gc/include/private/gcconfig.h | 135 |
7 files changed, 192 insertions, 70 deletions
diff --git a/boehm-gc/include/Makefile.in b/boehm-gc/include/Makefile.in index 3c8f7fb63e7..611f5651839 100644 --- a/boehm-gc/include/Makefile.in +++ b/boehm-gc/include/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated automatically by automake 1.4-p1 from Makefile.am +# Makefile.in generated automatically by automake 1.4 from Makefile.am # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation @@ -96,7 +96,8 @@ target_all = @target_all@ AUTOMAKE_OPTIONS = foreign -include_HEADERS = gc.h gc_backptr.h gc_local_alloc.h gc_pthread_redirects.h gc_cpp.h +include_HEADERS = gc.h gc_backptr.h gc_local_alloc.h \ + gc_pthread_redirects.h gc_cpp.h CONFIG_CLEAN_FILES = HEADERS = $(include_HEADERS) diff --git a/boehm-gc/include/gc.h b/boehm-gc/include/gc.h index 9e5447b0458..69075b0669e 100644 --- a/boehm-gc/include/gc.h +++ b/boehm-gc/include/gc.h @@ -305,6 +305,20 @@ GC_API int GC_dont_precollect; /* Don't collect as part of */ */ GC_API void GC_init GC_PROTO((void)); +GC_API unsigned long GC_time_limit; + /* If incremental collection is enabled, */ + /* We try to terminate collections */ + /* after this many milliseconds. Not a */ + /* hard time bound. Setting this to */ + /* GC_TIME_UNLIMITED will essentially */ + /* disable incremental collection while */ + /* leaving generational collection */ + /* enabled. */ +# define GC_TIME_UNLIMITED 999999 + /* Setting GC_time_limit to this value */ + /* will disable the "pause time exceeded */ + /* tests. */ + /* * general purpose allocation routines, with roughly malloc calling conv. * The atomic versions promise that no relevant pointers are contained @@ -463,6 +477,16 @@ GC_API size_t GC_get_total_bytes GC_PROTO((void)); /* functional if GC_parallel is TRUE. */ GC_API void GC_enable_incremental GC_PROTO((void)); +/* Does incremental mode write-protect pages? Returns zero or */ +/* more of the following, or'ed together: */ +#define GC_PROTECTS_POINTER_HEAP 1 /* May protect non-atomic objs. */ +#define GC_PROTECTS_PTRFREE_HEAP 2 +#define GC_PROTECTS_STATIC_DATA 4 /* Curently never. */ +#define GC_PROTECTS_STACK 8 /* Probably impractical. */ + +#define GC_PROTECTS_NONE 0 +GC_API int GC_incremental_protection_needs GC_PROTO((void)); + /* Perform some garbage collection work, if appropriate. */ /* Return 0 if there is no more work to be done. */ /* Typically performs an amount of work corresponding roughly */ diff --git a/boehm-gc/include/leak_detector.h b/boehm-gc/include/leak_detector.h index 6786825ab6d..0674ab4d09f 100644 --- a/boehm-gc/include/leak_detector.h +++ b/boehm-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/boehm-gc/include/private/dbg_mlc.h b/boehm-gc/include/private/dbg_mlc.h index 6f5b3c8677d..5378835811c 100644 --- a/boehm-gc/include/private/dbg_mlc.h +++ b/boehm-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/boehm-gc/include/private/gc_pmark.h b/boehm-gc/include/private/gc_pmark.h index 43077e9f616..872065702f0 100644 --- a/boehm-gc/include/private/gc_pmark.h +++ b/boehm-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/boehm-gc/include/private/gc_priv.h b/boehm-gc/include/private/gc_priv.h index 92067d24e70..ae406cb9010 100644 --- a/boehm-gc/include/private/gc_priv.h +++ b/boehm-gc/include/private/gc_priv.h @@ -249,20 +249,6 @@ typedef char * ptr_t; /* A generic pointer to which we can add */ #ifdef SAVE_CALL_CHAIN -/* - * Number of frames and arguments to save in objects allocated by - * debugging allocator. - */ -# ifndef SAVE_CALL_COUNT -# define NFRAMES 6 /* Number of frames to save. Even for */ - /* alignment reasons. */ -# else -# define NFRAMES ((SAVE_CALL_COUNT + 1) & ~1) -# endif -# define NARGS 2 /* Mumber of arguments to save for each call. */ - -# define NEED_CALLINFO - /* Fill in the pc and argument information for up to NFRAMES of my */ /* callers. Ignore my frame and my callers frame. */ struct callinfo; @@ -270,14 +256,6 @@ void GC_save_callers GC_PROTO((struct callinfo info[NFRAMES])); void GC_print_callers GC_PROTO((struct callinfo info[NFRAMES])); -#else - -# ifdef GC_ADD_CALLER -# define NFRAMES 1 -# define NARGS 0 -# define NEED_CALLINFO -# endif - #endif #ifdef NEED_CALLINFO @@ -396,7 +374,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) @@ -787,12 +766,11 @@ struct hblkhdr { # define BODY_SZ (HBLKSIZE/sizeof(word)) struct hblk { -# if 0 /* DISCARDWORDS no longer supported */ - word garbage[DISCARD_WORDS]; -# endif word hb_body[BODY_SZ]; }; +# define HBLK_IS_FREE(hdr) ((hdr) -> hb_map == GC_invalid_map) + # define OBJ_SZ_TO_BLOCKS(sz) \ divHBLKSZ(WORDS_TO_BYTES(sz) + HBLKSIZE-1) /* Size of block (in units of HBLKSIZE) needed to hold objects of */ @@ -1765,8 +1743,12 @@ GC_bool GC_page_was_ever_dirty GC_PROTO((struct hblk *h)); void GC_is_fresh GC_PROTO((struct hblk *h, word n)); /* Assert the region currently contains no */ /* valid pointers. */ -void GC_write_hint GC_PROTO((struct hblk *h)); - /* h is about to be written. */ +void GC_remove_protection GC_PROTO((struct hblk *h, word nblocks, + GC_bool pointerfree)); + /* h is about to be writteni or allocated. Ensure */ + /* that it's not write protected by the virtual */ + /* dirty bit implementation. */ + void GC_dirty_init GC_PROTO((void)); /* Slow/general mark bit manipulation: */ diff --git a/boehm-gc/include/private/gcconfig.h b/boehm-gc/include/private/gcconfig.h index 647bd5af3f7..e06cc4abc56 100644 --- a/boehm-gc/include/private/gcconfig.h +++ b/boehm-gc/include/private/gcconfig.h @@ -85,9 +85,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 @@ -726,6 +729,7 @@ # define ELF_CLASS ELFCLASS64 # else # define ALIGNMENT 4 /* Required by hardware */ +# define CPP_WORDSZ 32 # endif # define ALIGN_DOUBLE # ifdef SUNOS5 @@ -735,8 +739,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 @@ -760,7 +768,9 @@ # define GETPAGESIZE() sysconf(_SC_PAGESIZE) /* getpagesize() appeared to be missing from at least one */ /* Solaris 5.4 installation. Weird. */ -# define DYNAMIC_LOADING +# if CPP_WORDSZ == 32 +# define DYNAMIC_LOADING +# endif # endif # ifdef SUNOS4 # define OS_TYPE "SUNOS4" @@ -782,7 +792,6 @@ # define DYNAMIC_LOADING # endif # ifdef DRSNX -# define CPP_WORDSZ 32 # define OS_TYPE "DRSNX" extern char * GC_SysVGetDataStart(); extern int etext; @@ -805,7 +814,6 @@ # ifdef __arch64__ # define STACKBOTTOM ((ptr_t) 0x80000000000ULL) # define DATASTART (ptr_t)GC_SysVGetDataStart(0x100000, &_etext) -# define CPP_WORDSZ 64 # else # define STACKBOTTOM ((ptr_t) 0xf0000000) # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext) @@ -858,7 +866,7 @@ # endif # ifdef SUNOS5 # define OS_TYPE "SUNOS5" - extern int _etext, _end; + extern int _etext, _end; extern char * GC_SysVGetDataStart(); # define DATASTART GC_SysVGetDataStart(0x1000, &_etext) # define DATAEND (&_end) @@ -867,15 +875,20 @@ /* 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. */ +/* 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 @@ -900,6 +913,10 @@ # define ELF_CLASS ELFCLASS32 # endif # ifdef LINUX +# ifndef __GNUC__ + /* The Intel compiler doesn't like inline assembly */ +# define USE_GENERIC_PUSH_REGS +# endif # define OS_TYPE "LINUX" # define LINUX_STACKBOTTOM # if 0 @@ -1035,6 +1052,8 @@ # ifdef __ELF__ # define DYNAMIC_LOADING # endif + extern char etext; +# define DATASTART ((ptr_t)(&etext)) # endif # ifdef NETBSD # define OS_TYPE "NETBSD" @@ -1045,7 +1064,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; @@ -1113,6 +1132,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 @@ -1394,7 +1436,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; @@ -1707,17 +1755,68 @@ /* descriptions. */ # define USE_GENERIC_PUSH_REGS # endif -# if defined(I386) && defined(LINUX) + +# if defined(SPARC) +# define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */ + /* include assembly code to do it well. */ +# endif + +/* Can we save call chain in objects for debugging? */ +/* SET NFRAMES (# of saved frames) and NARGS (#of args for each frame) */ +/* to reasonable values for the platform. */ +/* Set SAVE_CALL_CHAIN if we can. SAVE_CALL_COUNT can be specified at */ +/* build time, though we feel free to adjust it slightly. */ +/* Define NEED_CALLINFO if we either save the call stack or */ +/* GC_ADD_CALLER is defined. */ +#ifdef LINUX +# include <features.h> +# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2 +# define HAVE_BUILTIN_BACKTRACE +# endif +#endif + +#if defined(SPARC) +# define CAN_SAVE_CALL_STACKS +# define CAN_SAVE_CALL_ARGS +#endif +#if defined(I386) && defined(LINUX) /* SAVE_CALL_CHAIN is supported if the code is compiled to save */ /* frame pointers by default, i.e. no -fomit-frame-pointer flag. */ -# ifdef SAVE_CALL_COUNT +# define CAN_SAVE_CALL_STACKS +# define CAN_SAVE_CALL_ARGS +#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) \ + && defined(CAN_SAVE_CALL_STACKS) # define SAVE_CALL_CHAIN # endif +# ifdef SAVE_CALL_CHAIN +# if defined(SAVE_CALL_NARGS) && defined(CAN_SAVE_CALL_ARGS) +# define NARGS SAVE_CALL_NARGS +# else +# define NARGS 0 /* Number of arguments to save for each call. */ +# endif # endif -# if defined(SPARC) -# define SAVE_CALL_CHAIN -# define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */ - /* include assembly code to do it well. */ +# ifdef SAVE_CALL_CHAIN +# ifndef SAVE_CALL_COUNT +# define NFRAMES 6 /* Number of frames to save. Even for */ + /* alignment reasons. */ +# else +# define NFRAMES ((SAVE_CALL_COUNT + 1) & ~1) +# endif +# define NEED_CALLINFO +# endif /* SAVE_CALL_CHAIN */ +# ifdef GC_ADD_CALLER +# define NFRAMES 1 +# define NARGS 0 +# define NEED_CALLINFO +# endif + +# if defined(MAKE_BACK_GRAPH) && !defined(DBG_HDRS_ALL) +# define DBG_HDRS_ALL # endif # endif /* GCCONFIG_H */ |