aboutsummaryrefslogtreecommitdiff
path: root/gcc/ggc.h
diff options
context:
space:
mode:
authorDaniel Berlin <dberlin@dberlin.org>2003-10-27 00:26:52 +0000
committerDaniel Berlin <dberlin@gcc.gnu.org>2003-10-27 00:26:52 +0000
commitb6f611637e7411536dc883100c543547f4b7c03a (patch)
tree4348e45b7dfeeb6d8cce2f6f38df5cb802f97b60 /gcc/ggc.h
parent60b6a81550ece89cc0d49dc7741f609c0886d191 (diff)
downloadgcc-b6f611637e7411536dc883100c543547f4b7c03a.zip
gcc-b6f611637e7411536dc883100c543547f4b7c03a.tar.gz
gcc-b6f611637e7411536dc883100c543547f4b7c03a.tar.bz2
ggc-zone.c: New file, zone allocating collector.
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. From-SVN: r72971
Diffstat (limited to 'gcc/ggc.h')
-rw-r--r--gcc/ggc.h37
1 files changed, 28 insertions, 9 deletions
diff --git a/gcc/ggc.h b/gcc/ggc.h
index 153b29e..4f25f73 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)