Arithmatic
This commit is contained in:
@@ -3,9 +3,11 @@
|
||||
#include "function.h"
|
||||
#include "hashtable.h"
|
||||
#include "lisp.h"
|
||||
#include "lisp_math.h"
|
||||
#include "list.h"
|
||||
#include "stack.h"
|
||||
|
||||
#include <gmp.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
bool lisp_doing_gc;
|
||||
@@ -172,6 +174,9 @@ static void free_object(LispVal *val) {
|
||||
lisp_free(vec->data);
|
||||
break;
|
||||
}
|
||||
case TYPE_GMP:
|
||||
mpz_clear(((LispGmp *) val)->val);
|
||||
break;
|
||||
case TYPE_CONS:
|
||||
case TYPE_SYMBOL:
|
||||
case TYPE_FUNCTION:
|
||||
@@ -236,6 +241,7 @@ static void mark_object(LispVal *val) {
|
||||
break;
|
||||
}
|
||||
case TYPE_STRING:
|
||||
case TYPE_GMP:
|
||||
// no held refs
|
||||
break;
|
||||
case TYPE_FIXNUM:
|
||||
@@ -335,7 +341,7 @@ static void unmark_the_stack(void) {
|
||||
}
|
||||
}
|
||||
|
||||
static void mark_GRAY_objects(size_t *restrict limit) {
|
||||
static void mark_gray_objects(size_t *restrict limit) {
|
||||
while (gray_objects && saturating_dec(limit, 1)) {
|
||||
mark_object(gray_objects->obj);
|
||||
}
|
||||
@@ -394,7 +400,7 @@ void lisp_gc_yield(struct timespec *restrict time_took, bool full) {
|
||||
mark_the_stack(&limit);
|
||||
break;
|
||||
case GC_STEP_HEAP:
|
||||
mark_GRAY_objects(&limit);
|
||||
mark_gray_objects(&limit);
|
||||
break;
|
||||
case GC_STEP_FREE:
|
||||
gc_sweep_objects(&limit);
|
||||
|
||||
Reference in New Issue
Block a user