Initial tricolor gc

This commit is contained in:
2026-01-22 01:31:20 -08:00
parent 656846ddc0
commit 1a0906206a
7 changed files with 239 additions and 197 deletions
+22 -10
View File
@@ -103,16 +103,6 @@ static ALWAYS_INLINE bool OBJECTP(LispVal *val) {
return EXTRACT_TAG(val) == LISP_OBJECT_TAG;
}
static ALWAYS_INLINE void SET_OBJECT_MARKED(LispVal *val, bool marked) {
assert(OBJECTP(val));
((LispObject *) val)->gc.mark = marked;
}
static ALWAYS_INLINE bool OBJECT_MARKED_P(LispVal *val) {
assert(OBJECTP(val));
return ((LispObject *) val)->gc.mark;
}
// ONLY APPLIES TO THE CALLING THREAD
static ALWAYS_INLINE bool OBJECT_HAS_LOCAL_REFERENCE_P(LispVal *val) {
assert(OBJECTP(val));
@@ -128,6 +118,28 @@ static ALWAYS_INLINE void SET_OBJECT_HAS_LOCAL_REFERENCE(LispVal *val,
(void *) (uintptr_t) (has_local_ref ? 1 : 0));
}
static ALWAYS_INLINE ObjectGCSet OBJECT_GET_GC_SET(LispVal *val) {
assert(OBJECTP(val));
return ((LispObject *) val)->gc.set;
}
static ALWAYS_INLINE bool OBJECT_GC_SET_P(LispVal *val, ObjectGCSet set) {
return OBJECT_GET_GC_SET(val) == set;
}
static ALWAYS_INLINE bool OBJECT_STATIC_P(LispVal *val) {
assert(OBJECTP(val));
return ((LispObject *) val)->gc.is_static;
}
static inline void MARK_OBJECT_ADDED(LispVal *val, LispVal *into) {
ObjectGCSet val_set = OBJECT_GET_GC_SET(val);
ObjectGCSet into_set = OBJECT_GET_GC_SET(into);
if (into_set == GC_BLACK && val_set == GC_WHITE) {
gc_move_to_set(val, GC_GREY);
}
}
static ALWAYS_INLINE LispValType TYPE_OF(LispVal *val) {
if (FIXNUMP(val)) {
return TYPE_FIXNUM;