+2003-01-30 Daniel Berlin <dberlin@dberlin.org>
+
+ * ggc-zone.c (ggc_free): New function.
+
2004-01-30 Kazu Hirata <kazu@cs.umass.edu>
alloc-pool.c, c-lex.c, c-pragma.h, c-semantics.c, cfghooks.c,
#ifndef HOST_BITS_PER_PTR
#define HOST_BITS_PER_PTR HOST_BITS_PER_LONG
#endif
+
#ifdef COOKIE_CHECKING
#define CHUNK_MAGIC 0x95321123
#define DEADCHUNK_MAGIC 0x12817317
return ggc_alloc_zone_1 (size, zone, -1);
}
+/* Poison the chunk. */
+#ifdef ENABLE_GC_CHECKING
+#define poison_chunk(CHUNK, SIZE) \
+ memset ((CHUNK)->u.data, 0xa5, (SIZE))
+#else
+#define poison_chunk(CHUNK, SIZE)
+#endif
+
+/* Free the object at P. */
+
+void
+ggc_free (void *p)
+{
+ struct alloc_chunk *chunk;
+
+ chunk = (struct alloc_chunk *) ((char *)p - CHUNK_OVERHEAD);
+
+ /* Poison the chunk. */
+ poison_chunk (chunk, ggc_get_size (p));
+
+ /* XXX: We only deal with explicitly freeing large objects ATM. */
+ if (chunk->large)
+ free (p);
+}
+
/* If P is not marked, mark it and return false. Otherwise return true.
P must have been allocated by the GC allocator; it mustn't point to
static objects, stack variables, or memory allocated with malloc. */
for (zone = G.zones; zone; zone = zone->next_zone)
ggc_pop_context_1 (zone);
}
-/* Poison the chunk. */
-#ifdef ENABLE_GC_CHECKING
-#define poison_chunk(CHUNK, SIZE) \
- memset ((CHUNK)->u.data, 0xa5, (SIZE))
-#else
-#define poison_chunk(CHUNK, SIZE)
-#endif
/* Free all empty pages and objects within a page for a given zone */