From 3b932ebfc5a46194583bad4c3c22995df4ff3178 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Tue, 28 Feb 2017 18:27:48 -0500 Subject: [PATCH] WIP --- gc.c | 7 +++++++ include/cyclone/types.h | 2 ++ runtime.c | 1 + scheme/base.sld | 1 + 4 files changed, 11 insertions(+) diff --git a/gc.c b/gc.c index 502cc4c5..e45ec057 100644 --- a/gc.c +++ b/gc.c @@ -1307,6 +1307,12 @@ void gc_mut_cooperate(gc_thread_data * thd, int buf_len) if (thd->scm_thread_obj) { gc_mark_gray(thd, thd->scm_thread_obj); } + if (thd->exception_handler_stack) { + gc_mark_gray(thd, thd->exception_handler_stack); + } + if (thd->param_objs) { + gc_mark_gray(thd, thd->param_objs); + } // Also, mark everything the collector moved to the heap for (i = 0; i < buf_len; i++) { gc_mark_gray(thd, thd->moveBuf[i]); @@ -1883,6 +1889,7 @@ void gc_thread_data_init(gc_thread_data * thd, int mut_num, char *stack_base, thd->mutation_count = 0; thd->mutations = vpbuffer_realloc(thd->mutations, &(thd->mutation_buflen)); + thd->param_objs = NULL; thd->exception_handler_stack = NULL; thd->scm_thread_obj = NULL; thd->thread_state = CYC_THREAD_STATE_NEW; diff --git a/include/cyclone/types.h b/include/cyclone/types.h index b27d99c0..5e81145f 100644 --- a/include/cyclone/types.h +++ b/include/cyclone/types.h @@ -294,6 +294,8 @@ struct gc_thread_data_t { char *stack_prev_frame; // Exception handler stack object exception_handler_stack; + // Parameter object data + object *param_objs; }; /* GC prototypes */ diff --git a/runtime.c b/runtime.c index b9f99882..bd811299 100644 --- a/runtime.c +++ b/runtime.c @@ -4776,6 +4776,7 @@ int gc_minor(void *data, object low_limit, object high_limit, closure cont, // Transport exception stack gc_move2heap(((gc_thread_data *) data)->exception_handler_stack); + gc_move2heap(((gc_thread_data *) data)->param_objs); gc_move2heap(((gc_thread_data *) data)->scm_thread_obj); // Transport mutations diff --git a/scheme/base.sld b/scheme/base.sld index 7db66cec..292f0a5e 100644 --- a/scheme/base.sld +++ b/scheme/base.sld @@ -949,6 +949,7 @@ ((param value) ...) body)))) (define (make-parameter init . o) + ;; TODO: need to store/set value in the thread data parameter (param_objs), to make it thread-specific (let* ((converter (if (pair? o) (car o) (lambda (x) x))) (value (converter init)))