⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gc_priv.h

📁 this gcc-g++-3.3.1.tar.gz is a source file of gcc, you can learn more about gcc through this codes f
💻 H
📖 第 1 页 / 共 5 页
字号:
/*  * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved. * Copyright (c) 1999-2001 by Hewlett-Packard Company. All rights reserved. * * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose,  provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ # ifndef GC_PRIVATE_H# define GC_PRIVATE_H#if defined(mips) && defined(SYSTYPE_BSD) && defined(sony_news)    /* sony RISC NEWS, NEWSOS 4 */#   define BSD_TIME/*    typedef long ptrdiff_t;   -- necessary on some really old systems	*/#endif#if defined(mips) && defined(SYSTYPE_BSD43)    /* MIPS RISCOS 4 */#   define BSD_TIME#endif#ifdef BSD_TIME#   include <sys/types.h>#   include <sys/time.h>#   include <sys/resource.h>#endif /* BSD_TIME */# ifndef GC_H#   include "gc.h"# endif# ifndef GC_MARK_H#   include "../gc_mark.h"# endiftypedef GC_word word;typedef GC_signed_word signed_word;typedef int GC_bool;# define TRUE 1# define FALSE 0typedef char * ptr_t;	/* A generic pointer to which we can add	*/			/* byte displacements.				*/			/* Preferably identical to caddr_t, if it 	*/			/* exists.					*/			# ifndef GCCONFIG_H#   include "gcconfig.h"# endif# ifndef HEADERS_H#   include "gc_hdrs.h"# endif#if defined(__STDC__)#   include <stdlib.h>#   if !(defined( sony_news ) )#       include <stddef.h>#   endif#   define VOLATILE volatile#else#   ifdef MSWIN32#   	include <stdlib.h>#   endif#   define VOLATILE#endif#if 0 /* defined(__GNUC__) doesn't work yet */# define EXPECT(expr, outcome) __builtin_expect(expr,outcome)  /* Equivalent to (expr), but predict that usually (expr)==outcome. */#else# define EXPECT(expr, outcome) (expr)#endif /* __GNUC__ */# ifndef GC_LOCKS_H#   include "gc_locks.h"# endif# ifdef STACK_GROWS_DOWN#   define COOLER_THAN >#   define HOTTER_THAN <#   define MAKE_COOLER(x,y) if ((word)(x)+(y) > (word)(x)) {(x) += (y);} \			    else {(x) = (word)ONES;}#   define MAKE_HOTTER(x,y) (x) -= (y)# else#   define COOLER_THAN <#   define HOTTER_THAN >#   define MAKE_COOLER(x,y) if ((word)(x)-(y) < (word)(x)) {(x) -= (y);} else {(x) = 0;}#   define MAKE_HOTTER(x,y) (x) += (y)# endif#if defined(AMIGA) && defined(__SASC)#   define GC_FAR __far#else#   define GC_FAR#endif/*********************************//*                               *//* Definitions for conservative  *//* collector                     *//*                               *//*********************************//*********************************//*                               *//* Easily changeable parameters  *//*                               *//*********************************//* #define STUBBORN_ALLOC */		    /* Enable stubborm allocation, and thus a limited	*/		    /* form of incremental collection w/o dirty bits.	*//* #define ALL_INTERIOR_POINTERS */		    /* Forces all pointers into the interior of an 	*/		    /* object to be considered valid.  Also causes the	*/		    /* sizes of all objects to be inflated by at least 	*/		    /* one byte.  This should suffice to guarantee	*/		    /* that in the presence of a compiler that does	*/		    /* not perform garbage-collector-unsafe		*/		    /* optimizations, all portable, strictly ANSI	*/		    /* conforming C programs should be safely usable	*/		    /* with malloc replaced by GC_malloc and free	*/		    /* calls removed.  There are several disadvantages: */		    /* 1. There are probably no interesting, portable,	*/		    /*    strictly ANSI	conforming C programs.		*/		    /* 2. This option makes it hard for the collector	*/		    /*    to allocate space that is not ``pointed to''  */		    /*    by integers, etc.  Under SunOS 4.X with a 	*/		    /*    statically linked libc, we empiricaly		*/		    /*    observed that it would be difficult to 	*/		    /*	  allocate individual objects larger than 100K.	*/		    /* 	  Even if only smaller objects are allocated,	*/		    /*    more swap space is likely to be needed.       */		    /*    Fortunately, much of this will never be	*/		    /*    touched.					*/		    /* If you can easily avoid using this option, do.	*/		    /* If not, try to keep individual objects small.	*/		    /* This is now really controlled at startup,	*/		    /* through GC_all_interior_pointers.		*/		    #define PRINTSTATS  /* Print garbage collection statistics          	*/		    /* For less verbose output, undefine in reclaim.c 	*/#define PRINTTIMES  /* Print the amount of time consumed by each garbage   */		    /* collection.                                         */#define PRINTBLOCKS /* Print object sizes associated with heap blocks,     */		    /* whether the objects are atomic or composite, and    */		    /* whether or not the block was found to be empty      */		    /* during the reclaim phase.  Typically generates       */		    /* about one screenful per garbage collection.         */#undef PRINTBLOCKS#ifdef SILENT#  ifdef PRINTSTATS#    undef PRINTSTATS#  endif#  ifdef PRINTTIMES#    undef PRINTTIMES#  endif#  ifdef PRINTNBLOCKS#    undef PRINTNBLOCKS#  endif#endif#if defined(PRINTSTATS) && !defined(GATHERSTATS)#   define GATHERSTATS#endif#if defined(PRINTSTATS) || !defined(SMALL_CONFIG)#   define CONDPRINT  /* Print some things if GC_print_stats is set */#endif#define GC_INVOKE_FINALIZERS() GC_notify_or_invoke_finalizers()#define MERGE_SIZES /* Round up some object sizes, so that fewer distinct */		    /* free lists are actually maintained.  This applies  */		    /* only to the top level routines in misc.c, not to   */		    /* user generated code that calls GC_allocobj and     */		    /* GC_allocaobj directly.                             */		    /* Slows down average programs slightly.  May however */		    /* substantially reduce fragmentation if allocation   */		    /* request sizes are widely scattered.                */		    /* May save significant amounts of space for obj_map  */		    /* entries.						  */#if defined(USE_MARK_BYTES) && !defined(ALIGN_DOUBLE)#  define ALIGN_DOUBLE   /* We use one byte for every 2 words, which doesn't allow for	*/   /* odd numbered words to have mark bits.				*/#endif#if defined(GC_GCJ_SUPPORT) && ALIGNMENT < 8 && !defined(ALIGN_DOUBLE)   /* GCJ's Hashtable synchronization code requires 64-bit alignment.	*/#  define ALIGN_DOUBLE#endif/* ALIGN_DOUBLE requires MERGE_SIZES at present. */# if defined(ALIGN_DOUBLE) && !defined(MERGE_SIZES)#   define MERGE_SIZES# endif#if !defined(DONT_ADD_BYTE_AT_END)# define EXTRA_BYTES GC_all_interior_pointers#else# define EXTRA_BYTES 0#endif# ifndef LARGE_CONFIG#   define MINHINCR 16	 /* Minimum heap increment, in blocks of HBLKSIZE  */			 /* Must be multiple of largest page size.	   */#   define MAXHINCR 2048 /* Maximum heap increment, in blocks              */# else#   define MINHINCR 64#   define MAXHINCR 4096# endif# define TIME_LIMIT 50	   /* We try to keep pause times from exceeding	 */			   /* this by much. In milliseconds.		 */# define BL_LIMIT GC_black_list_spacing			   /* If we need a block of N bytes, and we have */			   /* a block of N + BL_LIMIT bytes available, 	 */			   /* and N > BL_LIMIT,				 */			   /* but all possible positions in it are 	 */			   /* blacklisted, we just use it anyway (and	 */			   /* print a warning, if warnings are enabled). */			   /* This risks subsequently leaking the block	 */			   /* due to a false reference.  But not using	 */			   /* the block risks unreasonable immediate	 */			   /* heap growth.				 *//*********************************//*                               *//* Stack saving for debugging	 *//*                               *//*********************************/#ifdef SAVE_CALL_CHAIN/* Fill in the pc and argument information for up to NFRAMES of my	*//* callers.  Ignore my frame and my callers frame.			*/struct callinfo;void GC_save_callers GC_PROTO((struct callinfo info[NFRAMES]));  void GC_print_callers GC_PROTO((struct callinfo info[NFRAMES]));#endif#ifdef NEED_CALLINFO    struct callinfo {	word ci_pc;  	/* Caller, not callee, pc	*/#	if NARGS > 0	    word ci_arg[NARGS];	/* bit-wise complement to avoid retention */#	endif#	if defined(ALIGN_DOUBLE) && (NFRAMES * (NARGS + 1)) % 2 == 1	    /* Likely alignment problem. */	    word ci_dummy;#	endif    };#endif/*********************************//*                               *//* OS interface routines	 *//*                               *//*********************************/#ifdef BSD_TIME#   undef CLOCK_TYPE#   undef GET_TIME#   undef MS_TIME_DIFF#   define CLOCK_TYPE struct timeval#   define GET_TIME(x) { struct rusage rusage; \			 getrusage (RUSAGE_SELF,  &rusage); \			 x = rusage.ru_utime; }#   define MS_TIME_DIFF(a,b) ((double) (a.tv_sec - b.tv_sec) * 1000.0 \                               + (double) (a.tv_usec - b.tv_usec) / 1000.0)#else /* !BSD_TIME */# if defined(MSWIN32) || defined(MSWINCE)#   include <windows.h>#   include <winbase.h>#   define CLOCK_TYPE DWORD#   define GET_TIME(x) x = GetTickCount()#   define MS_TIME_DIFF(a,b) ((long)((a)-(b)))# else /* !MSWIN32, !MSWINCE, !BSD_TIME */#   include <time.h>#   if !defined(__STDC__) && defined(SPARC) && defined(SUNOS4)      clock_t clock();	/* Not in time.h, where it belongs	*/#   endif#   if defined(FREEBSD) && !defined(CLOCKS_PER_SEC)#     include <machine/limits.h>#     define CLOCKS_PER_SEC CLK_TCK#   endif#   if !defined(CLOCKS_PER_SEC)#     define CLOCKS_PER_SEC 1000000/* * This is technically a bug in the implementation.  ANSI requires that * CLOCKS_PER_SEC be defined.  But at least under SunOS4.1.1, it isn't. * Also note that the combination of ANSI C and POSIX is incredibly gross * here. The type clock_t is used by both clock() and times().  But on * some machines these use different notions of a clock tick,  CLOCKS_PER_SEC * seems to apply only to clock.  Hence we use it here.  On many machines, * including SunOS, clock actually uses units of microseconds (which are * not really clock ticks). */#   endif#   define CLOCK_TYPE clock_t#   define GET_TIME(x) x = clock()#   define MS_TIME_DIFF(a,b) ((unsigned long) \		(1000.0*(double)((a)-(b))/(double)CLOCKS_PER_SEC))# endif /* !MSWIN32 */#endif /* !BSD_TIME *//* We use bzero and bcopy internally.  They may not be available.	*/# if defined(SPARC) && defined(SUNOS4)#   define BCOPY_EXISTS# endif# if defined(M68K) && defined(AMIGA)#   define BCOPY_EXISTS# endif# if defined(M68K) && defined(NEXT)#   define BCOPY_EXISTS# endif# if defined(VAX)#   define BCOPY_EXISTS# endif# if defined(AMIGA)#   include <string.h>#   define BCOPY_EXISTS# endif# if defined(MACOSX)#   define BCOPY_EXISTS# endif# ifndef BCOPY_EXISTS#   include <string.h>#   define BCOPY(x,y,n) memcpy(y, x, (size_t)(n))#   define BZERO(x,n)  memset(x, 0, (size_t)(n))# else#   define BCOPY(x,y,n) bcopy((char *)(x),(char *)(y),(int)(n))#   define BZERO(x,n) bzero((char *)(x),(int)(n))# endif/* HBLKSIZE aligned allocation.  0 is taken to mean failure 	*//* space is assumed to be cleared.				*//* In the case os USE_MMAP, the argument must also be a 	*//* physical page size.						*//* GET_MEM is currently not assumed to retrieve 0 filled space, */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -