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

📄 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 页
字号:
					/* this object.			*/#	define WAS_UNMAPPED 2	/* This is a free block, which has	*/				/* been unmapped from the address 	*/				/* space.				*/				/* GC_remap must be invoked on it	*/				/* before it can be reallocated.	*/				/* Only set with USE_MUNMAP.		*/    unsigned short hb_last_reclaimed;    				/* Value of GC_gc_no when block was	*/    				/* last allocated or swept. May wrap.   */				/* For a free block, this is maintained */				/* only for USE_MUNMAP, and indicates	*/				/* when the header was allocated, or	*/				/* when the size of the block last	*/				/* changed.				*/#   ifdef USE_MARK_BYTES      union {        char _hb_marks[MARK_BITS_SZ];			    /* The i'th byte is 1 if the object 	*/			    /* starting at word 2i is marked, 0 o.w.	*/	word dummy;	/* Force word alignment of mark bytes. */      } _mark_byte_union;#     define hb_marks _mark_byte_union._hb_marks#   else      word hb_marks[MARK_BITS_SZ];			    /* Bit i in the array refers to the             */			    /* object starting at the ith word (header      */			    /* INCLUDED) in the heap block.                 */			    /* The lsb of word 0 is numbered 0.		    */			    /* Unused bits are invalid, and are 	    */			    /* occasionally set, e.g for uncollectable	    */			    /* objects.					    */#   endif /* !USE_MARK_BYTES */};/*  heap block body */# define BODY_SZ (HBLKSIZE/sizeof(word))struct hblk {    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	*/    /* given sz (in words).						*//* Object free list link */# define obj_link(p) (*(ptr_t *)(p))# define LOG_MAX_MARK_PROCS 6# define MAX_MARK_PROCS (1 << LOG_MAX_MARK_PROCS)/* Root sets.  Logically private to mark_rts.c.  But we don't want the	*//* tables scanned, so we put them here.					*//* MAX_ROOT_SETS is the maximum number of ranges that can be 	*//* registered as static roots. 					*/# ifdef LARGE_CONFIG#   define MAX_ROOT_SETS 4096# else#   ifdef PCR#     define MAX_ROOT_SETS 1024#   else#     if defined(MSWIN32) || defined(MSWINCE)#	define MAX_ROOT_SETS 1024	    /* Under NT, we add only written pages, which can result 	*/	    /* in many small root sets.					*/#     else#       define MAX_ROOT_SETS 256#     endif#   endif# endif# define MAX_EXCLUSIONS (MAX_ROOT_SETS/4)/* Maximum number of segments that can be excluded from root sets.	*//* * Data structure for excluded static roots. */struct exclusion {    ptr_t e_start;    ptr_t e_end;};/* Data structure for list of root sets.				*//* We keep a hash table, so that we can filter out duplicate additions.	*//* Under Win32, we need to do a better job of filtering overlaps, so	*//* we resort to sequential search, and pay the price.			*/struct roots {	ptr_t r_start;	ptr_t r_end;#	if !defined(MSWIN32) && !defined(MSWINCE)	  struct roots * r_next;#	endif	GC_bool r_tmp;	  	/* Delete before registering new dynamic libraries */};#if !defined(MSWIN32) && !defined(MSWINCE)    /* Size of hash table index to roots.	*/#   define LOG_RT_SIZE 6#   define RT_SIZE (1 << LOG_RT_SIZE) /* Power of 2, may be != MAX_ROOT_SETS */#endif/* Lists of all heap blocks and free lists	*//* as well as other random data structures	*//* that should not be scanned by the		*//* collector.					*//* These are grouped together in a struct	*//* so that they can be easily skipped by the	*//* GC_mark routine.				*//* The ordering is weird to make GC_malloc	*//* faster by keeping the important fields	*//* sufficiently close together that a		*//* single load of a base register will do.	*//* Scalars that could easily appear to		*//* be pointers are also put here.		*//* The main fields should precede any 		*//* conditionally included fields, so that	*//* gc_inl.h will work even if a different set	*//* of macros is defined when the client is	*//* compiled.					*/struct _GC_arrays {  word _heapsize;  word _max_heapsize;  word _requested_heapsize;	/* Heap size due to explicit expansion */  ptr_t _last_heap_addr;  ptr_t _prev_heap_addr;  word _large_free_bytes;	/* Total bytes contained in blocks on large object free */	/* list.						*/  word _large_allocd_bytes;  	/* Total number of bytes in allocated large objects blocks.	*/  	/* For the purposes of this counter and the next one only, a 	*/  	/* large object is one that occupies a block of at least	*/  	/* 2*HBLKSIZE.							*/  word _max_large_allocd_bytes;  	/* Maximum number of bytes that were ever allocated in		*/  	/* large object blocks.  This is used to help decide when it	*/  	/* is safe to split up a large block.				*/  word _words_allocd_before_gc;		/* Number of words allocated before this	*/		/* collection cycle.				*/# ifndef SEPARATE_GLOBALS    word _words_allocd;  	/* Number of words allocated during this collection cycle */# endif  word _words_wasted;  	/* Number of words wasted due to internal fragmentation	*/  	/* in large objects, or due to dropping blacklisted     */	/* blocks, since last gc.  Approximate.                 */  word _words_finalized;  	/* Approximate number of words in objects (and headers)	*/  	/* That became ready for finalization in the last 	*/  	/* collection.						*/  word _non_gc_bytes_at_gc;  	/* Number of explicitly managed bytes of storage 	*/  	/* at last collection.					*/  word _mem_freed;  	/* Number of explicitly deallocated words of memory	*/  	/* since last collection.				*/  ptr_t _scratch_end_ptr;  ptr_t _scratch_last_end_ptr;	/* Used by headers.c, and can easily appear to point to	*/	/* heap.						*/  GC_mark_proc _mark_procs[MAX_MARK_PROCS];  	/* Table of user-defined mark procedures.  There is	*/	/* a small number of these, which can be referenced	*/	/* by DS_PROC mark descriptors.  See gc_mark.h.		*/# ifndef SEPARATE_GLOBALS    ptr_t _objfreelist[MAXOBJSZ+1];			  /* free list for objects */    ptr_t _aobjfreelist[MAXOBJSZ+1];			  /* free list for atomic objs 	*/# endif  ptr_t _uobjfreelist[MAXOBJSZ+1];			  /* uncollectable but traced objs 	*/			  /* objects on this and auobjfreelist  */			  /* are always marked, except during   */			  /* garbage collections.		*/# ifdef ATOMIC_UNCOLLECTABLE    ptr_t _auobjfreelist[MAXOBJSZ+1];# endif			  /* uncollectable but traced objs 	*/# ifdef GATHERSTATS    word _composite_in_use;   		/* Number of words in accessible composite	*/		/* objects.					*/    word _atomic_in_use;   		/* Number of words in accessible atomic		*/		/* objects.					*/# endif# ifdef USE_MUNMAP    word _unmapped_bytes;# endif# ifdef MERGE_SIZES    unsigned _size_map[WORDS_TO_BYTES(MAXOBJSZ+1)];    	/* Number of words to allocate for a given allocation request in */    	/* bytes.							 */# endif # ifdef STUBBORN_ALLOC    ptr_t _sobjfreelist[MAXOBJSZ+1];# endif  			  /* free list for immutable objects	*/  map_entry_type * _obj_map[MAXOBJSZ+1];                       /* If not NIL, then a pointer to a map of valid  */    		       /* object addresses. _obj_map[sz][i] is j if the	*/    		       /* address block_start+i is a valid pointer      */    		       /* to an object at block_start +			*/ 		       /* WORDS_TO_BYTES(BYTES_TO_WORDS(i) - j)		*/  		       /* I.e. j is a word displacement from the	*/  		       /* object beginning.				*/  		       /* The entry is OBJ_INVALID if the corresponding	*/  		       /* address is not a valid pointer.  It is 	*/  		       /* OFFSET_TOO_BIG if the value j would be too 	*/  		       /* large to fit in the entry.  (Note that the	*/  		       /* size of these entries matters, both for 	*/  		       /* space consumption and for cache utilization.	*/#   define OFFSET_TOO_BIG 0xfe#   define OBJ_INVALID 0xff#   define MAP_ENTRY(map, bytes) (map)[bytes]#   define MAP_ENTRIES HBLKSIZE#   define MAP_SIZE MAP_ENTRIES#   define CPP_MAX_OFFSET (OFFSET_TOO_BIG - 1)	#   define MAX_OFFSET ((word)CPP_MAX_OFFSET)    /* The following are used only if GC_all_interior_ptrs != 0 */# 	define VALID_OFFSET_SZ \	  (CPP_MAX_OFFSET > WORDS_TO_BYTES(CPP_MAXOBJSZ)? \	   CPP_MAX_OFFSET+1 \	   : WORDS_TO_BYTES(CPP_MAXOBJSZ)+1)  	char _valid_offsets[VALID_OFFSET_SZ];				/* GC_valid_offsets[i] == TRUE ==> i 	*/				/* is registered as a displacement.	*/#	define OFFSET_VALID(displ) \	  (GC_all_interior_pointers || GC_valid_offsets[displ])  	char _modws_valid_offsets[sizeof(word)];				/* GC_valid_offsets[i] ==>		  */				/* GC_modws_valid_offsets[i%sizeof(word)] */# ifdef STUBBORN_ALLOC    page_hash_table _changed_pages;        /* Stubborn object pages that were changes since last call to	*/	/* GC_read_changed.						*/    page_hash_table _prev_changed_pages;        /* Stubborn object pages that were changes before last call to	*/	/* GC_read_changed.						*/# endif# if defined(PROC_VDB) || defined(MPROTECT_VDB)    page_hash_table _grungy_pages; /* Pages that were dirty at last 	   */				     /* GC_read_dirty.			   */# endif# ifdef MPROTECT_VDB    VOLATILE page_hash_table _dirty_pages;				/* Pages dirtied since last GC_read_dirty. */# endif# ifdef PROC_VDB    page_hash_table _written_pages;	/* Pages ever dirtied	*/# endif# ifdef LARGE_CONFIG#   if CPP_WORDSZ > 32#     define MAX_HEAP_SECTS 4096 	/* overflows at roughly 64 GB	   */#   else#     define MAX_HEAP_SECTS 768		/* Separately added heap sections. */#   endif# else#   ifdef SMALL_CONFIG#     define MAX_HEAP_SECTS 128		/* Roughly 1GB			*/#   else#     define MAX_HEAP_SECTS 384		/* Roughly 3GB			*/#   endif# endif  struct HeapSect {      ptr_t hs_start; word hs_bytes;  } _heap_sects[MAX_HEAP_SECTS];# if defined(MSWIN32) || defined(MSWINCE)    ptr_t _heap_bases[MAX_HEAP_SECTS];    		/* Start address of memory regions obtained from kernel. */# endif# ifdef MSWINCE    word _heap_lengths[MAX_HEAP_SECTS];    		/* Commited lengths of memory regions obtained from kernel. */# endif  struct roots _static_roots[MAX_ROOT_SETS];# if !defined(MSWIN32) && !defined(MSWINCE)    struct roots * _root_index[RT_SIZE];# endif  struct exclusion _excl_table[MAX_EXCLUSIONS];  /* Block header index; see gc_headers.h */  bottom_index * _all_nils;  bottom_index * _top_index [TOP_SZ];#ifdef SAVE_CALL_CHAIN  struct callinfo _last_stack[NFRAMES];	/* Stack at last garbage collection.*/  					/* Useful for debugging	mysterious  */  					/* object disappearances.	    */  					/* In the multithreaded case, we    */  					/* currently only save the calling  */  					/* stack.			    */#endif};GC_API GC_FAR struct _GC_arrays GC_arrays; # ifndef SEPARATE_GLOBALS#   define GC_objfreelist GC_arrays._objfreelist#   define GC_aobjfreelist GC_arrays._aobjfreelist#   define GC_words_allocd GC_arrays._words_allocd# endif# define GC_uobjfreelist GC_arrays._uobjfreelist# ifdef ATOMIC_UNCOLLECTABLE#   define GC_auobjfreelist GC_arrays._auobjfreelist# endif# define GC_sobjfreelist GC_arrays._sobjfreelist# define GC_valid_offsets GC_arrays._valid_offsets# define GC_modws_valid_offsets GC_arrays._modws_valid_offsets# ifdef STUBBORN_ALLOC#    define GC_changed_pages GC_arrays._changed_pages#    define GC_prev_changed_pages GC_arrays._prev_changed_pages# endif# define GC_obj_map GC_arrays._obj_map# define GC_last_heap_addr GC_arrays._last_heap_addr# define GC_prev_heap_addr GC_arrays._prev_heap_addr# define GC_words_wasted GC_arrays._words_wasted# define GC_large_free_bytes GC_arrays._large_free_bytes# define GC_large_allocd_bytes GC_arrays._large_allocd_bytes# define GC_max_large_allocd_bytes GC_arrays._max_large_allocd_bytes# define GC_words_finalized GC_arrays._words_finalized# define GC_non_gc_bytes_at_gc GC_arrays._non_gc_bytes_at_gc# define GC_mem_freed GC_arrays._mem_freed# define GC_scratch_end_ptr GC_arrays._scratch_end_ptr# define GC_scratch_last_end_ptr GC_arrays._scratch_last_end_ptr# define GC_mark_procs GC_arrays._mark_procs# define GC_heapsize GC_arrays._heapsize# define GC_max_heapsize GC_arrays._max_heapsize# define GC_requested_heapsize GC_arrays._requested_heapsize# define GC_words_allocd_before_gc GC_arrays._words_allocd_before_gc# define GC_heap_sects GC_arrays._heap_sects# define GC_last_stack GC_arrays._last_stack# ifdef USE_MUNMAP#   define GC_unmapped_bytes GC_arrays._unmapped_bytes# endif# if defined(MSWIN32) || defined(MSWINCE)#   define GC_heap_bases GC_arrays._heap_bases# endif# ifdef MSWINCE#   define GC_heap_lengths GC_arrays._heap_lengths# endif# define GC_static_roots GC_arrays._static_roots# define GC_root_index GC_arrays._root_index# define GC_excl_table GC_arrays._excl_table# define GC_all_nils GC_arrays._all_nils# define GC_top_index GC_arrays._top_index# if defined(PROC_VDB) || defined(MPROTECT_VDB)#   define GC_grungy_pages GC_arrays._grungy_pages# endif# ifdef MPROTECT_VDB#   define GC_dirty_pages GC_arrays._dirty_pages# endif# ifdef PROC_VDB#   define GC_written_pages GC_arrays._written_pages# endif

⌨️ 快捷键说明

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