initial commit

This commit is contained in:
Lobo 2026-01-19 09:08:23 -03:00
commit 146e7a85d6
25 changed files with 5283 additions and 0 deletions

31
gc.h Normal file
View file

@ -0,0 +1,31 @@
#ifndef GC_H
#define GC_H
#include "common.h"
#include "object.h"
#define GC_DEBUG 1
#define HEAP_BYTES (4 * 1024 * 1024)
typedef struct Gs {
U8 *start, *end;
U8 *free;
} Gs;
typedef struct Gc {
Gs from, to;
struct {
O **items;
Z count, capacity;
} roots;
} Gc;
V gc_addroot(Gc *, O *);
I gc_mark(Gc *);
V gc_reset(Gc *, I);
V gc_collect(Gc *);
Hd *gc_alloc(Gc *, Z);
V gc_init(Gc *);
V gc_deinit(Gc *);
#endif