Renamed minor GC args vars to be consistent with GC code

This commit is contained in:
Justin Ethier 2015-11-06 22:31:31 -05:00
parent 70645643ca
commit 32465d5da8
4 changed files with 17 additions and 16 deletions

6
gc.c
View file

@ -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->mutator_num = mut_num;
thd->jmp_start = malloc(sizeof(jmp_buf)); thd->jmp_start = malloc(sizeof(jmp_buf));
thd->gc_ans = malloc(sizeof(object) * NUM_GC_ANS); thd->gc_args = malloc(sizeof(object) * NUM_GC_ANS);
thd->gc_num_ans = 0; thd->gc_num_args = 0;
thd->moveBufLen = 0; thd->moveBufLen = 0;
gc_thr_grow_move_buffer(thd); gc_thr_grow_move_buffer(thd);
// TODO: depends on collector state: thd->gc_alloc_color = ATOMIC_GET(&gc_; // 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) {
if (thd->jmp_start) free(thd->jmp_start); 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->moveBuf) free(thd->moveBuf);
if (thd->mark_buffer) free(thd->mark_buffer); if (thd->mark_buffer) free(thd->mark_buffer);
free(thd); free(thd);

View file

@ -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); gc_thread_data_init(Cyc_mutators[0], 0, stack_base, stack_size);
Cyc_mutators[0]->gc_cont = &entry_pt; Cyc_mutators[0]->gc_cont = &entry_pt;
Cyc_mutators[0]->gc_ans[0] = &clos_halt; Cyc_mutators[0]->gc_args[0] = &clos_halt;
Cyc_mutators[0]->gc_num_ans = 1; Cyc_mutators[0]->gc_num_args = 1;
/* Tank, load the jump program... */ /* Tank, load the jump program... */
setjmp(*(Cyc_mutators[0]->jmp_start)); 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 // 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)) { 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 { } 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);}} printf("Internal error: should never have reached this line\n"); exit(0);}}

View file

@ -37,19 +37,20 @@ typedef void *object;
/* Thread data structures */ /* Thread data structures */
typedef struct gc_thread_data_t gc_thread_data; typedef struct gc_thread_data_t gc_thread_data;
struct gc_thread_data_t { 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_start;
char *stack_limit; char *stack_limit;
//TODO: store stack traces per thread //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 // List of objects moved to heap during minor GC
void **moveBuf; void **moveBuf;
int moveBufLen; 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 // Data needed for heap GC
int gc_alloc_color; int gc_alloc_color;
int gc_mut_status; int gc_mut_status;

View file

@ -2600,11 +2600,11 @@ void GC(void *data, closure cont, object *args, int num_args)
gc_move2heap(cont); gc_move2heap(cont);
((gc_thread_data *)data)->gc_cont = 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++){ for (i = 0; i < num_args; i++){
gc_move2heap(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 // Transport mutations