Commit 20c1dc5e by Andreas Jaeger Committed by Andreas Jaeger

ggc.h: Convert to ISO C90 prototypes.

	* ggc.h: Convert to ISO C90 prototypes.
	* ggc-none.c: Likewise.
	* ggc-common.c: Likewise.
	* ggc-page.c: Likewise.
	* ggc-simple.c: Likewise.

From-SVN: r67596
parent 60e9f0d7
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.
......
......@@ -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;
......@@ -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. */
......@@ -248,10 +237,8 @@ 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;
......@@ -283,10 +270,8 @@ 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;
......@@ -304,16 +289,13 @@ gt_pch_note_reorder (obj, note_ptr_cookie, 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;
}
......@@ -332,9 +314,7 @@ 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;
......@@ -345,9 +325,7 @@ call_count (slot, state_p)
}
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;
......@@ -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,9 +349,7 @@ 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
......@@ -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;
......@@ -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;
......@@ -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;
......@@ -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,7 +639,7 @@ 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();
......@@ -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();
......@@ -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());
......
/* 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);
}
/* 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,7 +491,7 @@ 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. */
......@@ -514,65 +499,55 @@ init_ggc_pch ()
}
void
ggc_pch_count_object (d, x, size)
struct ggc_pch_data *d ATTRIBUTE_UNUSED;
void *x ATTRIBUTE_UNUSED;
size_t size ATTRIBUTE_UNUSED;
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;
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. */
......
/* 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
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
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);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment