diff options
author | aj <aj@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-06-07 18:35:35 +0000 |
---|---|---|
committer | aj <aj@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-06-07 18:35:35 +0000 |
commit | 6ec1f4e023b5e2ec844a490e0a9364bacdab0c05 (patch) | |
tree | e38d1bc08b7ca1fda6e483c32e4bc387f3fc87a9 | |
parent | a3cef0cf3594b7f7e54cad0fabd05584daf96849 (diff) | |
download | gcc-6ec1f4e023b5e2ec844a490e0a9364bacdab0c05.tar.gz |
* ggc.h: Convert to ISO C90 prototypes.
* ggc-none.c: Likewise.
* ggc-common.c: Likewise.
* ggc-page.c: Likewise.
* ggc-simple.c: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@67596 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ggc-common.c | 156 | ||||
-rw-r--r-- | gcc/ggc-none.c | 13 | ||||
-rw-r--r-- | gcc/ggc-page.c | 214 | ||||
-rw-r--r-- | gcc/ggc-simple.c | 125 | ||||
-rw-r--r-- | gcc/ggc.h | 114 |
6 files changed, 264 insertions, 364 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2938fa32db8..b7925e5fcad 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2003-06-07 Andreas Jaeger <aj@suse.de> + * ggc.h: Convert to ISO C90 prototypes. + * ggc-none.c: Likewise. + * ggc-common.c: Likewise. + * ggc-page.c: Likewise. + * ggc-simple.c: Likewise. + * crtstuff.c: Remove undefined usage of INIT_SECTION_PREAMBLE. * system.h: Poison INIT_SECTION_PREAMBLE. diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c index adf2fd0decb..8e5be8ca299 100644 --- a/gcc/ggc-common.c +++ b/gcc/ggc-common.c @@ -54,25 +54,23 @@ static ggc_statistics *ggc_stats; struct traversal_state; -static int ggc_htab_delete PARAMS ((void **, void *)); -static hashval_t saving_htab_hash PARAMS ((const PTR)); -static int saving_htab_eq PARAMS ((const PTR, const PTR)); -static int call_count PARAMS ((void **, void *)); -static int call_alloc PARAMS ((void **, void *)); -static int compare_ptr_data PARAMS ((const void *, const void *)); -static void relocate_ptrs PARAMS ((void *, void *)); -static void write_pch_globals PARAMS ((const struct ggc_root_tab * const *tab, - struct traversal_state *state)); -static double ggc_rlimit_bound PARAMS ((double)); +static int ggc_htab_delete (void **, void *); +static hashval_t saving_htab_hash (const void *); +static int saving_htab_eq (const void *, const void *); +static int call_count (void **, void *); +static int call_alloc (void **, void *); +static int compare_ptr_data (const void *, const void *); +static void relocate_ptrs (void *, void *); +static void write_pch_globals (const struct ggc_root_tab * const *tab, + struct traversal_state *state); +static double ggc_rlimit_bound (double); /* Maintain global roots that are preserved during GC. */ /* Process a slot of an htab by deleting it if it has not been marked. */ static int -ggc_htab_delete (slot, info) - void **slot; - void *info; +ggc_htab_delete (void **slot, void *info) { const struct ggc_cache_tab *r = (const struct ggc_cache_tab *) info; @@ -87,7 +85,7 @@ ggc_htab_delete (slot, info) /* Iterate through all registered roots and mark each element. */ void -ggc_mark_roots () +ggc_mark_roots (void) { const struct ggc_root_tab *const *rt; const struct ggc_root_tab *rti; @@ -113,15 +111,14 @@ ggc_mark_roots () if (*cti->base) { ggc_set_mark (*cti->base); - htab_traverse_noresize (*cti->base, ggc_htab_delete, (PTR) cti); + htab_traverse_noresize (*cti->base, ggc_htab_delete, (void *) cti); ggc_set_mark ((*cti->base)->entries); } } /* Allocate a block of memory, then clear it. */ void * -ggc_alloc_cleared (size) - size_t size; +ggc_alloc_cleared (size_t size) { void *buf = ggc_alloc (size); memset (buf, 0, size); @@ -130,9 +127,7 @@ ggc_alloc_cleared (size) /* Resize a block of memory, possibly re-allocating it. */ void * -ggc_realloc (x, size) - void *x; - size_t size; +ggc_realloc (void *x, size_t size) { void *r; size_t old_size; @@ -150,7 +145,7 @@ ggc_realloc (x, size) don't know that previously allocated size. Without that knowledge we have to lose some initialization-tracking for the old parts of the object. An alternative is to mark the whole - old_size as reachable, but that would lose tracking of writes + old_size as reachable, but that would lose tracking of writes after the end of the object (by small offsets). Discard the handle to avoid handle leak. */ VALGRIND_DISCARD (VALGRIND_MAKE_NOACCESS ((char *) x + size, @@ -177,17 +172,14 @@ ggc_realloc (x, size) /* Like ggc_alloc_cleared, but performs a multiplication. */ void * -ggc_calloc (s1, s2) - size_t s1, s2; +ggc_calloc (size_t s1, size_t s2) { return ggc_alloc_cleared (s1 * s2); } /* These are for splay_tree_new_ggc. */ -PTR -ggc_splay_alloc (sz, nl) - int sz; - PTR nl; +void * +ggc_splay_alloc (int sz, void *nl) { if (nl != NULL) abort (); @@ -195,9 +187,7 @@ ggc_splay_alloc (sz, nl) } void -ggc_splay_dont_free (x, nl) - PTR x ATTRIBUTE_UNUSED; - PTR nl; +ggc_splay_dont_free (void * x ATTRIBUTE_UNUSED, void *nl) { if (nl != NULL) abort (); @@ -212,9 +202,8 @@ ggc_splay_dont_free (x, nl) #define LABEL(x) ((x) < 1024*10 ? ' ' : ((x) < 1024*1024*10 ? 'k' : 'M')) void -ggc_print_common_statistics (stream, stats) - FILE *stream ATTRIBUTE_UNUSED; - ggc_statistics *stats; +ggc_print_common_statistics (FILE *stream ATTRIBUTE_UNUSED, + ggc_statistics *stats) { /* Set the pointer so that during collection we will actually gather the statistics. */ @@ -233,7 +222,7 @@ ggc_print_common_statistics (stream, stats) static htab_t saving_htab; -struct ptr_data +struct ptr_data { void *obj; void *note_ptr_cookie; @@ -248,13 +237,11 @@ struct ptr_data /* Register an object in the hash table. */ int -gt_pch_note_object (obj, note_ptr_cookie, note_ptr_fn) - void *obj; - void *note_ptr_cookie; - gt_note_pointers note_ptr_fn; +gt_pch_note_object (void *obj, void *note_ptr_cookie, + gt_note_pointers note_ptr_fn) { struct ptr_data **slot; - + if (obj == NULL || obj == (void *) 1) return 0; @@ -268,7 +255,7 @@ gt_pch_note_object (obj, note_ptr_cookie, note_ptr_fn) abort (); return 0; } - + *slot = xcalloc (sizeof (struct ptr_data), 1); (*slot)->obj = obj; (*slot)->note_ptr_fn = note_ptr_fn; @@ -283,13 +270,11 @@ gt_pch_note_object (obj, note_ptr_cookie, note_ptr_fn) /* Register an object in the hash table. */ void -gt_pch_note_reorder (obj, note_ptr_cookie, reorder_fn) - void *obj; - void *note_ptr_cookie; - gt_handle_reorder reorder_fn; +gt_pch_note_reorder (void *obj, void *note_ptr_cookie, + gt_handle_reorder reorder_fn) { struct ptr_data *data; - + if (obj == NULL || obj == (void *) 1) return; @@ -297,30 +282,27 @@ gt_pch_note_reorder (obj, note_ptr_cookie, reorder_fn) if (data == NULL || data->note_ptr_cookie != note_ptr_cookie) abort (); - + data->reorder_fn = reorder_fn; } /* Hash and equality functions for saving_htab, callbacks for htab_create. */ static hashval_t -saving_htab_hash (p) - const PTR p; +saving_htab_hash (const void *p) { return POINTER_HASH (((struct ptr_data *)p)->obj); } static int -saving_htab_eq (p1, p2) - const PTR p1; - const PTR p2; +saving_htab_eq (const void *p1, const void *p2) { return ((struct ptr_data *)p1)->obj == p2; } /* Handy state for the traversal functions. */ -struct traversal_state +struct traversal_state { FILE *f; struct ggc_pch_data *d; @@ -332,26 +314,22 @@ struct traversal_state /* Callbacks for htab_traverse. */ static int -call_count (slot, state_p) - void **slot; - void *state_p; +call_count (void **slot, void *state_p) { struct ptr_data *d = (struct ptr_data *)*slot; struct traversal_state *state = (struct traversal_state *)state_p; - + ggc_pch_count_object (state->d, d->obj, d->size); state->count++; return 1; } static int -call_alloc (slot, state_p) - void **slot; - void *state_p; +call_alloc (void **slot, void *state_p) { struct ptr_data *d = (struct ptr_data *)*slot; struct traversal_state *state = (struct traversal_state *)state_p; - + d->new_addr = ggc_pch_alloc_object (state->d, d->obj, d->size); state->ptrs[state->ptrs_i++] = d; return 1; @@ -360,9 +338,7 @@ call_alloc (slot, state_p) /* Callback for qsort. */ static int -compare_ptr_data (p1_p, p2_p) - const void *p1_p; - const void *p2_p; +compare_ptr_data (const void *p1_p, const void *p2_p) { struct ptr_data *p1 = *(struct ptr_data *const *)p1_p; struct ptr_data *p2 = *(struct ptr_data *const *)p2_p; @@ -373,18 +349,16 @@ compare_ptr_data (p1_p, p2_p) /* Callbacks for note_ptr_fn. */ static void -relocate_ptrs (ptr_p, state_p) - void *ptr_p; - void *state_p; +relocate_ptrs (void *ptr_p, void *state_p) { void **ptr = (void **)ptr_p; - struct traversal_state *state ATTRIBUTE_UNUSED + struct traversal_state *state ATTRIBUTE_UNUSED = (struct traversal_state *)state_p; struct ptr_data *result; if (*ptr == NULL || *ptr == (void *)1) return; - + result = htab_find_with_hash (saving_htab, *ptr, POINTER_HASH (*ptr)); if (result == NULL) abort (); @@ -393,9 +367,8 @@ relocate_ptrs (ptr_p, state_p) /* Write out, after relocation, the pointers in TAB. */ static void -write_pch_globals (tab, state) - const struct ggc_root_tab * const *tab; - struct traversal_state *state; +write_pch_globals (const struct ggc_root_tab * const *tab, + struct traversal_state *state) { const struct ggc_root_tab *const *rt; const struct ggc_root_tab *rti; @@ -409,15 +382,15 @@ write_pch_globals (tab, state) struct ptr_data *new_ptr; if (ptr == NULL || ptr == (void *)1) { - if (fwrite (&ptr, sizeof (void *), 1, state->f) + if (fwrite (&ptr, sizeof (void *), 1, state->f) != 1) fatal_error ("can't write PCH file: %m"); } else { - new_ptr = htab_find_with_hash (saving_htab, ptr, + new_ptr = htab_find_with_hash (saving_htab, ptr, POINTER_HASH (ptr)); - if (fwrite (&new_ptr->new_addr, sizeof (void *), 1, state->f) + if (fwrite (&new_ptr->new_addr, sizeof (void *), 1, state->f) != 1) fatal_error ("can't write PCH file: %m"); } @@ -426,7 +399,7 @@ write_pch_globals (tab, state) /* Hold the information we need to mmap the file back in. */ -struct mmap_info +struct mmap_info { size_t offset; size_t size; @@ -436,8 +409,7 @@ struct mmap_info /* Write out the state of the compiler to F. */ void -gt_pch_save (f) - FILE *f; +gt_pch_save (FILE *f) { const struct ggc_root_tab *const *rt; const struct ggc_root_tab *rti; @@ -474,7 +446,7 @@ gt_pch_save (f) but don't try very hard. On most platforms, this will always work, and on the rest it's a lot of work to do better. */ #if HAVE_MMAP_FILE - mmi.preferred_base = mmap (NULL, mmi.size, + mmi.preferred_base = mmap (NULL, mmi.size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fileno (state.f), 0); if (mmi.preferred_base == (void *)-1) @@ -503,7 +475,7 @@ gt_pch_save (f) write_pch_globals (gt_pch_cache_rtab, &state); ggc_pch_prepare_write (state.d, state.f); - + /* Pad the PCH file so that the mmaped area starts on a page boundary. */ { long o; @@ -531,10 +503,10 @@ gt_pch_save (f) } memcpy (this_object, state.ptrs[i]->obj, state.ptrs[i]->size); if (state.ptrs[i]->reorder_fn != NULL) - state.ptrs[i]->reorder_fn (state.ptrs[i]->obj, + state.ptrs[i]->reorder_fn (state.ptrs[i]->obj, state.ptrs[i]->note_ptr_cookie, relocate_ptrs, &state); - state.ptrs[i]->note_ptr_fn (state.ptrs[i]->obj, + state.ptrs[i]->note_ptr_fn (state.ptrs[i]->obj, state.ptrs[i]->note_ptr_cookie, relocate_ptrs, &state); ggc_pch_write_object (state.d, state.f, state.ptrs[i]->obj, @@ -552,8 +524,7 @@ gt_pch_save (f) /* Read the state of the compiler back in from F. */ void -gt_pch_restore (f) - FILE *f; +gt_pch_restore (FILE *f) { const struct ggc_root_tab *const *rt; const struct ggc_root_tab *rti; @@ -591,9 +562,9 @@ gt_pch_restore (f) if (fread (&mmi, sizeof (mmi), 1, f) != 1) fatal_error ("can't read PCH file: %m"); - + #if HAVE_MMAP_FILE - addr = mmap (mmi.preferred_base, mmi.size, + addr = mmap (mmi.preferred_base, mmi.size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fileno (f), mmi.offset); #else @@ -621,7 +592,7 @@ gt_pch_restore (f) if (*ptr != NULL) *ptr += (size_t)addr - (size_t)mmi.preferred_base; } - + for (rt = gt_pch_cache_rtab; *rt; rt++) for (rti = *rt; rti->base != NULL; rti++) for (i = 0; i < rti->nelt; i++) @@ -639,8 +610,7 @@ gt_pch_restore (f) /* Modify the bound based on rlimits. Keep the smallest number found. */ static double -ggc_rlimit_bound (limit) - double limit; +ggc_rlimit_bound (double limit) { #if defined(HAVE_GETRLIMIT) struct rlimit rlim; @@ -669,13 +639,13 @@ ggc_rlimit_bound (limit) /* Heuristic to set a default for GGC_MIN_EXPAND. */ int -ggc_min_expand_heuristic() +ggc_min_expand_heuristic (void) { double min_expand = physmem_total(); /* Adjust for rlimits. */ min_expand = ggc_rlimit_bound (min_expand); - + /* The heuristic is a percentage equal to 30% + 70%*(RAM/1GB), yielding a lower bound of 30% and an upper bound of 100% (when RAM >= 1GB). */ min_expand /= 1024*1024*1024; @@ -688,7 +658,7 @@ ggc_min_expand_heuristic() /* Heuristic to set a default for GGC_MIN_HEAPSIZE. */ int -ggc_min_heapsize_heuristic() +ggc_min_heapsize_heuristic (void) { double min_heap_kbytes = physmem_total(); @@ -696,7 +666,7 @@ ggc_min_heapsize_heuristic() min_heap_kbytes = ggc_rlimit_bound (min_heap_kbytes); min_heap_kbytes /= 1024; /* convert to Kbytes. */ - + /* The heuristic is RAM/8, with a lower bound of 4M and an upper bound of 128M (when RAM >= 1GB). */ min_heap_kbytes /= 8; @@ -707,7 +677,7 @@ ggc_min_heapsize_heuristic() } void -init_ggc_heuristics () +init_ggc_heuristics (void) { #ifndef ENABLE_GC_ALWAYS_COLLECT set_param_value ("ggc-min-expand", ggc_min_expand_heuristic()); diff --git a/gcc/ggc-none.c b/gcc/ggc-none.c index ceb1f4498f1..ee53e761a85 100644 --- a/gcc/ggc-none.c +++ b/gcc/ggc-none.c @@ -1,5 +1,6 @@ /* Null garbage collection for the GNU compiler. - Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2003 + Free Software Foundation, Inc. This file is part of GCC. @@ -29,23 +30,19 @@ #include "ggc.h" void * -ggc_alloc (size) - size_t size; +ggc_alloc (size_t size) { return xmalloc (size); } void * -ggc_alloc_cleared (size) - size_t size; +ggc_alloc_cleared (size_t size) { return xcalloc (size, 1); } void * -ggc_realloc (x, size) - void *x; - size_t size; +ggc_realloc (void *x, size_t size) { return xrealloc (x, size); } diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c index ec1a583574b..929ef8e41cc 100644 --- a/gcc/ggc-page.c +++ b/gcc/ggc-page.c @@ -420,40 +420,39 @@ static struct globals /* Initial guess as to how many page table entries we might need. */ #define INITIAL_PTE_COUNT 128 -static int ggc_allocated_p PARAMS ((const void *)); -static page_entry *lookup_page_table_entry PARAMS ((const void *)); -static void set_page_table_entry PARAMS ((void *, page_entry *)); +static int ggc_allocated_p (const void *); +static page_entry *lookup_page_table_entry (const void *); +static void set_page_table_entry (void *, page_entry *); #ifdef USING_MMAP -static char *alloc_anon PARAMS ((char *, size_t)); +static char *alloc_anon (char *, size_t); #endif #ifdef USING_MALLOC_PAGE_GROUPS -static size_t page_group_index PARAMS ((char *, char *)); -static void set_page_group_in_use PARAMS ((page_group *, char *)); -static void clear_page_group_in_use PARAMS ((page_group *, char *)); +static size_t page_group_index (char *, char *); +static void set_page_group_in_use (page_group *, char *); +static void clear_page_group_in_use (page_group *, char *); #endif -static struct page_entry * alloc_page PARAMS ((unsigned)); -static void free_page PARAMS ((struct page_entry *)); -static void release_pages PARAMS ((void)); -static void clear_marks PARAMS ((void)); -static void sweep_pages PARAMS ((void)); -static void ggc_recalculate_in_use_p PARAMS ((page_entry *)); -static void compute_inverse PARAMS ((unsigned)); -static inline void adjust_depth PARAMS ((void)); -static void move_ptes_to_front PARAMS ((int, int)); +static struct page_entry * alloc_page (unsigned); +static void free_page (struct page_entry *); +static void release_pages (void); +static void clear_marks (void); +static void sweep_pages (void); +static void ggc_recalculate_in_use_p (page_entry *); +static void compute_inverse (unsigned); +static inline void adjust_depth (void); +static void move_ptes_to_front (int, int); #ifdef ENABLE_GC_CHECKING -static void poison_pages PARAMS ((void)); +static void poison_pages (void); #endif -void debug_print_page_list PARAMS ((int)); -static void push_depth PARAMS ((unsigned int)); -static void push_by_depth PARAMS ((page_entry *, unsigned long *)); +void debug_print_page_list (int); +static void push_depth (unsigned int); +static void push_by_depth (page_entry *, unsigned long *); /* Push an entry onto G.depth. */ inline static void -push_depth (i) - unsigned int i; +push_depth (unsigned int i) { if (G.depth_in_use >= G.depth_max) { @@ -467,9 +466,7 @@ push_depth (i) /* Push an entry onto G.by_depth and G.save_in_use. */ inline static void -push_by_depth (p, s) - page_entry *p; - unsigned long *s; +push_by_depth (page_entry *p, unsigned long *s) { if (G.by_depth_in_use >= G.by_depth_max) { @@ -497,8 +494,7 @@ push_by_depth (p, s) /* Returns nonzero if P was allocated in GC'able memory. */ static inline int -ggc_allocated_p (p) - const void *p; +ggc_allocated_p (const void *p) { page_entry ***base; size_t L1, L2; @@ -530,8 +526,7 @@ ggc_allocated_p (p) Die (probably) if the object wasn't allocated via GC. */ static inline page_entry * -lookup_page_table_entry(p) - const void *p; +lookup_page_table_entry (const void *p) { page_entry ***base; size_t L1, L2; @@ -556,9 +551,7 @@ lookup_page_table_entry(p) /* Set the page table entry for a page. */ static void -set_page_table_entry(p, entry) - void *p; - page_entry *entry; +set_page_table_entry (void *p, page_entry *entry) { page_entry ***base; size_t L1, L2; @@ -594,16 +587,15 @@ found: /* Prints the page-entry for object size ORDER, for debugging. */ void -debug_print_page_list (order) - int order; +debug_print_page_list (int order) { page_entry *p; - printf ("Head=%p, Tail=%p:\n", (PTR) G.pages[order], - (PTR) G.page_tails[order]); + printf ("Head=%p, Tail=%p:\n", (void *) G.pages[order], + (void *) G.page_tails[order]); p = G.pages[order]; while (p != NULL) { - printf ("%p(%1d|%3d) -> ", (PTR) p, p->context_depth, + printf ("%p(%1d|%3d) -> ", (void *) p, p->context_depth, p->num_free_objects); p = p->next; } @@ -617,9 +609,7 @@ debug_print_page_list (order) compile error unless exactly one of the HAVE_* is defined. */ static inline char * -alloc_anon (pref, size) - char *pref ATTRIBUTE_UNUSED; - size_t size; +alloc_anon (char *pref ATTRIBUTE_UNUSED, size_t size) { #ifdef HAVE_MMAP_ANON char *page = (char *) mmap (pref, size, PROT_READ | PROT_WRITE, @@ -651,8 +641,7 @@ alloc_anon (pref, size) /* Compute the index for this page into the page group. */ static inline size_t -page_group_index (allocation, page) - char *allocation, *page; +page_group_index (char *allocation, char *page) { return (size_t) (page - allocation) >> G.lg_pagesize; } @@ -660,17 +649,13 @@ page_group_index (allocation, page) /* Set and clear the in_use bit for this page in the page group. */ static inline void -set_page_group_in_use (group, page) - page_group *group; - char *page; +set_page_group_in_use (page_group *group, char *page) { group->in_use |= 1 << page_group_index (group->allocation, page); } static inline void -clear_page_group_in_use (group, page) - page_group *group; - char *page; +clear_page_group_in_use (page_group *group, char *page) { group->in_use &= ~(1 << page_group_index (group->allocation, page)); } @@ -681,8 +666,7 @@ clear_page_group_in_use (group, page) appropriate page_table list. */ static inline struct page_entry * -alloc_page (order) - unsigned order; +alloc_page (unsigned order) { struct page_entry *entry, *p, **pp; char *page; @@ -855,7 +839,7 @@ alloc_page (order) if (GGC_DEBUG_LEVEL >= 2) fprintf (G.debug_file, "Allocating page at %p, object size=%lu, data %p-%p\n", - (PTR) entry, (unsigned long) OBJECT_SIZE (order), page, + (void *) entry, (unsigned long) OBJECT_SIZE (order), page, page + entry_size - 1); return entry; @@ -865,7 +849,7 @@ alloc_page (order) used by the top of the G.by_depth is used. */ static inline void -adjust_depth () +adjust_depth (void) { page_entry *top; @@ -884,12 +868,11 @@ adjust_depth () /* For a page that is no longer needed, put it on the free page list. */ static inline void -free_page (entry) - page_entry *entry; +free_page (page_entry *entry) { if (GGC_DEBUG_LEVEL >= 2) fprintf (G.debug_file, - "Deallocating page at %p, data %p-%p\n", (PTR) entry, + "Deallocating page at %p, data %p-%p\n", (void *) entry, entry->page, entry->page + entry->bytes - 1); /* Mark the page as inaccessible. Discard the handle to avoid handle @@ -933,7 +916,7 @@ free_page (entry) /* Release the free page cache to the system. */ static void -release_pages () +release_pages (void) { #ifdef USING_MMAP page_entry *p, *next; @@ -1021,8 +1004,7 @@ static unsigned char size_lookup[257] = /* Allocate a chunk of memory of SIZE bytes. Its contents are undefined. */ void * -ggc_alloc (size) - size_t size; +ggc_alloc (size_t size) { unsigned order, word, bit, object_offset; struct page_entry *entry; @@ -1149,7 +1131,7 @@ ggc_alloc (size) fprintf (G.debug_file, "Allocating object, requested size=%lu, actual=%lu at %p on %p\n", (unsigned long) size, (unsigned long) OBJECT_SIZE (order), result, - (PTR) entry); + (void *) entry); return result; } @@ -1159,8 +1141,7 @@ ggc_alloc (size) static objects, stack variables, or memory allocated with malloc. */ int -ggc_set_mark (p) - const void *p; +ggc_set_mark (const void *p) { page_entry *entry; unsigned bit, word; @@ -1199,8 +1180,7 @@ ggc_set_mark (p) static objects, stack variables, or memory allocated with malloc. */ int -ggc_marked_p (p) - const void *p; +ggc_marked_p (const void *p) { page_entry *entry; unsigned bit, word; @@ -1226,8 +1206,7 @@ ggc_marked_p (p) /* Return the size of the gc-able object P. */ size_t -ggc_get_size (p) - const void *p; +ggc_get_size (const void *p) { page_entry *pe = lookup_page_table_entry (p); return OBJECT_SIZE (pe->order); @@ -1242,8 +1221,7 @@ ggc_get_size (p) constants). */ static void -compute_inverse (order) - unsigned order; +compute_inverse (unsigned order) { unsigned size, inv, e; @@ -1277,7 +1255,7 @@ compute_inverse (order) /* Initialize the ggc-mmap allocator. */ void -init_ggc () +init_ggc (void) { unsigned order; @@ -1373,7 +1351,7 @@ init_ggc () are never freed, eliminating the need to register their roots. */ void -ggc_push_context () +ggc_push_context (void) { ++G.context_depth; @@ -1386,8 +1364,7 @@ ggc_push_context () reflects reality. Recalculate NUM_FREE_OBJECTS as well. */ static void -ggc_recalculate_in_use_p (p) - page_entry *p; +ggc_recalculate_in_use_p (page_entry *p) { unsigned int i; size_t num_objects; @@ -1424,7 +1401,7 @@ ggc_recalculate_in_use_p (p) previous ggc_push_context are migrated to the outer context. */ void -ggc_pop_context () +ggc_pop_context (void) { unsigned long omask; unsigned int depth, i, e; @@ -1451,7 +1428,7 @@ ggc_pop_context () /* We might not have any PTEs of depth depth. */ if (depth < G.depth_in_use) - { + { /* First we go through all the pages at depth depth to recalculate the in use bits. */ @@ -1520,7 +1497,7 @@ ggc_pop_context () /* Unmark all objects. */ static inline void -clear_marks () +clear_marks (void) { unsigned order; @@ -1565,7 +1542,7 @@ clear_marks () because the `mark' bit doubles as an `unused' bit. */ static inline void -sweep_pages () +sweep_pages (void) { unsigned order; @@ -1591,7 +1568,7 @@ sweep_pages () /* Loop until all entries have been examined. */ done = (p == last); - + num_objects = OBJECTS_IN_PAGE (p); /* Add all live objects on this page to the count of @@ -1674,7 +1651,7 @@ sweep_pages () /* Clobber all free objects. */ static inline void -poison_pages () +poison_pages (void) { unsigned order; @@ -1724,7 +1701,7 @@ poison_pages () /* Top level mark-and-sweep routine. */ void -ggc_collect () +ggc_collect (void) { /* Avoid frequent unnecessary work by skipping collection if the total allocations haven't expanded much since the last @@ -1778,7 +1755,7 @@ ggc_collect () #define LABEL(x) ((x) < 1024*10 ? ' ' : ((x) < 1024*1024*10 ? 'k' : 'M')) void -ggc_print_statistics () +ggc_print_statistics (void) { struct ggc_statistics stats; unsigned int i; @@ -1820,7 +1797,7 @@ ggc_print_statistics () for (p = G.pages[i]; p; p = p->next) { allocated += p->bytes; - in_use += + in_use += (OBJECTS_IN_PAGE (p) - p->num_free_objects) * OBJECT_SIZE (i); overhead += (sizeof (page_entry) - sizeof (long) @@ -1841,7 +1818,7 @@ ggc_print_statistics () struct ggc_pch_data { - struct ggc_pch_ondisk + struct ggc_pch_ondisk { unsigned totals[NUM_ORDERS]; } d; @@ -1850,16 +1827,14 @@ struct ggc_pch_data }; struct ggc_pch_data * -init_ggc_pch () +init_ggc_pch (void) { return xcalloc (sizeof (struct ggc_pch_data), 1); } -void -ggc_pch_count_object (d, x, size) - struct ggc_pch_data *d; - void *x ATTRIBUTE_UNUSED; - size_t size; +void +ggc_pch_count_object (struct ggc_pch_data *d, void *x ATTRIBUTE_UNUSED, + size_t size) { unsigned order; @@ -1871,13 +1846,12 @@ ggc_pch_count_object (d, x, size) while (size > OBJECT_SIZE (order)) order++; } - + d->d.totals[order]++; } - + size_t -ggc_pch_total_size (d) - struct ggc_pch_data *d; +ggc_pch_total_size (struct ggc_pch_data *d) { size_t a = 0; unsigned i; @@ -1888,13 +1862,11 @@ ggc_pch_total_size (d) } void -ggc_pch_this_base (d, base) - struct ggc_pch_data *d; - void *base; +ggc_pch_this_base (struct ggc_pch_data *d, void *base) { size_t a = (size_t) base; unsigned i; - + for (i = 0; i < NUM_ORDERS; i++) { d->base[i] = a; @@ -1904,14 +1876,12 @@ ggc_pch_this_base (d, base) char * -ggc_pch_alloc_object (d, x, size) - struct ggc_pch_data *d; - void *x ATTRIBUTE_UNUSED; - size_t size; +ggc_pch_alloc_object (struct ggc_pch_data *d, void *x ATTRIBUTE_UNUSED, + size_t size) { unsigned order; char *result; - + if (size <= 256) order = size_lookup[size]; else @@ -1926,21 +1896,17 @@ ggc_pch_alloc_object (d, x, size) return result; } -void -ggc_pch_prepare_write (d, f) - struct ggc_pch_data * d ATTRIBUTE_UNUSED; - FILE * f ATTRIBUTE_UNUSED; +void +ggc_pch_prepare_write (struct ggc_pch_data *d ATTRIBUTE_UNUSED, + FILE *f ATTRIBUTE_UNUSED) { /* Nothing to do. */ } void -ggc_pch_write_object (d, f, x, newx, size) - struct ggc_pch_data * d ATTRIBUTE_UNUSED; - FILE *f; - void *x; - void *newx ATTRIBUTE_UNUSED; - size_t size; +ggc_pch_write_object (struct ggc_pch_data *d ATTRIBUTE_UNUSED, + FILE *f, void *x, void *newx ATTRIBUTE_UNUSED, + size_t size) { unsigned order; @@ -1952,7 +1918,7 @@ ggc_pch_write_object (d, f, x, newx, size) while (size > OBJECT_SIZE (order)) order++; } - + if (fwrite (x, size, 1, f) != 1) fatal_error ("can't write PCH file: %m"); @@ -1971,9 +1937,7 @@ ggc_pch_write_object (d, f, x, newx, size) } void -ggc_pch_finish (d, f) - struct ggc_pch_data * d; - FILE *f; +ggc_pch_finish (struct ggc_pch_data *d, FILE *f) { if (fwrite (&d->d, sizeof (d->d), 1, f) != 1) fatal_error ("can't write PCH file: %m"); @@ -1984,9 +1948,7 @@ ggc_pch_finish (d, f) front. */ static void -move_ptes_to_front (count_old_page_tables, count_new_page_tables) - int count_old_page_tables; - int count_new_page_tables; +move_ptes_to_front (int count_old_page_tables, int count_new_page_tables) { unsigned i; @@ -2012,7 +1974,7 @@ move_ptes_to_front (count_old_page_tables, count_new_page_tables) free (G.by_depth); free (G.save_in_use); - + G.by_depth = new_by_depth; G.save_in_use = new_save_in_use; @@ -2033,9 +1995,7 @@ move_ptes_to_front (count_old_page_tables, count_new_page_tables) } void -ggc_pch_read (f, addr) - FILE *f; - void *addr; +ggc_pch_read (FILE *f, void *addr) { struct ggc_pch_ondisk d; unsigned i; @@ -2069,7 +2029,7 @@ ggc_pch_read (f, addr) the PCH file. */ if (fread (&d, sizeof (d), 1, f) != 1) fatal_error ("can't read PCH file: %m"); - + for (i = 0; i < NUM_ORDERS; i++) { struct page_entry *entry; @@ -2083,7 +2043,7 @@ ggc_pch_read (f, addr) bytes = ROUND_UP (d.totals[i] * OBJECT_SIZE (i), G.pagesize); num_objs = bytes / OBJECT_SIZE (i); - entry = xcalloc (1, (sizeof (struct page_entry) + entry = xcalloc (1, (sizeof (struct page_entry) - sizeof (long) + BITMAP_SIZE (num_objs + 1))); entry->bytes = bytes; @@ -2093,16 +2053,16 @@ ggc_pch_read (f, addr) entry->num_free_objects = 0; entry->order = i; - for (j = 0; + for (j = 0; j + HOST_BITS_PER_LONG <= num_objs + 1; j += HOST_BITS_PER_LONG) entry->in_use_p[j / HOST_BITS_PER_LONG] = -1; for (; j < num_objs + 1; j++) - entry->in_use_p[j / HOST_BITS_PER_LONG] + entry->in_use_p[j / HOST_BITS_PER_LONG] |= 1L << (j % HOST_BITS_PER_LONG); - for (pte = entry->page; - pte < entry->page + entry->bytes; + for (pte = entry->page; + pte < entry->page + entry->bytes; pte += G.pagesize) set_page_table_entry (pte, entry); diff --git a/gcc/ggc-simple.c b/gcc/ggc-simple.c index 9964b891e0d..4bcc099760f 100644 --- a/gcc/ggc-simple.c +++ b/gcc/ggc-simple.c @@ -1,5 +1,6 @@ /* Simple garbage collection for the GNU compiler. - Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. This file is part of GCC. @@ -113,25 +114,24 @@ static struct globals /* Local function prototypes. */ -static void tree_insert PARAMS ((struct ggc_mem *)); -static int tree_lookup PARAMS ((struct ggc_mem *)); -static void clear_marks PARAMS ((struct ggc_mem *)); -static void sweep_objs PARAMS ((struct ggc_mem **)); -static void ggc_pop_context_1 PARAMS ((struct ggc_mem *, int)); +static void tree_insert (struct ggc_mem *); +static int tree_lookup (struct ggc_mem *); +static void clear_marks (struct ggc_mem *); +static void sweep_objs (struct ggc_mem **); +static void ggc_pop_context_1 (struct ggc_mem *, int); /* For use from debugger. */ -extern void debug_ggc_tree PARAMS ((struct ggc_mem *, int)); +extern void debug_ggc_tree (struct ggc_mem *, int); #ifdef GGC_BALANCE -extern void debug_ggc_balance PARAMS ((void)); +extern void debug_ggc_balance (void); #endif -static void tally_leaves PARAMS ((struct ggc_mem *, int, size_t *, size_t *)); +static void tally_leaves (struct ggc_mem *, int, size_t *, size_t *); /* Insert V into the search tree. */ static inline void -tree_insert (v) - struct ggc_mem *v; +tree_insert (struct ggc_mem *v) { size_t v_key = PTR_KEY (v); struct ggc_mem *p, **pp; @@ -147,8 +147,7 @@ tree_insert (v) /* Return true if V is in the tree. */ static inline int -tree_lookup (v) - struct ggc_mem *v; +tree_lookup (struct ggc_mem *v) { size_t v_key = PTR_KEY (v); struct ggc_mem *p = G.root; @@ -167,8 +166,7 @@ tree_lookup (v) /* Alloc SIZE bytes of GC'able memory. If ZERO, clear the memory. */ void * -ggc_alloc (size) - size_t size; +ggc_alloc (size_t size) { struct ggc_mem *x; @@ -193,8 +191,7 @@ ggc_alloc (size) /* Mark a node. */ int -ggc_set_mark (p) - const void *p; +ggc_set_mark (const void *p) { struct ggc_mem *x; @@ -217,8 +214,7 @@ ggc_set_mark (p) /* Return 1 if P has been marked, zero otherwise. */ int -ggc_marked_p (p) - const void *p; +ggc_marked_p (const void *p) { struct ggc_mem *x; @@ -234,8 +230,7 @@ ggc_marked_p (p) /* Return the size of the gc-able object P. */ size_t -ggc_get_size (p) - const void *p; +ggc_get_size (const void *p) { struct ggc_mem *x = (struct ggc_mem *) ((const char *)p - offsetof (struct ggc_mem, u)); @@ -245,8 +240,7 @@ ggc_get_size (p) /* Unmark all objects. */ static void -clear_marks (x) - struct ggc_mem *x; +clear_marks (struct ggc_mem *x) { x->mark = 0; if (x->sub[0]) @@ -258,8 +252,7 @@ clear_marks (x) /* Free all objects in the current context that are not marked. */ static void -sweep_objs (root) - struct ggc_mem **root; +sweep_objs (struct ggc_mem **root) { struct ggc_mem *x = *root; if (!x) @@ -308,7 +301,7 @@ sweep_objs (root) /* The top level mark-and-sweep routine. */ void -ggc_collect () +ggc_collect (void) { /* Avoid frequent unnecessary work by skipping collection if the total allocations haven't expanded much since the last @@ -351,7 +344,7 @@ ggc_collect () /* Called once to initialize the garbage collector. */ void -init_ggc () +init_ggc (void) { } @@ -359,7 +352,7 @@ init_ggc () will not be collected while the new context is active. */ void -ggc_push_context () +ggc_push_context (void) { G.context++; @@ -373,7 +366,7 @@ ggc_push_context () will be merged with the old context. */ void -ggc_pop_context () +ggc_pop_context (void) { G.context--; if (G.root) @@ -381,9 +374,7 @@ ggc_pop_context () } static void -ggc_pop_context_1 (x, c) - struct ggc_mem *x; - int c; +ggc_pop_context_1 (struct ggc_mem *x, int c) { if (x->context > c) x->context = c; @@ -396,9 +387,7 @@ ggc_pop_context_1 (x, c) /* Dump a tree. */ void -debug_ggc_tree (p, indent) - struct ggc_mem *p; - int indent; +debug_ggc_tree (struct ggc_mem *p, int indent) { int i; @@ -413,7 +402,7 @@ debug_ggc_tree (p, indent) for (i = 0; i < indent; ++i) putc (' ', stderr); - fprintf (stderr, "%lx %p\n", (unsigned long)PTR_KEY (p), (PTR) p); + fprintf (stderr, "%lx %p\n", (unsigned long)PTR_KEY (p), (void *) p); if (p->sub[1]) debug_ggc_tree (p->sub[1], indent + 1); @@ -425,7 +414,7 @@ debug_ggc_tree (p, indent) #include <math.h> void -debug_ggc_balance () +debug_ggc_balance (void) { size_t nleaf, sumdepth; @@ -443,11 +432,7 @@ debug_ggc_balance () /* Used by debug_ggc_balance, and also by ggc_print_statistics. */ static void -tally_leaves (x, depth, nleaf, sumdepth) - struct ggc_mem *x; - int depth; - size_t *nleaf; - size_t *sumdepth; +tally_leaves (struct ggc_mem *x, int depth, size_t *nleaf, size_t *sumdepth) { if (! x->sub[0] && !x->sub[1]) { @@ -472,7 +457,7 @@ tally_leaves (x, depth, nleaf, sumdepth) /* Report on GC memory usage. */ void -ggc_print_statistics () +ggc_print_statistics (void) { struct ggc_statistics stats; size_t nleaf = 0, sumdepth = 0; @@ -506,73 +491,63 @@ Total memory in GC arena\t%ld%c\n", } struct ggc_pch_data * -init_ggc_pch () +init_ggc_pch (void) { sorry ("Generating PCH files is not supported when using ggc-simple.c"); /* It could be supported, but the code is not yet written. */ return NULL; } -void -ggc_pch_count_object (d, x, size) - struct ggc_pch_data *d ATTRIBUTE_UNUSED; - void *x ATTRIBUTE_UNUSED; - size_t size ATTRIBUTE_UNUSED; +void +ggc_pch_count_object (struct ggc_pch_data *d ATTRIBUTE_UNUSED, + void *x ATTRIBUTE_UNUSED, + size_t size ATTRIBUTE_UNUSED) { } - + size_t -ggc_pch_total_size (d) - struct ggc_pch_data *d ATTRIBUTE_UNUSED; +ggc_pch_total_size (struct ggc_pch_data *d ATTRIBUTE_UNUSED) { return 0; } void -ggc_pch_this_base (d, base) - struct ggc_pch_data *d ATTRIBUTE_UNUSED; - void *base ATTRIBUTE_UNUSED; +ggc_pch_this_base (struct ggc_pch_data *d ATTRIBUTE_UNUSED, + void *base ATTRIBUTE_UNUSED) { } char * -ggc_pch_alloc_object (d, x, size) - struct ggc_pch_data *d ATTRIBUTE_UNUSED; - void *x ATTRIBUTE_UNUSED; - size_t size ATTRIBUTE_UNUSED; +ggc_pch_alloc_object (struct ggc_pch_data *d ATTRIBUTE_UNUSED, + void *x ATTRIBUTE_UNUSED, + size_t size ATTRIBUTE_UNUSED) { return NULL; } -void -ggc_pch_prepare_write (d, f) - struct ggc_pch_data * d ATTRIBUTE_UNUSED; - FILE * f ATTRIBUTE_UNUSED; +void +ggc_pch_prepare_write (struct ggc_pch_data *d ATTRIBUTE_UNUSED, + FILE * f ATTRIBUTE_UNUSED) { } void -ggc_pch_write_object (d, f, x, newx, size) - struct ggc_pch_data * d ATTRIBUTE_UNUSED; - FILE *f ATTRIBUTE_UNUSED; - void *x ATTRIBUTE_UNUSED; - void *newx ATTRIBUTE_UNUSED; - size_t size ATTRIBUTE_UNUSED; +ggc_pch_write_object (struct ggc_pch_data *d ATTRIBUTE_UNUSED, + FILE *f ATTRIBUTE_UNUSED, void *x ATTRIBUTE_UNUSED, + void *newx ATTRIBUTE_UNUSED, + size_t size ATTRIBUTE_UNUSED) { } void -ggc_pch_finish (d, f) - struct ggc_pch_data * d ATTRIBUTE_UNUSED; - FILE *f ATTRIBUTE_UNUSED; +ggc_pch_finish (struct ggc_pch_data *d ATTRIBUTE_UNUSED, + FILE *f ATTRIBUTE_UNUSED) { } void -ggc_pch_read (f, addr) - FILE *f ATTRIBUTE_UNUSED; - void *addr ATTRIBUTE_UNUSED; +ggc_pch_read (FILE *f ATTRIBUTE_UNUSED, void *addr ATTRIBUTE_UNUSED) { /* This should be impossible, since we won't generate any valid PCH files for this configuration. */ diff --git a/gcc/ggc.h b/gcc/ggc.h index e1364a3a84e..2f7d09c3d6f 100644 --- a/gcc/ggc.h +++ b/gcc/ggc.h @@ -1,5 +1,6 @@ /* Garbage collection for the GNU compiler. - Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. This file is part of GCC. @@ -30,35 +31,33 @@ extern const char digit_vector[]; /* "0" .. "9" */ machinery. */ /* The first parameter is a pointer to a pointer, the second a cookie. */ -typedef void (*gt_pointer_operator) PARAMS ((void *, void *)); +typedef void (*gt_pointer_operator) (void *, void *); #include "gtype-desc.h" /* One of these applies its third parameter (with cookie in the fourth parameter) to each pointer in the object pointed to by the first parameter, using the second parameter. */ -typedef void (*gt_note_pointers) - PARAMS ((void *, void *, gt_pointer_operator, void *)); +typedef void (*gt_note_pointers) (void *, void *, gt_pointer_operator, + void *); /* One of these is called before objects are re-ordered in memory. The first parameter is the original object, the second is the subobject that has had its pointers reordered, the third parameter can compute the new values of a pointer when given the cookie in the fourth parameter. */ -typedef void (*gt_handle_reorder) - PARAMS ((void *, void *, gt_pointer_operator, void *)); +typedef void (*gt_handle_reorder) (void *, void *, gt_pointer_operator, + void *); /* Used by the gt_pch_n_* routines. Register an object in the hash table. */ -extern int gt_pch_note_object - PARAMS ((void *, void *, gt_note_pointers)); +extern int gt_pch_note_object (void *, void *, gt_note_pointers); -/* Used by the gt_pch_n_* routines. Register that an object has a reorder +/* Used by the gt_pch_n_* routines. Register that an object has a reorder function. */ -extern void gt_pch_note_reorder - PARAMS ((void *, void *, gt_handle_reorder)); +extern void gt_pch_note_reorder (void *, void *, gt_handle_reorder); /* Mark the object in the first parameter and anything it points to. */ -typedef void (*gt_pointer_walker) PARAMS ((void *)); +typedef void (*gt_pointer_walker) (void *); /* Structures for the easy way to mark roots. In an array, terminated by having base == NULL.*/ @@ -84,7 +83,7 @@ struct ggc_cache_tab { size_t stride; gt_pointer_walker cb; gt_pointer_walker pchw; - int (*marked_p) PARAMS ((const void *)); + int (*marked_p) (const void *); }; #define LAST_GGC_CACHE_TAB { NULL, 0, 0, NULL, NULL, NULL } /* Pointers to arrays of ggc_cache_tab, terminated by NULL. */ @@ -107,102 +106,95 @@ extern const struct ggc_cache_tab * const gt_ggc_cache_rtab[]; returns zero if the object was not previously marked; non-zero if the object was already marked, or if, for any other reason, pointers in this data structure should not be traversed. */ -extern int ggc_set_mark PARAMS ((const void *)); +extern int ggc_set_mark (const void *); /* Return 1 if P has been marked, zero otherwise. P must have been allocated by the GC allocator; it mustn't point to static objects, stack variables, or memory allocated with malloc. */ -extern int ggc_marked_p PARAMS ((const void *)); +extern int ggc_marked_p (const void *); /* Mark the entries in the string pool. */ -extern void ggc_mark_stringpool PARAMS ((void)); +extern void ggc_mark_stringpool (void); /* Call ggc_set_mark on all the roots. */ -extern void ggc_mark_roots PARAMS ((void)); +extern void ggc_mark_roots (void); /* Save and restore the string pool entries for PCH. */ -extern void gt_pch_save_stringpool PARAMS ((void)); -extern void gt_pch_fixup_stringpool PARAMS ((void)); -extern void gt_pch_restore_stringpool PARAMS ((void)); +extern void gt_pch_save_stringpool (void); +extern void gt_pch_fixup_stringpool (void); +extern void gt_pch_restore_stringpool (void); /* PCH and GGC handling for strings, mostly trivial. */ -extern void gt_pch_p_S PARAMS ((void *, void *, - gt_pointer_operator, void *)); -extern void gt_pch_n_S PARAMS ((const void *)); -extern void gt_ggc_m_S PARAMS ((void *)); +extern void gt_pch_p_S (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_n_S (const void *); +extern void gt_ggc_m_S (void *); /* Initialise the string pool. */ -extern void init_stringpool PARAMS ((void)); +extern void init_stringpool (void); /* A GC implementation must provide these functions. They are internal to the GC system. */ /* Initialize the garbage collector. */ -extern void init_ggc PARAMS ((void)); +extern void init_ggc (void); /* Start a new GGC context. Memory allocated in previous contexts will not be collected while the new context is active. */ -extern void ggc_push_context PARAMS ((void)); +extern void ggc_push_context (void); /* Finish a GC context. Any uncollected memory in the new context will be merged with the old context. */ -extern void ggc_pop_context PARAMS ((void)); +extern void ggc_pop_context (void); struct ggc_pch_data; /* Return a new ggc_pch_data structure. */ -extern struct ggc_pch_data *init_ggc_pch PARAMS ((void)); +extern struct ggc_pch_data *init_ggc_pch (void); /* The second parameter and third parameters give the address and size of an object. Update the ggc_pch_data structure with as much of that information as is necessary. */ -extern void ggc_pch_count_object PARAMS ((struct ggc_pch_data *, - void *, size_t)); +extern void ggc_pch_count_object (struct ggc_pch_data *, void *, size_t); -/* Return the total size of the data to be written to hold all +/* Return the total size of the data to be written to hold all the objects previously passed to ggc_pch_count_object. */ -extern size_t ggc_pch_total_size PARAMS ((struct ggc_pch_data *)); +extern size_t ggc_pch_total_size (struct ggc_pch_data *); /* The objects, when read, will most likely be at the address in the second parameter. */ -extern void ggc_pch_this_base PARAMS ((struct ggc_pch_data *, - void *)); +extern void ggc_pch_this_base (struct ggc_pch_data *, void *); /* Assuming that the objects really do end up at the address passed to ggc_pch_this_base, return the address of this object. */ -extern char *ggc_pch_alloc_object PARAMS ((struct ggc_pch_data *, - void *, size_t)); +extern char *ggc_pch_alloc_object (struct ggc_pch_data *, void *, size_t); /* Write out any initial information required. */ -extern void ggc_pch_prepare_write PARAMS ((struct ggc_pch_data *, - FILE *)); +extern void ggc_pch_prepare_write (struct ggc_pch_data *, FILE *); /* Write out this object, including any padding. */ -extern void ggc_pch_write_object PARAMS ((struct ggc_pch_data *, - FILE *, void *, void *, - size_t)); +extern void ggc_pch_write_object (struct ggc_pch_data *, FILE *, void *, + void *, size_t); /* All objects have been written, write out any final information required. */ -extern void ggc_pch_finish PARAMS ((struct ggc_pch_data *, - FILE *)); +extern void ggc_pch_finish (struct ggc_pch_data *, FILE *); /* A PCH file has just been read in at the address specified second parameter. Set up the GC implementation for the new objects. */ -extern void ggc_pch_read PARAMS ((FILE *, void *)); +extern void ggc_pch_read (FILE *, void *); /* Allocation. */ /* The internal primitive. */ -extern void *ggc_alloc PARAMS ((size_t)); +extern void *ggc_alloc (size_t); /* Like ggc_alloc, but allocates cleared memory. */ -extern void *ggc_alloc_cleared PARAMS ((size_t)); +extern void *ggc_alloc_cleared (size_t); /* Resize a block. */ -extern void *ggc_realloc PARAMS ((void *, size_t)); +extern void *ggc_realloc (void *, size_t); /* Like ggc_alloc_cleared, but performs a multiplication. */ -extern void *ggc_calloc PARAMS ((size_t, size_t)); +extern void *ggc_calloc (size_t, size_t); #define ggc_alloc_rtx(NSLOTS) \ ((struct rtx_def *) ggc_alloc (sizeof (struct rtx_def) \ @@ -221,8 +213,8 @@ extern void *ggc_calloc PARAMS ((size_t, size_t)); splay_tree_new_with_allocator (COMPARE, NULL, NULL, \ &ggc_splay_alloc, &ggc_splay_dont_free, \ NULL) -extern PTR ggc_splay_alloc PARAMS ((int, void *)); -extern void ggc_splay_dont_free PARAMS ((void *, void *)); +extern void *ggc_splay_alloc (int, void *); +extern void ggc_splay_dont_free (void *, void *); /* Allocate a gc-able string, and fill it with LENGTH bytes from CONTENTS. If LENGTH is -1, then CONTENTS is assumed to be a @@ -235,16 +227,16 @@ extern const char *ggc_alloc_string PARAMS ((const char *contents, /* Invoke the collector. Garbage collection occurs only when this function is called, not during allocations. */ -extern void ggc_collect PARAMS ((void)); +extern void ggc_collect (void); /* Return the number of bytes allocated at the indicated address. */ -extern size_t ggc_get_size PARAMS ((const void *)); +extern size_t ggc_get_size (const void *); /* Write out all GCed objects to F. */ -extern void gt_pch_save PARAMS ((FILE *f)); +extern void gt_pch_save (FILE *f); /* Read objects previously saved with gt_pch_save from F. */ -extern void gt_pch_restore PARAMS ((FILE *f)); +extern void gt_pch_restore (FILE *f); /* Statistics. */ @@ -258,13 +250,13 @@ typedef struct ggc_statistics /* Used by the various collectors to gather and print statistics that do not depend on the collector in use. */ -extern void ggc_print_common_statistics PARAMS ((FILE *, ggc_statistics *)); +extern void ggc_print_common_statistics (FILE *, ggc_statistics *); /* Print allocation statistics. */ -extern void ggc_print_statistics PARAMS ((void)); -extern void stringpool_statistics PARAMS ((void)); +extern void ggc_print_statistics (void); +extern void stringpool_statistics (void); /* Heuristics. */ -extern int ggc_min_expand_heuristic PARAMS ((void)); -extern int ggc_min_heapsize_heuristic PARAMS ((void)); -extern void init_ggc_heuristics PARAMS ((void)); +extern int ggc_min_expand_heuristic (void); +extern int ggc_min_heapsize_heuristic (void); +extern void init_ggc_heuristics (void); |