Commit a024d1bf authored by Camil Staps's avatar Camil Staps 🍃

(untested) only consider our own finalizers

parent 29a9b1a2
Pipeline #11627 passed with stage
in 8 minutes and 16 seconds
#include "copy_node.h"
#include "finalizers.h"
extern struct finalizers *finalizer_list;
extern void *__Nil;
extern void *e____system__kFinalizer;
struct finalizers *next_finalizer(struct finalizers *now) {
struct finalizers *next_interpreter_finalizer(struct finalizers *now) {
now = now == NULL ? finalizer_list : now->next;
while (((BC_WORD) now != (BC_WORD) &__Nil-8) && now->cur->fun != interpreter_finalizer)
now = now->next;
return ((BC_WORD) now == (BC_WORD) &__Nil-8) ? NULL : now;
}
......
......@@ -15,5 +15,5 @@ struct finalizers {
struct finalizer *cur;
};
struct finalizers *next_finalizer(struct finalizers *);
struct finalizers *next_interpreter_finalizer(struct finalizers *);
BC_WORD *build_finalizer(BC_WORD *heap, void (*fun)(BC_WORD), BC_WORD arg);
......@@ -53,7 +53,7 @@ BC_WORD *collect_copy(BC_WORD *stack, BC_WORD *asp, BC_WORD *heap, size_t heap_s
fprintf(stderr, "Pass 1b: reverse pointers from the host\n");
# endif
struct finalizers *finalizers = NULL;
while ((finalizers = next_finalizer(finalizers)) != NULL) {
while ((finalizers = next_interpreter_finalizer(finalizers)) != NULL) {
# if (DEBUG_GARBAGE_COLLECTOR > 2)
fprintf(stderr, "\t%p -> %p\n", (void*)finalizers->cur->arg, ((void**)finalizers->cur->arg)[1]);
# endif
......
......@@ -151,7 +151,7 @@ void mark_a_stack(BC_WORD *stack, BC_WORD *asp, BC_WORD *heap, size_t heap_size,
#ifdef LINK_CLEAN_RUNTIME
void mark_host_references(BC_WORD *heap, size_t heap_size, struct nodes_set *set) {
struct finalizers *finalizers = NULL;
while ((finalizers = next_finalizer(finalizers)) != NULL)
while ((finalizers = next_interpreter_finalizer(finalizers)) != NULL)
add_grey_node(set, (BC_WORD*) finalizers->cur->arg, heap, heap_size);
}
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment