mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-06 20:56:36 +02:00
Integrate gc_cont globals with thread data structure
This commit is contained in:
parent
19a4a9599c
commit
8da3b29e89
4 changed files with 13 additions and 16 deletions
|
@ -21,8 +21,6 @@ static void Cyc_main (stack_size,heap_size,stack_base)
|
||||||
long stack_size,heap_size; char *stack_base;
|
long stack_size,heap_size; char *stack_base;
|
||||||
{char in_my_frame;
|
{char in_my_frame;
|
||||||
mclosure0(clos_halt,&Cyc_halt); /* Halt program if final closure is reached */
|
mclosure0(clos_halt,&Cyc_halt); /* Halt program if final closure is reached */
|
||||||
gc_ans[0] = &clos_halt;
|
|
||||||
gc_num_ans = 1;
|
|
||||||
|
|
||||||
/* Initialize stack trace table */
|
/* Initialize stack trace table */
|
||||||
Cyc_st_init();
|
Cyc_st_init();
|
||||||
|
@ -30,7 +28,6 @@ static void Cyc_main (stack_size,heap_size,stack_base)
|
||||||
{
|
{
|
||||||
/* Setup first function to execute */
|
/* Setup first function to execute */
|
||||||
mclosure0(entry_pt,&c_entry_pt);
|
mclosure0(entry_pt,&c_entry_pt);
|
||||||
gc_cont = &entry_pt;
|
|
||||||
|
|
||||||
/* Allocate heap area for second generation. */
|
/* Allocate heap area for second generation. */
|
||||||
/* Use calloc instead of malloc to assure pages are in main memory. */
|
/* Use calloc instead of malloc to assure pages are in main memory. */
|
||||||
|
@ -42,6 +39,9 @@ static void Cyc_main (stack_size,heap_size,stack_base)
|
||||||
Cyc_thread = malloc(sizeof(gc_thread_data));
|
Cyc_thread = malloc(sizeof(gc_thread_data));
|
||||||
gc_thread_data_init(Cyc_thread, stack_base, stack_size);
|
gc_thread_data_init(Cyc_thread, stack_base, stack_size);
|
||||||
|
|
||||||
|
Cyc_thread->gc_cont = &entry_pt;
|
||||||
|
Cyc_thread->gc_ans[0] = &clos_halt;
|
||||||
|
Cyc_thread->gc_num_ans = 1;
|
||||||
|
|
||||||
// JAE TODO: clean up below (and all of this old code, really)
|
// JAE TODO: clean up below (and all of this old code, really)
|
||||||
bottom = calloc(1,heap_size);
|
bottom = calloc(1,heap_size);
|
||||||
|
@ -66,10 +66,10 @@ static void Cyc_main (stack_size,heap_size,stack_base)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// 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(gc_cont) == cons_tag || prim(gc_cont)) {
|
if (type_of(Cyc_thread->gc_cont) == cons_tag || prim(Cyc_thread->gc_cont)) {
|
||||||
Cyc_apply_from_buf(Cyc_thread, gc_num_ans, gc_cont, gc_ans);
|
Cyc_apply_from_buf(Cyc_thread, Cyc_thread->gc_num_ans, Cyc_thread->gc_cont, Cyc_thread->gc_ans);
|
||||||
} else {
|
} else {
|
||||||
do_dispatch(Cyc_thread, gc_num_ans, ((closure)gc_cont)->fn, gc_cont, gc_ans);
|
do_dispatch(Cyc_thread, Cyc_thread->gc_num_ans, ((closure)(Cyc_thread->gc_cont))->fn, Cyc_thread->gc_cont, Cyc_thread->gc_ans);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Internal error: should never have reached this line\n"); exit(0);}}
|
printf("Internal error: should never have reached this line\n"); exit(0);}}
|
||||||
|
|
|
@ -222,9 +222,6 @@ extern char *dhalloc_limit; /* GC beyond this limit */
|
||||||
extern char *dhalloc_end;
|
extern char *dhalloc_end;
|
||||||
extern long no_gcs; /* Count the number of GC's. */
|
extern long no_gcs; /* Count the number of GC's. */
|
||||||
extern long no_major_gcs; /* Count the number of GC's. */
|
extern long no_major_gcs; /* Count the number of GC's. */
|
||||||
extern object gc_cont; /* GC continuation closure. */
|
|
||||||
extern object gc_ans[NUM_GC_ANS]; /* argument for GC continuation closure. */
|
|
||||||
extern int gc_num_ans;
|
|
||||||
|
|
||||||
/* Define Lisp constants we need. */
|
/* Define Lisp constants we need. */
|
||||||
extern const object boolean_t;
|
extern const object boolean_t;
|
||||||
|
|
|
@ -42,7 +42,7 @@ struct gc_thread_data_t {
|
||||||
char *stack_limit;
|
char *stack_limit;
|
||||||
jmp_buf *jmp_start;
|
jmp_buf *jmp_start;
|
||||||
object gc_cont;
|
object gc_cont;
|
||||||
object *gc_ans; //[NUM_GC_ANS];
|
object *gc_ans;
|
||||||
short gc_num_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;
|
||||||
|
|
12
runtime.c
12
runtime.c
|
@ -99,9 +99,9 @@ long no_gcs = 0; /* Count the number of GC's. */
|
||||||
long no_major_gcs = 0; /* Count the number of GC's. */
|
long no_major_gcs = 0; /* Count the number of GC's. */
|
||||||
|
|
||||||
//TODO: after previous change, move these to thread data structure
|
//TODO: after previous change, move these to thread data structure
|
||||||
object gc_cont; /* GC continuation closure. */
|
//object gc_cont; /* GC continuation closure. */
|
||||||
object gc_ans[NUM_GC_ANS]; /* argument for GC continuation closure. */
|
//object gc_ans[NUM_GC_ANS]; /* argument for GC continuation closure. */
|
||||||
int gc_num_ans;
|
//int gc_num_ans;
|
||||||
|
|
||||||
object Cyc_global_variables = nil;
|
object Cyc_global_variables = nil;
|
||||||
int _cyc_argc = 0;
|
int _cyc_argc = 0;
|
||||||
|
@ -2617,12 +2617,12 @@ void GC(void *data, closure cont, object *args, int num_args)
|
||||||
}
|
}
|
||||||
|
|
||||||
gc_move2heap(cont);
|
gc_move2heap(cont);
|
||||||
gc_cont = cont;
|
((gc_thread_data *)data)->gc_cont = cont;
|
||||||
gc_num_ans = num_args;
|
((gc_thread_data *)data)->gc_num_ans = 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_ans[i] = args[i];
|
((gc_thread_data *)data)->gc_ans[i] = args[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transport mutations
|
// Transport mutations
|
||||||
|
|
Loading…
Add table
Reference in a new issue