Initial tricolor gc
This commit is contained in:
57
src/gc.h
57
src/gc.h
@ -7,30 +7,6 @@
|
||||
#include <stdio.h>
|
||||
#include <threads.h>
|
||||
|
||||
extern bool lisp_doing_gc;
|
||||
extern struct timespec total_gc_time;
|
||||
extern size_t total_gc_count;
|
||||
|
||||
typedef struct {
|
||||
size_t total_objects_searched;
|
||||
size_t total_objects_cleaned;
|
||||
struct timespec ellapsed_time;
|
||||
} LispGCStats;
|
||||
|
||||
typedef struct {
|
||||
unsigned int mark : 1;
|
||||
tss_t has_local_ref;
|
||||
} ObjectGCInfo;
|
||||
|
||||
void lisp_init_gc(void);
|
||||
|
||||
// the argument is a LispVal *
|
||||
void lisp_gc_register_object(void *obj);
|
||||
void lisp_gc_register_static_object(void *obj);
|
||||
|
||||
// note that the argument is restrict!
|
||||
void lisp_gc_now(LispGCStats *restrict status);
|
||||
|
||||
#define OBJECT_PROCESS_STACK_BLOCK_SIZE 64
|
||||
struct ObjectProcessStackBlock {
|
||||
void *objs[OBJECT_PROCESS_STACK_BLOCK_SIZE];
|
||||
@ -59,7 +35,38 @@ void object_process_stack_push_held_objects(ObjectProcessStack *restrict stack,
|
||||
void *obj);
|
||||
void *object_process_stack_pop(ObjectProcessStack *restrict stack);
|
||||
|
||||
void gc_recursively_mark_object(void *obj);
|
||||
extern bool lisp_doing_gc;
|
||||
extern struct timespec total_gc_time;
|
||||
extern size_t total_gc_count;
|
||||
|
||||
typedef struct {
|
||||
size_t total_objects_searched;
|
||||
size_t total_objects_cleaned;
|
||||
struct timespec ellapsed_time;
|
||||
} LispGCStats;
|
||||
|
||||
typedef uint8_t ObjectGCSet;
|
||||
|
||||
extern ObjectGCSet GC_BLACK;
|
||||
extern ObjectGCSet GC_GREY;
|
||||
extern ObjectGCSet GC_WHITE;
|
||||
|
||||
struct GCObjectList;
|
||||
|
||||
typedef struct {
|
||||
unsigned int is_static : 1;
|
||||
ObjectGCSet set : 2;
|
||||
tss_t has_local_ref;
|
||||
struct GCObjectList *gc_node;
|
||||
} ObjectGCInfo;
|
||||
|
||||
// the argument is a LispVal *
|
||||
void lisp_gc_register_object(void *val);
|
||||
void lisp_gc_register_static_object(void *val);
|
||||
void gc_move_to_set(void *val, ObjectGCSet new_set);
|
||||
|
||||
// note that the argument is restrict!
|
||||
void lisp_gc_now(LispGCStats *restrict status);
|
||||
|
||||
// Debug
|
||||
void debug_print_gc_stats(FILE *stream, const LispGCStats *stats);
|
||||
|
||||
Reference in New Issue
Block a user