summaryrefslogtreecommitdiff
path: root/gcc/ggc.h
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-19 14:52:28 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-19 14:52:28 +0000
commit94cd0238acdaea5ab220faaa3a6b7ecc0ec0c512 (patch)
tree2d0b169c0f26c547768fc58587ce8e5499b185c4 /gcc/ggc.h
parentbfb15fba113e0281773ccaacce3f61b25f8b2003 (diff)
downloadgcc-94cd0238acdaea5ab220faaa3a6b7ecc0ec0c512.tar.gz
2011-10-19 Basile Starynkevitch <basile@starynkevitch.net>
* ggc.h (ggc_destructor_t): New type, signature of destructor routines. (ggc_finalized_alloc_stat): New declaration. (ggc_finalized_alloc): New macro. * ggc-zone.c (ggc_finalized_alloc_stat): Adding new function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@180191 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ggc.h')
-rw-r--r--gcc/ggc.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/ggc.h b/gcc/ggc.h
index 704237cc045..fd98586b149 100644
--- a/gcc/ggc.h
+++ b/gcc/ggc.h
@@ -142,6 +142,11 @@ extern void gt_pch_save (FILE *f);
/* Allocation. */
+/* The macros MEM_STAT_DECL, MEM_STAT_INFO, PASS_MEM_STAT,
+ ALONE_MEM_STAT_DECL, ALONE_MEM_STAT_INFO are always defined but may
+ be empty. They are provided by header file statistics.h, and are
+ useful when GATHER_STATISTICS is required. */
+
/* The internal primitive. */
extern void *ggc_internal_alloc_stat (size_t MEM_STAT_DECL);
@@ -152,6 +157,17 @@ extern size_t ggc_round_alloc_size (size_t requested_size);
/* Allocate an object of the specified type and size. */
extern void *ggc_alloc_typed_stat (enum gt_types_enum, size_t MEM_STAT_DECL);
+
+/* Signature of destructors -or finalizers-, as known to GGC. */
+typedef void (ggc_destructor_t) (void*);
+
+/* Allocate finalized cleared memory. The finalizer is run by the
+ garbage collector before destroying the object and realeasing its
+ memory. It should not call, even indirectly, any allocator. */
+extern void *ggc_finalized_alloc_stat (size_t, ggc_destructor_t* MEM_STAT_DECL);
+#define ggc_finalized_alloc(s, f) ggc_finalized_alloc_stat(s, f MEM_STAT_INFO)
+
+
#define ggc_alloc_typed(s, z) ggc_alloc_typed_stat (s, z MEM_STAT_INFO)
/* Allocates cleared memory. */
@@ -267,6 +283,7 @@ extern struct alloc_zone tree_zone;
/* For IDENTIFIER_NODE allocations. */
extern struct alloc_zone tree_id_zone;
+
#define ggc_alloc_rtvec_sized(NELT) \
ggc_alloc_zone_rtvec_def (sizeof (struct rtvec_def) \
+ ((NELT) - 1) * sizeof (rtx), \
@@ -302,6 +319,7 @@ ggc_internal_zone_vec_alloc_stat (struct alloc_zone * z, size_t s, size_t n
}
+
#else
static inline void *