diff --git a/include/cyclone/types.h b/include/cyclone/types.h index 88556bdd..54e30236 100644 --- a/include/cyclone/types.h +++ b/include/cyclone/types.h @@ -18,6 +18,19 @@ #include // TODO: #include +// Maximum number of args that GC will accept +#define NUM_GC_ANS 128 + +// Which way does the CPU grow its stack? +#define STACK_GROWS_DOWNWARD 1 + +// Size of the stack buffer, in bytes. +// This is used as the first generation of the GC. +#define STACK_SIZE 250000 + +// Size of a "page" on the heap (the 2nd generation), in bytes. +#define HEAP_SIZE 6000000 + /* Define general object type. */ typedef void *object; @@ -27,6 +40,10 @@ struct gc_thread_data_t { // Data needed for stack-based minor GC char *stack_start; char *stack_limit; +TODO: + object gc_cont; + object *gc_ans; //[NUM_GC_ANS]; + short gc_num_ans; // List of objects moved to heap during minor GC void **moveBuf; int moveBufLen; @@ -142,19 +159,6 @@ void gc_wait_handshake(); /* Show diagnostic information for the GC when program terminates */ #define DEBUG_SHOW_DIAG 0 -/* Maximum number of args that GC will accept */ -#define NUM_GC_ANS 128 - -/* Which way does the CPU grow its stack? */ -#define STACK_GROWS_DOWNWARD 1 - -/* Size of the stack buffer, in bytes. - This is used as the first generation of the GC. */ -#define STACK_SIZE 250000 - -/* Size of a "page" on the heap (the 2nd generation), in bytes. */ -#define HEAP_SIZE 6000000 - /* Define size of object tags */ typedef long tag_type; diff --git a/runtime.c b/runtime.c index 2f9f75e7..3527a3a4 100644 --- a/runtime.c +++ b/runtime.c @@ -81,6 +81,8 @@ void Cyc_check_bounds(void *data, const char *label, int len, int index) { /* Global variables. */ gc_heap *Cyc_heap; gc_thread_data *Cyc_thread; + +TODO: get rid of globals below that are not needed clock_t start; /* Starting time. */ char *bottom; /* Bottom of tospace. */ char *allocp; /* Cheney allocate pointer. */ @@ -92,8 +94,11 @@ char *dhbottom; /* Bottom of data heap */ char *dhallocp; /* Current place in data heap */ char *dhalloc_limit; /* GC beyond this limit */ char *dhalloc_end; + long no_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 object gc_cont; /* GC continuation closure. */ object gc_ans[NUM_GC_ANS]; /* argument for GC continuation closure. */ int gc_num_ans;