1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-17 11:10:18 +02:00

Refactor to separate gcbench from gc

This commit is contained in:
Andy Wingo 2022-03-11 10:17:05 +01:00
parent 77ac530360
commit f57a1b8a55
10 changed files with 132 additions and 101 deletions

11
bdw.h
View file

@ -16,19 +16,16 @@
struct context {};
enum alloc_kind { NODE, DOUBLE_ARRAY };
typedef void (*field_visitor)(struct context *, void **ref);
#define GC_HEADER /**/
static inline void* allocate(struct context *cx, enum alloc_kind kind,
size_t size) {
// memset to 0 by the collector.
switch (kind) {
case NODE:
case ALLOC_KIND_NODE:
// cleared to 0 by the collector.
return GC_malloc(size);
case DOUBLE_ARRAY:
case ALLOC_KIND_DOUBLE_ARRAY:
// warning: not cleared!
return GC_malloc_atomic(size);
}
abort();