From 32465d5da8230c8dc2ee8e0cd9c480d98eea9207 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Fri, 6 Nov 2015 22:31:31 -0500 Subject: [PATCH] Renamed minor GC args vars to be consistent with GC code --- gc.c | 6 +++--- include/cyclone/runtime-main.h | 8 ++++---- include/cyclone/types.h | 15 ++++++++------- runtime.c | 4 ++-- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/gc.c b/gc.c index ad0f5bf4..1e116677 100644 --- a/gc.c +++ b/gc.c @@ -677,8 +677,8 @@ void gc_thread_data_init(gc_thread_data *thd, int mut_num, char *stack_base, lon } thd->mutator_num = mut_num; thd->jmp_start = malloc(sizeof(jmp_buf)); - thd->gc_ans = malloc(sizeof(object) * NUM_GC_ANS); - thd->gc_num_ans = 0; + thd->gc_args = malloc(sizeof(object) * NUM_GC_ANS); + thd->gc_num_args = 0; thd->moveBufLen = 0; gc_thr_grow_move_buffer(thd); // TODO: depends on collector state: thd->gc_alloc_color = ATOMIC_GET(&gc_; @@ -697,7 +697,7 @@ void gc_thread_data_free(gc_thread_data *thd) { if (thd) { if (thd->jmp_start) free(thd->jmp_start); - if (thd->gc_ans) free(thd->gc_ans); + if (thd->gc_args) free(thd->gc_args); if (thd->moveBuf) free(thd->moveBuf); if (thd->mark_buffer) free(thd->mark_buffer); free(thd); diff --git a/include/cyclone/runtime-main.h b/include/cyclone/runtime-main.h index 502fc306..15be2636 100644 --- a/include/cyclone/runtime-main.h +++ b/include/cyclone/runtime-main.h @@ -50,8 +50,8 @@ static void Cyc_main (stack_size,heap_size,stack_base) gc_thread_data_init(Cyc_mutators[0], 0, stack_base, stack_size); Cyc_mutators[0]->gc_cont = &entry_pt; - Cyc_mutators[0]->gc_ans[0] = &clos_halt; - Cyc_mutators[0]->gc_num_ans = 1; + Cyc_mutators[0]->gc_args[0] = &clos_halt; + Cyc_mutators[0]->gc_num_args = 1; /* Tank, load the jump program... */ setjmp(*(Cyc_mutators[0]->jmp_start)); @@ -61,9 +61,9 @@ static void Cyc_main (stack_size,heap_size,stack_base) // JAE - note for the general case, setjmp will return the data pointer's addy if (type_of(Cyc_mutators[0]->gc_cont) == cons_tag || prim(Cyc_mutators[0]->gc_cont)) { - Cyc_apply_from_buf(Cyc_mutators[0], Cyc_mutators[0]->gc_num_ans, Cyc_mutators[0]->gc_cont, Cyc_mutators[0]->gc_ans); + Cyc_apply_from_buf(Cyc_mutators[0], Cyc_mutators[0]->gc_num_ans, Cyc_mutators[0]->gc_cont, Cyc_mutators[0]->gc_args); } else { - do_dispatch(Cyc_mutators[0], Cyc_mutators[0]->gc_num_ans, ((closure)(Cyc_mutators[0]->gc_cont))->fn, Cyc_mutators[0]->gc_cont, Cyc_mutators[0]->gc_ans); + do_dispatch(Cyc_mutators[0], Cyc_mutators[0]->gc_num_ans, ((closure)(Cyc_mutators[0]->gc_cont))->fn, Cyc_mutators[0]->gc_cont, Cyc_mutators[0]->gc_args); } printf("Internal error: should never have reached this line\n"); exit(0);}} diff --git a/include/cyclone/types.h b/include/cyclone/types.h index 045fc35a..6cbdfde4 100644 --- a/include/cyclone/types.h +++ b/include/cyclone/types.h @@ -37,19 +37,20 @@ typedef void *object; /* Thread data structures */ typedef struct gc_thread_data_t gc_thread_data; struct gc_thread_data_t { - // Data needed for stack-based minor GC + // Data needed to initiate stack-based minor GC char *stack_start; char *stack_limit; //TODO: store stack traces per thread - // Need the following to perform longjmp's - int mutator_num; - jmp_buf *jmp_start; - object gc_cont; - object *gc_ans; - short gc_num_ans; // List of objects moved to heap during minor GC void **moveBuf; int moveBufLen; + // Need the following to perform longjmp's + int mutator_num; + jmp_buf *jmp_start; + // After longjmp, pick up execution using continuation/arguments + object gc_cont; + object *gc_args; + short gc_num_args; // Data needed for heap GC int gc_alloc_color; int gc_mut_status; diff --git a/runtime.c b/runtime.c index 5b7b26f6..eb2f2b15 100644 --- a/runtime.c +++ b/runtime.c @@ -2600,11 +2600,11 @@ void GC(void *data, closure cont, object *args, int num_args) gc_move2heap(cont); ((gc_thread_data *)data)->gc_cont = cont; - ((gc_thread_data *)data)->gc_num_ans = num_args; + ((gc_thread_data *)data)->gc_num_args = num_args; for (i = 0; i < num_args; i++){ gc_move2heap(args[i]); - ((gc_thread_data *)data)->gc_ans[i] = args[i]; + ((gc_thread_data *)data)->gc_args[i] = args[i]; } // Transport mutations