diff options
author | dberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-27 00:26:52 +0000 |
---|---|---|
committer | dberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-27 00:26:52 +0000 |
commit | 7d60cc603c75cb116460c7cc446891bae4462cb2 (patch) | |
tree | 4348e45b7dfeeb6d8cce2f6f38df5cb802f97b60 /gcc/ggc.h | |
parent | 486ca58f07fc2bc1f49ed571f507d792e21b4f1b (diff) | |
download | gcc-7d60cc603c75cb116460c7cc446891bae4462cb2.tar.gz |
2003-10-26 Daniel Berlin <dberlin@dberlin.org>
* ggc-zone.c: New file, zone allocating collector.
* configure: Accept zone option for --with-gc
* configure.in: Ditto.
* ggc.h (ggc_pch_count_object): Pass bool indicating
stringiness. Update all callers.
(ggc_pch_alloc_object): Ditto.
(ggc_pch_write_object): Ditto.
(ggc_alloc_rtx): Use typed allocation, since all RTX's are of a single
type.
(ggc_alloc_rtvec): Ditto.
(ggc_alloc_tree): Use zone allocation, since some things using this macro
aren't a single typecode.
* ggc-none.c (ggc_alloc_typed): New function.
(ggc_alloc_zone): Ditto.
* ggc-page.c: Ditto on both functions.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72971 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ggc.h')
-rw-r--r-- | gcc/ggc.h | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/gcc/ggc.h b/gcc/ggc.h index 153b29ebd36..4f25f7373c2 100644 --- a/gcc/ggc.h +++ b/gcc/ggc.h @@ -159,8 +159,9 @@ 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 (struct ggc_pch_data *, void *, size_t); + that information as is necessary. The last argument should be true + if the object is a string. */ +extern void ggc_pch_count_object (struct ggc_pch_data *, void *, size_t, bool); /* Return the total size of the data to be written to hold all the objects previously passed to ggc_pch_count_object. */ @@ -171,14 +172,16 @@ extern size_t ggc_pch_total_size (struct ggc_pch_data *); 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 (struct ggc_pch_data *, void *, size_t); + passed to ggc_pch_this_base, return the address of this object. + The last argument should be true if the object is a string. */ +extern char *ggc_pch_alloc_object (struct ggc_pch_data *, void *, size_t, bool); /* Write out any initial information required. */ extern void ggc_pch_prepare_write (struct ggc_pch_data *, FILE *); -/* Write out this object, including any padding. */ +/* Write out this object, including any padding. The last argument should be + true if the object is a string. */ extern void ggc_pch_write_object (struct ggc_pch_data *, FILE *, void *, - void *, size_t); + void *, size_t, bool); /* All objects have been written, write out any final information required. */ extern void ggc_pch_finish (struct ggc_pch_data *, FILE *); @@ -190,22 +193,38 @@ extern void ggc_pch_read (FILE *, void *); /* Allocation. */ +/* Zone structure. */ +struct alloc_zone; +/* For single pass garbage. */ +extern struct alloc_zone *garbage_zone; +/* For regular rtl allocations. */ +extern struct alloc_zone *rtl_zone; +/* For regular tree allocations. */ +extern struct alloc_zone *tree_zone; + /* The internal primitive. */ extern void *ggc_alloc (size_t); +/* Allocate an object into the specified allocation zone. */ +extern void *ggc_alloc_zone (size_t, struct alloc_zone *); +/* Allocate an object of the specified type and size. */ +extern void *ggc_alloc_typed (enum gt_types_enum, size_t); /* Like ggc_alloc, but allocates cleared memory. */ extern void *ggc_alloc_cleared (size_t); +/* Like ggc_alloc_zone, but allocates cleared memory. */ +extern void *ggc_alloc_cleared_zone (size_t, struct alloc_zone *); /* Resize a block. */ extern void *ggc_realloc (void *, size_t); /* Like ggc_alloc_cleared, but performs a multiplication. */ extern void *ggc_calloc (size_t, size_t); -#define ggc_alloc_rtx(CODE) ((rtx) ggc_alloc (RTX_SIZE (CODE))) +#define ggc_alloc_rtx(CODE) \ + ((rtx) ggc_alloc_typed (gt_ggc_e_7rtx_def, RTX_SIZE (CODE))) #define ggc_alloc_rtvec(NELT) \ - ((rtvec) ggc_alloc (sizeof (struct rtvec_def) \ + ((rtvec) ggc_alloc_typed (gt_ggc_e_9rtvec_def, sizeof (struct rtvec_def) \ + ((NELT) - 1) * sizeof (rtx))) -#define ggc_alloc_tree(LENGTH) ((tree) ggc_alloc (LENGTH)) +#define ggc_alloc_tree(LENGTH) ((tree) ggc_alloc_zone (LENGTH, tree_zone)) #define htab_create_ggc(SIZE, HASH, EQ, DEL) \ htab_create_alloc (SIZE, HASH, EQ, DEL, ggc_calloc, NULL) |